snake generator

Show off your FreeCAD projects here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
Karol Dembiński
Posts: 8
Joined: Thu Mar 19, 2020 7:02 pm

snake generator

Post by Karol Dembiński »

Squares are everywhere, so I made a module, that can make squares. My motivation was to burn wooden boxes on laser and I wanted to make a method able to draw two matching edges.

Image





First I made method for making lines and it work as follows:

Code: Select all

k = greek(10000,20000,'x')
k.move(-15000)
I created first point at (10mm, 20mm) = (10 000 um, 20 000 um) and created line 15 mm long. Dimensions added manually for clarity.

Image





But the main purpose is to create line in relation to previous line:

Code: Select all

k.move(5000, leftPattern)
Image





And grande finale - in relation to second previous line. Said line will either zigzag or curl AKA will go in the same direction as previous parallel line or reverse AKA line with two previous will create either z or c.

Code: Select all

k.move(5000, zPattern)
k.move(5000, cPattern)
Image





You can also turn right with a negative number and turn left.

Code: Select all

k.move(-5000, rightPattern)
Image





Now you can create complex structures:

Code: Select all

k.teeth( 30000, 2, 7000, 5000, 4000, leftPattern)
Image





Macro is available here. What do you guys think about it? If you like it I'll appreciate every star on Github.

https://github.com/karoldem/FreeCADbox
Post Reply