Categories

## Rectangle Chaos

I started playing around with the #plottertwitter thing and wanted to do some creative coding with Processing, and at least one person asked about the code, so I’ve included it below.

Instead of drawing a rectangle, I’m creating a shape, and then varying the position of it a bit more with each row that is drawn. I reused some code I’ve used plenty of times before that keeps track of where things are drawn so the code knows when to start a new row, and when the screen is filled. After it draws a screen full it will save a PDF and exit.

Once you have a PDF (which is a vector file) you can make your plotter (or laser cutter, or CNC machine) do what you want with it. I typically bring the PDF into Inkscape and make any adjustments needed before I save it out in a format suitable for the machine I’ll be sending it to.

```/*
* RectangleChaos.pde
*
* Pete Prodoehl <pete@rasterweb.net>
*
* <http://rasterweb.net/raster/>
*
*/

import processing.pdf.*;
import java.util.Date;

int sw = 1280; // if you change the resolution here change
int sh = 720;  // it below in the setup size as well...
Date d = new Date();
long current = d.getTime()/1000;

void setup() {
size(1280, 720);
stroke(0);
strokeWeight(1);
background(255);
beginRecord(PDF, "output-" + current + ".pdf");
}

float xpos = 50;  // you can adjust these numbers to get
float ypos = 50;  // different results, so play around
float wall = 150; // and experiment a bit...
float step = 40;  //
float rsize = 40;
float mimn  = xpos;
float rowct = 0;
float multiple = 0;

void draw() {

noFill();

float x1 = xpos;
float y1 = ypos;

// change number below for different results... try 1.33 or 2.33
multiple = rowct * 2.33;

// first row is normal, after that we offset things a bit
if (rowct > 0) {
x1 = xpos + random(0,multiple);
y1 = ypos + random(0,multiple);
}
else {
x1 = xpos;
y1 = ypos;
}

float x2 = x1 + rsize;
float y2 = y1;

float x3 = x1 + rsize;
float y3 = y1 + rsize;

float x4 = x1;
float y4 = y1 + rsize;

float x5 = x1;
float y5 = y1;

beginShape();
vertex(x1,y1);
vertex(x2,y2);
vertex(x3,y3);
vertex(x4,y4);
vertex(x5,y5);
endShape();

// end of a row
if (xpos > (sw-wall)) {
xpos = mimn;
ypos = ypos + step;
rowct++;
}
else {
xpos = xpos + step;
}

// last row, then we save the PDF and end
if (ypos > (sh-wall)) {
ypos = step;
endRecord();
exit();
}

}
```

If you make something cool with this code, let me know! I’d love to see what you come up with.

Categories

## 3D Printing a Sifter

I needed a sifter to remove some small pebbles from concrete mix, so I designed and 3D printed one. Now, like many things that get 3D printed, you don’t always get it right the first time. After testing the sifter I decided it needed larger holes, so. I started on version 2.

For version 1 I used Inkscape to quickly create a grid of circles (using the clone feature) and then differenced them from a circle. Once I had this done I exported as a DXF file and used that within OpenSCAD to create the bottom of the sifter. I added a ring and Bob’s your uncle. I use this Inkscape/DXF/OpenSCAD/extrude method sometimes, because it seems like the right way to do things, or because it’s pretty fast. But it’s not always the best.

The problem with the Inkscape/DXF/OpenSCAD/extrude method is that you have to go back to Inkscape and redo your DXF file if you want to make changes or tweak the design. This may not be an issue for many designs, but for some, I want the flexibility to easily change things.

So for the next version I redid the holes portion of the design in OpenSCAD. The great advantage here is that you can very easily tweak things like the size of the holes, and the hole spacing, and automagically see how it looks. (Note: in the image above you’re seeing the positive “solids” of the holes. In the final file I differenced them from another solid object to make them “holes” in the design.)

While the method of doing it all within OpenSCAD has advantages, the one way it suffers is when it comes to render time. I should note that in OpenSCAD you can choose how “smooth” circles are by applying a number between 1 and 200. It basically sets how many “sides” a circle has. You can typically use 100 and circles will look pretty circular, but you can also drop the number down to 6 for hexagons, 8 for octagons, etc. That said, at a setting of 100 rendering the sifter took nearly 15 minutes on my 6 year old MacBook Pro. Changing the circles to hexagons with just 6 sides took about one minute to render.

