• Status Assigned
• Percent Complete
0%
• Assigned To
• Operating System All
• Severity Low
• Priority Very Low
• Reported Version Development
• Due in Version Undecided
• Due Date Undecided
• Private
Opened by Matthias Melcher - 03.05.2013

FS#805 - Create tool radius compensation / tool path generation

This is how I would implement this:

This would be a modification tool. Parts are selected, a toolpath is generated, and a dialog pops up to allow putting the tool path into an existing layer, a new layer, or replace all drawings in an existing layer.

This is how the toolpath is generated:

We iterate through all elements and explode everything but text into line segments. Then we connect the line segments into chains wherever the line endpoints are less than some tolerance away from each other. The chains can be very chaotic, but at least we have separate entities for now.

For every chain, we need to find the largest complete loop. A good drawing would only contain non-overlapping loops, but we can’t expect that. Everything that is not on this loop can not be defined as a part or as a hole, so we will merely create a tool path segment that is equivalent to the line segment. Every segment that *IS* on a loop is either an outside edge (part outline), or an inside edge (hole outline), (or overlapping, in which case it is neither, and we have an operator problem).

In a perfect world, we need to find exactly which shape is inside which other shape, and then create alternating tool offsets from the outmost loop (part edge) to the second outmost (hole), to the next (part) etc. .

In a simplified world, we can used the bounding box of the loop instead. This works OK for rectangular shapes, but a circle next to an “L” shape could be seen as inside the L’s bounding box, hence inside the L, wrongly accused of being a hole, not a part.

Now all that is left to do is to create a new loop, offset by the tool radius. Oh, and since we have the connections from line segment to line segment in the correct order already, we can use the opportunity to order all cutting loops from inner to outer, or from small to large, and order non-loop edges by travel distance.

The new drawing in the new layer can now be exported without further hassle to create a nice laser cut file.

PS: of course, a user could create multiple layers for marking, cutting, enraging, etc. . Additional Layer attributes for cutting speed and laser power (and a few more) would be needed.

Matthias Melcher commented on 07.05.2013 23:11

Attached is a packed directory that can be dropped into "scripts". It adds a new top in the CAD toolbar that creates toolpaths.

To test:
draw some connected lines (not a polyline!), draw a box inside a box inside a box, etc. . Then select the drawing and click "Toolpath". The script will create tool paths for selected shapes. Closed shapes will be declared as "part" or "hole", and their tool path will be offset by the tool radius (currently fixed to 1mm) to the outside (part) or to the inside (hole). Non-closed shapes will not receive a tool path offset.

The code is horrible and does not reflect my coding style. It is merely a proof-of-concept, coded by copy-and-paste in a language that I never learned. It only supports lines, no polylines, no arcs, no circles, etc. . I will clean this code up as soon as I can so I can use it for my own projects. Maybe one day it will find its way into the release.

Available keyboard shortcuts

• SHIFT+ALT+l Login Dialog / Logout
• SHIFT+ALT+m My searches