Wednesday, September 22, 2021

Mending broken DXFs in Fusion 360

I recently downloaded some DXFs originally designed for use with a CNC machine, with a view to converting them into something suitable for 3D printing. Blender is my go-to for quick manipulations, but in this case I wanted some more advanced tooling and so I decided to use Fusion 360. I had multiple problems, and so I decided to document them here in case this helps others in the same situation. The root cause of most of the problems is disconnected segments. It seems that some programs which output DXFs will leave a small gap between segments. As a result Fusion 360 can't find closed curves and this prevents it doing many important operations such as extruding. The DXF file I am working with is about 4MB and contains around 30 separate items, some for parts such as gears, and a few to illustrate how the parts fit together. I'm only interested in the former. I also tried cutting one part from the sketch into a new sketch for some tests.

You can recognize when there are broken segments if extrude and similar operations are not available, or if you hover over what looks like a closed curve and it does not all highlight. Generally you have to zoom in a long way before you can find the segments that are not joined. If there were only a few of these, fixing them by hand would not be too much of a burden, but when you have each gear has two or four of these per tooth, it quickly becomes time consuming.

A first thing to note is that Fusion 360 has two ways of importing DXFs. In both cases, the result is one or more sketches. The options are:

  • From the Design > Insert menu, there is an Insert DXF function. It seems to be essential to set this to "One sketch per layer" to avoid it taking a very long time. In the file I was working with there were 9 layers.
  • Use the DXF Import Add-in, from the Fusion 360 App Store. I was hopeful about this, as it includes an option to fix the sketch by joining close elements, either on import or as a separate operation. The fixing stage appears to be extremely expensive. I tried importing the large file with the fix option turned on, and after several hours it was still going. I doubt that it would complete in a reasonable time, as by that point Fusion 360 was using around 7GB of RAM, forcing my PC to continually swap and so grind to a halt. With the smaller sketch, I didn't run up against the memory limit, but the fixing stage simply didn't do anything. Note that the Add-in does not allow you to set the units (DXF files don't specify what units they are in), a curious omission.
I then looked at other scripts and add-in designed to fix cases like this. I found three:
  • ConnectTheDots is a Python script. The example video shows it working on exactly the case I wanted. It operates on the selected part of sketch, which I though might allow me to concentrate on just the parts I was interested in. Unfortunately, the script does not work with current versions of Fusion 360. It raises a Python exception. It appears to be unmaintained.
  • ConnectTheDots (another one) is a fork of the original version. It does not raise an exception, but never seems to complete.
  • FillGaps is a paid add-in. It costs $10. There is a free preview version to try it out, though the preview is not very useful as you can't examine the resulting segments. It can join nearby disconnected points by either adding a new segment or merging them. It doesn't take a huge amount of memory, though it can be quite heavy on CPU. It works on the whole of a sketch. Unfortunately, on my large test file it got slower and slower. At the start, the progress bar (which shows percentages) advanced by 1% every 10-15 seconds. From 99% to 100% took multiple minutes, and it then stayed at 100% for an hour and a half until I cancelled it. On the small sketch (cut and paste of a single gear), it finished quickly and accurately. So this looks like a good option, with the inconvenience of having to do a lot of cutting and pasting.
One other option is to load the DXF into blender, select a part from it, convert it to a mesh and then use Blender's Edit Mode operation to combine vertices by distance. This works, but leaves the result as a mesh and in some cases seemed to add some distortion. You can also only export meshes as DXF from Blender and not curves: if you try to export as a curve, then it silently does nothing. However, if you want to continue doing all your modeling in Blender it might work.

A final possibility is to treat the DXF as not being part of the model at all, and just use it to guide creating new sketches with them a guidelines. This isn't great for complex geometry such as gears, but could be combined with the Fusion 360 gear generator add-in to generate gears matching the ones in the DXF.

Thursday, September 16, 2021

Steve Peterson's Stepper Clock

Steve Peterson has a design for a desk clock driven by a stepper motor. I am mostly interested in purely mechanical designs, but as I was impressed an earlier design of his, I decided to give it a go. As usual, here's some pictures and video:




The clock consists of a stepper motor driving a gear train to turn the seconds, minutes and hour hands. One of the arbors, called the "gear 5 arbor" and located at the top right, has two gears held together by friction. There is a spring clutch just behind the larger gear. This allows you to turn the knob at the back to adjust the time. The clock is driven by an Arduino Nano and a NEMA 17 motor. Normally a Nano would not have enough power to drive a NEMA 17, but in this case an uncommon type with a higher coil resistance and lower current requirements is used. There is an intermediate board designed and sold by Steve Peterson which simply connects five ports of the Nano to each coil of the motor. Each port is connected through a resistor, with values which are approximately in powers of two. The control program can then advance motor with 1/32 microstepping. The circuit has a passing resemblance to a resistor ladder DAC, though it is not quite the same. It's quiet and works well, with low power requirements and minimal circuitry.

A few places in the mechanical part of the clock rely on parts being a tight fit on their arbors. I'm not keen on this approach. With 3D printing, you have to undersize the hole and then hope to drill it out to a suitable diameter, then force the part into the right position. I found all of the parts were already too large for the arbors. The holes have a diameter of about 1.65mm and fit onto 1.5mm shafts. With some printers and filament, the hole might close up enough to make this work. For me it did not. I decided in the end to print the parts with a small transverse hole and hold them in place with M1.5x5 screws. One piece where I did this is the gear 5 insert that holds the spring for the clutch in place. It needed some care to avoid the screw interfering with the large gear at the back (gear 2, in the design). I also found that you have to be careful in attaching the knob on the back of arbor 5, used to adjust the time. If it drags on the back of the frame at all, this is enough to stop the minute and hours hands.

The stepper runs quite smoothly, but when it is attached to the gear train, there is noticeable judder. In testing, I started with just gear 2 and saw a lot of rebound on each step. It gets less as you put the rest of the gear train together. The following video illustrates:

I used Mika 3D silk PLA throughout. The gears are so-called rose gold, which is in fact a pale pink. The frame is silk black, which is more like a dark grey. I'm not all that pleased with the appearance. Either a darker black or a bright color would have made for better contrast on the numerals. Two of the parts (the stepper gear and the smaller gear on arbor 5) warped during printing, like this:

I was surprised by this. It used to happen a lot when I had a poor quality printer and used blue tape as the print surface. I have not had it happen at all since I got the Prusa MK3. The parts were OK on reprinting them.

With the code as downloaded the clock was accurate to within 2 seconds over an hour. I am tuning it further by tweaking the parameters in the code.

And a small update

The first clock in this series, also by Steve Peterson, had been working quite well and accurately for several weeks until recently. It now occasionally stops and the pendulum swing is less than it used to be. I am intending to add a bit more weight to the weight shell, but also think I probably need to take it apart and check for anything that might have slipped out of alignment, particularly on the pendulum arbor.


Wednesday, September 15, 2021

M5Stack Clock

With all that I've written recently about 3D printed clocks, I thought I should not neglect a purely electronic one. Some while back I bought a M5Stack. It's a packaged ESP32 with a screen and (in this model) some neopixel LEDs. I wrote code to use this as a clock. It periodically resyncs to a reference time if it has a wifi connection and otherwise tracks the time internally. This variant of the M5Stack doesn't have a real time clock, but there is a library for tracking the time without one. The colored LEDs on the side very gradually change color: a color encoded as HSV is picked at random and the color change until it reaches the target value. It can run off the internal battery or from USB power. Here's a few minutes of it, at 30x speed:


Not super interesting, but practical and useful.

Tuesday, September 07, 2021

Brian Law's Clock 27

Brian Law is a British designer of clocks. Most of his designs are intended to be made out of wood, and he sells plans for them on his site, woodenclocks.co.uk. He has also adapted a few of the designs for 3D printing. There is a simple beginner's design, and three designs which are more interesting mechanically. I decided to make his Clock 27 design. This is a weight driven clock with a pendulum, and the interesting feature of it is that is uses a novel escapement, designed to minimize friction. A blog post explains how the escapement works. I like the design and found it fairly easy to get it running, with only a few issues. I do think there are a few ways in which it can be improved to make it easier to print and assemble. I'll come back to these in a moment, but first some pictures and video:




The clock running:


And in slow-mo. Make sure you have the sound on for this.


When I first assembled the clock, it would run for a few seconds (20 was the longest) before stopping. The pendulum was not swinging enough to keep the clock going. I tracked this down to the gravity arm, the piece on the left shaped like a crescent moon. The blog post says that "The finger on the end of the Gravity arm needs to be adjusted so that it causes the trigger to release the Escapement wheel just before the fork in the fork in the Lifting lever [The L shaped piece] reaches the curved tooth", and this was not happening. As a test, I stuck a small piece of plastic on the tip of the gravity arm. The clock then ran, though a bit unevenly. I reprinted the gravity arm with the tip extended by 1mm, and took the chance to check over and clean up all of the remaining parts, and after that it ran smoothly.

Brian Law has several parts that are to be printed separately and glued together. For his version, he used ABS, and there are plenty of effective solvent glues for it. I used PLA, where the only glue that works well is gel cyanoacrylate. It requires the surfaces to be smooth and quite close fitting for the glue to hold. One case where it is suggested is to assemble parts like this:


There are two gears here, the big 60 tooth one and the smaller 15 tooth one. They are printed separately because of the overhang and then joined into a single piece. A single part this shape would otherwise need support to print. I found the parts did not glue well together as there is a fairly large gap around the mating piece (which is part of the upper gear). One way of improving this would be to make it a tighter fit. A better way would be to make the mating piece and the hole it goes into hexagonal. And best of all is to extend the teeth of the upper gear down and then merge the pieces into a one that can be printing as a single entity, like this:

This is the solution I adopted. I did glue some of the pieces as recommended, for example the wall spacers on the back of the frame, but also found a few more places where it was easy to modify and then merge the parts.

The clock relies on some of the gears being tight on their shafts, and the design undersizes some of the holes so they can be carefully drilled out to fit the arbors. In most cases, you could get away with a looser fit and extra spacers as an alternative. The one place where there has to be a tight fit is the 60T gear which mates which the ratchet. It directly drives the shaft it is on and thereby the minute hand. I found it was too loose at first, and so tightened the interior hole as well as adding a couple of hole for M2 set screws. This seemed to work; even without the set screws the fit was tight enough that I had to tap the rod with a small hammer until it was in place and the screws are only there in case it loosens up over time.

Note that there is an error in the bill of materials for the clock. Instead of needing three 100mm shafts and one 69mm one, it actually needs one 100mm and three 70.5mm; similarly, you need one 31mm shaft, not three. I used several different materials: stainless for the 100mm, carbon steel (McMaster Carr High Tolerance Rod) for two of the 70.5mm rods, and brass for the remaining one. This was based purely on what I had available. Brass is my preference as I can cut it with hand tools, unlike stainless, and it doesn't corrode. The carbon steel corrodes a little, and as I live near the ocean this can become a problem over time.

A few of the parts are on flying shafts (I mean ones which are only held at one end). Law suggests adding a magnet to keep them in place. I prefer a simpler solution: make the shafts slightly longer and print a tight fitting cap for them. Take a look at the second picture above for some examples.

One other issue I encountered is that once you have attached the dial to the frame, two of the screws which hold the front of the frame to the back are inaccessible.

Before I modified the gravity arm the beat was very patchy and I worried that this might be due to uneven teeth on the gears. However, once I made the slightly longer gravity arm, it ran evenly. It has met my basic test (running for 1 hour). I have yet to tune the timing and as you can see in the pictures it is still mounted on a test frame rather than on the wall.

Where next?

This is the fourth clock I've made recently, each based on a slightly different principle: hanging pendulum, seesaw pendulum, balance wheel, gravity escapement. It's not that I especially love clocks, more that I just find it interesting to make them and then get them working, and I enjoy finding complex printing projects. There's a few more designs I will probably try out. I don't leave most of them running: if I want to tell the time, there are plenty of much more accurate electronic devices within easy reach. The only one that I do leave going all the time is the Peterson clock, in part because it runs for 7 or so days without rewinding. It has stalled a couple of time in the last few days after a few weeks of working well, so some maintenance might be needed.

A footnote

A day after posting the above, I moved the clock from the testing frame to a permanent position on the side of a bookcase, and found it didn't run for more than about 45 seconds. I think this is just that it was not balanced. It took a while, but after slowly adjusting the angle it was hanging at and also adding a washer to the gravity arm to give it a bit more momentum, it seems to be running better - at least two hours without stopping.