FlexIO Classic
What Is FlexIO Classic?
An updated version of FlexIO was created, and details can be found on the Pro version Here.
The Classic version of FlexIO was a program I wrote to replace the CNC bender software on some of the equipment I was using at work. The original bending tool was very limited with what it could do, and how it operated. After working with the program for a short period of time, and realizing just how horrible it was to work with, I arranged with my employer to work on a new, revamped version. Most of the work for FlexIO was completed on my own time.
For a more detailed look at some of the hardware aspect to this project, see Updating Bender Hardware. This page shows some of the hardware changes I have made to the machines, to accompany the new changes to the software. It also gives a general idea of what the machine is capable of doing, as well as the hardware limitations that have been removed since each upgrade.
The Problem
The project came about due to the limitations of the original software being used on the machines. To put it in a nutshell, it was utter crap and was horrible to work with. Some of the many issues/problems with the software included:
- The program would only work on Windows 98 and Windows 95. There is another machine (since upgraded to “Sir Clive”) that requires DOS to power an even older version of this program with even more limitations and problems.
- It required a mandatory full-sized ISA expansion card to power the controller. The card was no longer available to purchase, and neither were computers with ISA slots.
- There were no drivers for the controller capable of working on anything above Windows 95/98.
- The program was written using a very old version of Delphi, which was no longer supported. This was also one of the reasons why it wouldn’t work on any other Operating System. The compiled libs were big, bulky, limited and heavily bug ridden.
- The program we were using had been originally written by Seven Associates, and taken by another independent coder and altered slightly, making it almost custom software to each individual machine. The ability to make changes on a per-machine level were near impossible. The original company went out of business, and the other author was not willing to make the changes we asked for.
- The program was written so badly, every element of configuration was hard-coded into the source code. Recalibrating the software for a new motor, for example, was impossible without recompiling the sources for that specific machine. We ran into that problem when I replaced a motor in the past, and having to manually compensate for the new motor being more accurate than before (by changing certain bending parameters to trick the machine into bending it correctly). There were no settings to change in the original program besides those to bend a piece of cable.
- I had a list of over 40 know bugs, issues, safety questions and limitations imposed on both the hardware and software. These ranged from specific bending issues (compound bending, illegal bend angles etc.) to software issues (morbidly wrong math, ridiculous rounding errors, lack of floating point calculations and frequent crashing – see Bending On Steroids below). There were no safety checks done in software, the operator had one master ‘Emergency Stop’ button which killed power to the motors, and if hit too late could still cause hundreds of dollars of damage to the machine (witnessed this first-hand many times from different operators) or even injure the operator (which has happened).
- I wanted to push the limits of the benders much further than they were, and this was impossible using the old program.
The Solution
When I first proposed the idea of re-working the software, several crazy ideas floated around the office on how it should be done. One of the big problems when a non-programmer is involved in such decisions is that they often overlook many of the dead-obvious problems a programmer picks up on right away. So, crazy ideas such as just buying a new PC and adding some buttons, to just adding a config screen were passed along to me. I dismissed all of the crazy notion and decided to go ahead and re-code the entire thing from scratch. As a programmer, I hate just “patching” a problem to make it go away, and I wanted to make a clean break with a completely brand new tool. I had already written several tools that made my job work better and saved the company money (See Bend File Printer) and wanted to try and do the same here.
FlexIO Was Born!
I came up with the idea of the name of FlexIO, which is latin for Bending, or To Bend. At the time, I was working on an older version of the Bend File Printer tool and realized that I could save myself a lot of time by re-writing some of it’s code into a shared library. This was a task that I did on my own free time, and later became BenderLibrary, a shared library of data, classes and code related specifically to cable management, handling, processing and calculation. Because it was a library, it meant changing only one source tree and then compiling the output lib into whichever tool I wanted to use it in. BenderLibrary currently consists of about 650 functions and 922,000 lines of code.
Due to time constraints (I had just been told that in about 3 weeks time, the bender was being sold to a company in Malaysia) I decided to take some shortcuts in development. The major one being that instead of working with a Windows GUI, I would use some code I had already written from one of my video games to handle the core program and interface system. This saved about 2 months of initial development time, and allowed me to start working on interface and other things immediately. This is a decision I have regretted the whole time, however the issue is rectified in the newer versions of the program (See the end of the page for future revisions).
Bending Cable On Steroids!
Within a couple of weeks of working on the program, I was already starting to see some big improvements in the way that the machine (Marvin) started to work and operate. First of all, I was able to implement many safety features into the program that simply were not there before, as well as features that were simple, and easier to understand.
The big improvement that was perhaps the most obvious was accuracy. On the old program, all mathematical operations were computed using 2 decimals. To make matters worse, the old tool relied on code that had been written in the early 1980’s in Delphi to load the HP Bend File Format (BND) into the program. To make matters even worse, and probably a completely horrible screw up of being lazy on the programmers part, the program used Inches to handle it’s data format. Not a big deal, but enough that there would be some discrepancies later. Anyways, the original code worked by loading an existing file (which was MM), Converted it to Inches (so it could be loaded into the old code), and then it was converted back into Millimetres so it could be displayed on the menu screens etc. Then, when the program needed to make any actual bends, it converted the number back into inches! What the hell were they thinking! And to do this with only 2 decimal points resulted in as much as 0.6mm being lost in the rounding conversions alone! It’s no wonder that the machines bent segments incorrectly for certain cable designs!
In BenderLib, I had completely re-written the File I/O functions from the very beginning after I first saw the old program code, to counter-act this. Because BFP took critical measurements, I couldn’t rely on the old data. BenderLib will take the BND file, and use the Millimeter values natively; If it detects that the loaded file is actually inches, it will round up the number to be millimeters. This way, there is never any accuracy lost. Not only will BenderLib handle BND files correctly, it’ll also work with the DAT format of the old tool (a list details segment length, rotation and bend angle, a style derived from RLA), RLA, Eaton Leonard and it’s own FLX multi-cable format. It will also write out the same data into files.
BenderLibrary uses 6 decimal floating point math to handle everything, so no data is ever lost during processing. Angles are also bent using decimal points (original program could only bend angles/handle rotation on whole degree amounts), and much more! Stuff was coming out of the machine without the need to tweak anything, and segment values were right on!
Whats Next?
Work has begun on V2 of the program, as the biggest part of what I didnt like about the original program was the interface. I have started a lot of work on the new program, using wxWidgets as the interface builder. The new program is being developed on my personal time, as the company management does not want to have me invest any work time in making changes right now.
The new program also changes internally how the controller is handled, making it run even faster. I hope to have this new version ready for release in a few weeks time depending on how much time I get to work on it.
FlexIO Screenshots:
Final Notes
FlexIO Classic was a fun project to work on, and is a project that I will continue to work on for quite some time. Please use the comments section of this page to ask additional questions and comments. Thanks for reading!
Leave a Reply