This is where The Cloud™ should save us, right? But while there are various versions of OpenSCAD running on public servers, no one is running a version that worked properly. And since OpenSCAD is a niche piece of open source software, I don’t know if this will change. But since there is a command line interface to OpenSCAD, maybe I can do complex renders on one of my more powerful computers. (Anyway, I’m getting off-topic, so let’s continue.)

Hey, it’s a sifter! Yes, I designed and 3D printed a sifter. I often design things and then print them overnight so I have them the next day. 3D printing is awesome, but it’s often not fast. I did consider trying to make a sifter plate with a drill press, and then I remembered I had a laser cutter, and considered using that, but ultimately I was not in a hurry and 3D printing one seemed like a good idea.

Speaking of good ideas, I’ve been looking at Tinkercad recently, and while I wanted to be convinced it wouldn’t be easy to do what I wanted, it actually was pretty easy to do what I wanted, so I redesigned my sifter using Tinkercad. The smart duplication feature made it fairly simple.

While I’m a bit more impressed with Tinkercad than I thought I would be, I still have the problem I had with Inkscape, that if I want to tweak some values, I need to redo work. In fact, I have to pretty much create a whole new model. For simple designs, this isn’t a huge deal, but it is a bit of a pain.

What’s a bigger pain is the fact that while I will always have copies of Inkscape and OpenSCAD to use, Tinkercad (and the files I create with it) may disappear. Tinkercad is own/run by Autodesk, and while it’s a great tool for beginners to get started with 3D modeling (without having to install any software) ultimately I’m concerned for its long-term existence (like any hosted/cloud service.)

I can easily edit the OpenSCAD files I created seven years ago, which is something that is important to me. That said, I do want to explore other software, because reasons, you know?

Categories

## More Mold Making

My last mold making experiment was a good experiment, and if I learned one thing, it’s that the mold should be flexible to allow for the removal of the piece you are casting without destroying the mold or the casting. (Duh!) Instead of ABS I decided to print a mold using flexible filament. Now, to print flexible filament I had to do a small modification to my extruder lever to allow the insertion of a piece of PTFE tubing so that the filament wouldn’t bend over before it fed into the feed gear. Once I did that, I was printing flexible filament (very slowly.)

I decided to start with something less complex, and used a 2.5D object instead of a 3D object. I had an illustration of a hammer, which seemed to be a simple shape, with no weird inside parts or sharp corners. I started by opening the vector file in Inkscape.

Once I had the file open I used Inkscape’s dynamic offset feature to extend the shape into a larger piece so I’d have “walls” for my mold.

I did a Boolean difference between the original and the scaled part to get the wall piece, with the wall pieces being approximately 4mm wide.

I also created a bottom plate that the wall piece would attach to. I did not make it fit with pins or any other alignment method, I just ended up using tape to hold the pieces together.

Here are the modeled pieces. The wall piece was easy enough to flex around, but seemed strong enough to hold up for the casting.

And here are the printed pieces. The flexible filament did not print as well as PLA does, and there were some rough parts on the top of the walls, but it wasn’t going to matter for these purposes.

I put the two pieces together and applied some masking tape to hold them. Since I was going to use plaster I knew that it didn’t have to be too water-tight to hold the plaster in place.

I then filled the vessel with the plaster. (Yeah, I have a big bag of plaster on hand for weird reasons, so I occasionally use it, though eventually I want to use concrete for these experiments.)

After letting the plaster dry for a few days I removed the tape and then pulled off the bottom…

…and then was able to flex the wall piece enough to get the plaster out of the mold, so that worked pretty well. Again, this was not a complex shape, which really helped as I just had to push the piece straight down through the mold.

And here’s my (tiny) plaster hammer. I like how it turned out. The edges are not perfect, but then, what is, Right?

I ended up making two of them, and with one I found that it was fairly easy to shape the edges using tools, so my 2.5D hammer (sort of) became a 3D hammer.

Categories

## Simple Wire Bender

We’ve got a project at Brinn Labs where we need to bend some 16 gauge wire. The wire bends very easily, in fact, too easily, and you can bend it by hand, but you can’t really get nice curves. I looked up “wire benders” and found “fret benders” which people use to curve the frets for guitar building.

So I found this video titled DIY FRET BENDER – \$5 USD FRET BENDER and I was in such a hurry I didn’t even realize the guy provided a bunch of design files! I guess I just often assume people don’t supply files, so I took a screen shot of the design and then dropped it into Inkscape and…

