Is there a tool or script for converting a polyline to a fit-points-spline or a control-points-spline? have searched the docs, the ebook and the forums, and I haven't been able to find anything so maybe this should just be a suggested feature.
I do a lot of CNC routing, but I start with geometry from SketchUp which is of course polygonal. Most of the routing is straight lines so the polygonal nature of the 2D exported geometry is fine, but circles and curved edges pose a problem because most CAM software sucks at turning tesselated geometry into smooth machine movements. Circles are simple to reconstruct because a two-point circle is easily constructed from a polygon, but curved edges require a lot of clicking with the fit points spline tool to reconstruct. Because you already have the ability to construct a polyline from selected segments, it seems it would be easy to add two commands to then convert an existing polyline into either a fit-points-spline or a control-points-spline. I understand that this has cases where the behavior can be complicated since polylines may not be composed entirely of straight segments, but it seems that the internal functionality to convert a polyline's points into a set of usable spline points already exists, and it would save a lot of time compared to constructing a spline by clicking each point manually.
Thanks,
Brock Brandenberg
Polyline to spline
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
Re: Polyline to spline
There's no dedicated tool for that.
Here's a way to do it without clicking each point.
First, we have to set an undocumented preference in the QCAD3.ini file (we only have to do this once):
1. Misc > Development > Script Shell
2. In dialog click "Show ECMAScript Shell"
3. In the script shell, type:
RSettings.setValue("InfoStorePositions/PolylineNodes", true);
4. Press Enter
To draw a spline with fit points from polyline nodes:
1. Select the polyline
2. Misc > Information > Store Positions
3. Draw > Spline > Spline (Fit Points)
4. Misc > Information > Use Positions
5. Escape
More information about reusing drawing positions:
https://qcad.org/tutorial-reusing-drawing-positions
Here's a way to do it without clicking each point.
First, we have to set an undocumented preference in the QCAD3.ini file (we only have to do this once):
1. Misc > Development > Script Shell
2. In dialog click "Show ECMAScript Shell"
3. In the script shell, type:
RSettings.setValue("InfoStorePositions/PolylineNodes", true);
4. Press Enter
To draw a spline with fit points from polyline nodes:
1. Select the polyline
2. Misc > Information > Store Positions
3. Draw > Spline > Spline (Fit Points)
4. Misc > Information > Use Positions
5. Escape
More information about reusing drawing positions:
https://qcad.org/tutorial-reusing-drawing-positions
- Attachments
-
- Screen Shot 2019-05-27 at 10.51.11.png (49.09 KiB) Viewed 7671 times
-
- Junior Member
- Posts: 13
- Joined: Sat May 25, 2019 4:23 pm
Re: Polyline to spline
Awesome workaround Thanks Andrew.
Brock
Brock
-
- Newbie Member
- Posts: 4
- Joined: Mon Dec 12, 2016 11:59 am
Re: Polyline to spline
hi andrew,
Im trying to do the same process you described in five steps on a mac with pro versione 3.27.1.
As i give the command "use position" the program draws the FIRST point and then wait for the following, not using other point.
I can't guess what I'm missing.
thank you for your reply and this awesome program !
daniele
Im trying to do the same process you described in five steps on a mac with pro versione 3.27.1.
As i give the command "use position" the program draws the FIRST point and then wait for the following, not using other point.
I can't guess what I'm missing.
thank you for your reply and this awesome program !
daniele
Re: Polyline to spline
This preference is now available under:
Edit > Application Preferences > Info > Store Positions > Polylines
Check the option Store Nodes.
Then proceed as before to draw a spline with fit points from polyline nodes:
1. Select the polyline
2. Misc > Information > Store Positions
3. Draw > Spline > Spline (Fit Points)
4. Misc > Information > Use Positions
5. Escape
Edit > Application Preferences > Info > Store Positions > Polylines
Check the option Store Nodes.
Then proceed as before to draw a spline with fit points from polyline nodes:
1. Select the polyline
2. Misc > Information > Store Positions
3. Draw > Spline > Spline (Fit Points)
4. Misc > Information > Use Positions
5. Escape
-
- Newbie Member
- Posts: 4
- Joined: Mon Dec 12, 2016 11:59 am
Re: Polyline to spline
thank you. I did miss that !
Re: Polyline to spline
Brock,
Sorry to say but there is almost no way back from approximations by line-segments unless you really know the used algorithm and its parameters.
One can do a lot with a combination of a LAF and G64 ... But the rounding will always be arbitrary.
And, there is no certainty that nodes of a polyline with line segments are a match with the original fitpoints of a spline.
E.g. a spline with 4 fitpoints may be segmented in over 50 lines.
In the best case it will only look almost like the original spline but then with 51 fitpoints.
Still, in the absence of original data, I need to use this workaround more than I like.
Next, most CNC drivers can't handle splines, In QCAM these will be approximated by arc segments before exporting them as G-code.
See the tolerance setting for the Explode tool.
With a high fitpoints count one gets more tiny arc segments ... Even more with a minute tolerance.
Regards,
CVH
It can't be smooth when it has hard corners, right.bergdesign wrote: ↑Sat May 25, 2019 5:01 pmMost of the routing is straight lines so the polygonal nature of the 2D exported geometry is fine, but circles and curved edges pose a problem because most CAM software sucks at turning tesselated geometry into smooth machine movements.
Sorry to say but there is almost no way back from approximations by line-segments unless you really know the used algorithm and its parameters.
One can do a lot with a combination of a LAF and G64 ... But the rounding will always be arbitrary.
And, there is no certainty that nodes of a polyline with line segments are a match with the original fitpoints of a spline.
E.g. a spline with 4 fitpoints may be segmented in over 50 lines.
In the best case it will only look almost like the original spline but then with 51 fitpoints.
Still, in the absence of original data, I need to use this workaround more than I like.
Next, most CNC drivers can't handle splines, In QCAM these will be approximated by arc segments before exporting them as G-code.
See the tolerance setting for the Explode tool.
With a high fitpoints count one gets more tiny arc segments ... Even more with a minute tolerance.
Regards,
CVH