What's new

R&D: 2D Sketch Polygon to Spline Tool

stepalibre

Alibre Super User
This script converts 2D sketch geometry into a closed, single spline. I have several variations of this tool that provide more geometry information and other ideas. This script started as a polygon to spline converter, it now covers all geometry types without any options or settings to change.

If you are lofting profiles made from multiple lines, this script will convert them into a single spline at the subdivision level you set.

Please share any ideas or problems. I recommend experimenting with a test file to try it out. I will release a version that includes options to copy or consume the selected sketch, along with other settings.

The script exceeds character limits the latest will be here: https://adai.donetoolkit.com/2DSKETCHPOLYGONTOSPLINETOOL-1885708902a080fdb6dff0567b4bf9c7

1738022675663.png
1738027476183.png
1738027490445.png

Troubleshooting:
The resolution or steps determines the distance between the knots/points of the spline from the input geometry. This current version doesn't enforce any rules that would prevent overlap of the spline as it attempts to close itself.

This results in weird behavior if the steps are too small for the input geometry:

1738078182872.png

To address this, multiply the input steps by a number (I used 8 here) to increase the spline resolution. You should choose a step size appropriate for your geometry:

1738078404663.png
 

Attachments

  • 2DSKETCHPOLYGONTOSPLINETOOL.zip
    2.3 KB · Views: 1
Last edited:
  • Like
Reactions: tyc

DavidJ

Administrator
Staff member
Can you give some suggestions as to why / when this might be used? Generally ACIS seems to have a harder time dealing with splines than with arcs/lines, so I'm not clear of any benefit.
 

stepalibre

Alibre Super User
I haven't encountered any performance issues in 2D sketches. 3D sketches are where I have issues with splines. The nodes/knots of 3D splines aren't optimized internally? Reducing node/knot count along the spline often makes them easier to handle. In both sketch environments a single spline performs better than multiple splines. It is also possible to reparametrize the curve after it has been created, reducing the knot count and spacing them equally along the length. This is essentially rebuilding the spline.

A few possible uses:
Making composite curves
Improve/fix loft cross-sections
Reducing many lines into a reduced single spline.
Merging multiple sketches with splines into a single spline in a single sketch.
Exporting to other formats, where a single spline might perform better
Cleaning up projected geometry from imported models

This is an R&D tool that may not be a daily tool for most users. If you need it or something similar it provides a solution or a starting point for your personal needs.
 
Top