#1 2020-09-11 09:30:39

From: Australia, No. 5 Branch
Registered: 2020-09-11
Posts: 1

The next step is getting it out of OpenSCAD and into EAGLE

Posted on Thursday January 01, 1970

Posted on Thursday January 01, 1970

Posted on Thursday January 01, 1970

Posted on Thursday January 01, 1970

Posted on Thursday January 01, 1970

Posted on Thursday January 01, 1970

Posted on Thursday January 01, 1970

Tag Archives: openscad.

I’m a big fan of DIY capacitive touch sensors
Without any custom parts or special fabrication techniques (beyond regular PCB creation)

you can create really impressive interfaces.

I first used this on the  (Getting ready to ship

!), and ever since I’ve been looking for great places to apply the technique.
The page for the  sent me looking for the , which contains a handy schematic for a scroll wheel.
So how’s this thing supposed to work.
The wheel is composed of three separate, identical electrodes that are tessellated together to form a ring.
Each electrode is interleaved with its neighbors such that as you move away from the center of one electrode, the current electrode exposes less and less surface area while the next one exposes more and more.
This means that if you measure the capacitance values of all three electrodes in succession, you should see approximately complimentary values on two of them, and an “untouched” value on the third.
This should be sufficient information to figure out the orientation of the touch.
The schematic for this wheel design is straight-forward enough, but this is far from an easy shape to draw.
As I highlighted in a.

EAGLE really isn’t going to help you draw something like this

so you need to turn to another program to do it and then import the results.
My tool of choice is OpenSCAD, so I got to work on a.
However, I came up with another way to express this shape that is more amenable to being generated directly in OpenSCAD.
It’s a technique I found on the OpenSCAD mailing list that the creator referred to as “chain hull”.
A chain hull of a list of primitives is the union of the convex hulls of neighboring pairs of said primitives.
Did you follow that?  has a good visual example of the operation in action.
I think chain hulling is a brilliant use of the primitive functions available in OpenSCAD and allows for complex shapes to be described very concisely.
curved_triangle(r, pitch, separation, gap) {                                  (num_steps  )                                  (top_d  pitch    separation)                                  (bottom_d  triangle_tip_width)                                  (delta  top_d  bottom_d)                                  (d_incr  delta / (num_steps))                                  (b_incr/(num_steps  ))                                  ()                                   (i[:(num_steps)]) {                                    () {                                      ([, , b_incr  i])                                         ([r, , ])                                           square(size[top_d  d_incr  i, ], center);                                      ([, , b_incr  (i)])                                         ([r, , ])                                           square(size[top_d  d_incr  (i), ], center);                                      (, top_d  d_incr  (i));                                    }                                  }                                }                                                                hosted with ❤ by                        One gotcha I figured out in the course of this project is that , even if they’re just describing the outline of a polygon.
To account for this, I drew the wheel sections a tiny bit smaller to account for the line width I’d use in EAGLE.
This is not unlike accounting for the kerf on a laser cutter, so if you’ve done that before you’ll be familiar.
The next step is getting it out of OpenSCAD and into EAGLE.

I wrote about using OpenSCAD shapes as board outlines in another post

but this case is a little different.
Board outlines can just be simple wires, but polygons need to be closed shapes.

The DXFs that come out of OpenSCAD are just collections of segments

I needed a way to convert these segment lists into ordered lists of points that they could be entered with the POLYGON command.
So, of course,.
The operation for converting a set of segments into a ordered list of points is pretty easy.
The trick is to think of the list of segments as edges in a graph, and then the objective becomes traversing the graph and outputting a list of.
To do this, first I read all the segments into memory, then put them into a map indexed by their start point.
Then I pick an arbitrary segment, write its two points to a list, and then use the second point to do a map lookup for the next segment that matches it.
This process then repeats with the second point of each segment until we’re back to the start point.
This process nets a list of lists of points, each list being a closed polygon.
Once all the segments appear in a polygon, we’re done, and from there it’s easy to generate a set of EAGLE commands and write them into a .scr file.
This entry was posted in  and tagged ,  on  by.

While EAGLE is a pretty capable CAD package

it stops short of making it easy to lay out complex shapes like this one.
On the other hand, .

OpenSCAD is designed with exactly this use case in mind
() So we just have to find a way to get from OpenSCAD into EAGLE

Should be simple.
Lacking an out of the box solution, I did what any self-respecting hacker would do, and.
DXF files are text, which is helpful, though they are in an impressively goofy format.
A little searching got me to the , which explained how to read the sets of points that formed line segments.
With the points in hand, .

I had my script output a set of EAGLE WIRE commands

After switching into the “dimension” layer, .

I pasted the WIRE commands into the command bar

Voila, I’ve got my outline.
This entry was posted in  and tagged ,  on  by.
"Exactly-once" has been implemented exactly zero times.

RT @: New from the @ tech blog: "Clojure

Faster" by  @.
Search for:                                                                                Post to                                                          Privacy & Cookies: This site uses cookies.
By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here:.



Board footer

Powered by FluxBB