Polyline to spline

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
Junior Member
Posts: 13
Joined: Sat May 25, 2019 4:23 pm

Polyline to spline

Post by bergdesign » Sat May 25, 2019 5:01 pm

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.

Brock Brandenberg

User avatar
Site Admin
Posts: 7970
Joined: Fri Mar 30, 2007 6:07 am

Re: Polyline to spline

Post by andrew » Mon May 27, 2019 10:55 am

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:
Screen Shot 2019-05-27 at 10.51.11.png
Screen Shot 2019-05-27 at 10.51.11.png (49.09 KiB) Viewed 1773 times

Junior Member
Posts: 13
Joined: Sat May 25, 2019 4:23 pm

Re: Polyline to spline

Post by bergdesign » Tue May 28, 2019 12:24 am

Awesome workaround :) Thanks Andrew.


Post Reply

Return to “QCAD 'How Do I' Questions”