I just whipped up my own design quickly. Since I didn’t want to screw around with using the CNC machine for this, I just exported the DXF and extruded it in OpenSCAD so I could create an STL file suitable for 3D printing. Since there’s a slot and not just holes, it’s not the most fun thing to make with a drill press. Typically slots require a bit more work than holes, with filing and other time consuming hand tool work that is often best left to machines…

I designed three parts, and then printed the body and three spacers and six guides. You’ll notice a small lip on the guide piece. That’s to just touch the inside of the bearing so they can roll smoothly. The bearings? Yeah, tear apart that fidget spinner! We’ll need three bearings.

We’ll also need three 5/16″ bolts and nuts, though you could certainly use 8mm if you’ve got those handy. Hey, look, we’ve now got a wire bender!

There’s a little room for improvement on this version… The slot could be a little narrower, and I’ve found that without pliers it’s a bit difficult to tighten the nut. I fixed that by 3D printing some nut knobs so it can easily be tightened by hand. (I already had my own nut knob design file, but you can find plenty on Thingiverse and Youmagine.) No photo because I added it later. :/

This was a really simple build, and since fret benders often cost \$50 to \$100 (though I saw one for \$25 on eBay) this was pretty dirt cheap. I don’t know if it’s up to the task of bending frets, but it should work fine for the wires we need to bend.

If I get around to it I’ll clean up the files and release them. You never know when you might need to bend some wire!

Categories

## DXF for LaserCut 5.3

I’ve been using LaserCut 5.3 to control a G.Weike LC1390N Laser Cutter, and since I use Inkscape to create my files, I thought I’d go over a few of the settings I use so that in the future when I forget I can read this post.

I won’t go too deep into using Inkscape for laser cutting, as it’s a topic I’ve covered before, and besides having to use DXF files instead of PDF files, nothing else has really changed.

In the image above you’ll see a file being exported from Inkscape as a DXF file for a “Desktop Cutting Plotter” which, I guess, is one way to describe a laser cutter. :) I’ve avoided selecting the ROBOMASTER option, as that does strange things to DXF files. I’ve also avoided the LWPOLYLINE option. While the LWPOLYLINE option sometimes works, it sometimes causes issues. Don’t select either option when outputting from Inkscape to import into LaserCut 5.3.

I create my files using millimeters for units, and then export the DXF with pixels (px) specified. I believe there is still a bug in Inkscape that will screw things up if you choose millimeters for the export. (We’ll double check the imported size later to make sure it worked properly.) One more nice thing about Inkscape is that it’s easy to switch between millimeters and inches (or other units) on the fly while drawing.

When importing the DXF file into LaserCut 5.3 it may show some weird dialog. Ignore it. Files seem to import fine even when this shows up. Also, occasionally LaserCut 5.3 will not import a file, or will get an error. If that happens, just quit and relaunch it. That usually fixes it.

Our file has imported and looks okay. You’ll notice that the lines in the file are all black, well, actually they are all red here, as they are highlighted because they are selected. (Anyway, I forgot to set colors for some objects, but we’ll touch on that later.)

After importing your file you can check the size of it using the “Size” button in the toolbar to bring up the size dialog when your object is selected. It will show the length and height (well, it calls them both “length”) and some boxes where you can type in new values.

Pro-tip: If you fill in one value to scale your object, you can scale it proportionately by clicking the ‘…’ button on the other value. Here I’ve typed “100” in the x value box and then clicked the ‘…’ button on the y value box.

The other trick I’ve learned from the folks at Brown Dog Gadgets is to use the “Unite Lines” feature.

I just use the default settings it presents…

This combines the individual line segments that the DXF file is made up of into continuous lines, like a real vector file. It helps the laser cut things in a way that makes sense instead of jumping all around the object.

Here’s what I forgot to do in the above example. I’ve set specific items to specific colors in Inkscape, so that when I bring the DXF file into LaserCut 5.3 I can use the colors to change the order of cutting operations.

Here’s our DXF file imported into LaserCut 5.3 with the colors of the lines showing. Up in the right corner you can see where LaserCut 5.3 recognizes all of the colors in the file and allows you to choose individual settings as well as the order. Typically you want to cut inside pieces first and then outside pieces.

Finally, I’ve relied heavily on the work of others, and here are some links that might prove helpful when using LaserCut 5.3 and a G.Weike laser cutter. (And yes, some of it may conflict with what I’ve posted here. Again, if I got anything wrong, please let me know.)