2 Replies Latest reply on Mar 11, 2014 5:38 AM by Sem Oudelaar

    Macro to create spline from line segments.

    Robert Geshlider

      I'm trying to use 3d scan data of human limbs within Solidworks.  The scanners output STL files, which often bog Solidworks down due to their many thousands of surfaces. 


      What I'd like to do is create a number of parallel planes, and then capture cross sections (splines) of the STL limb using the "Intersection Curve" tool, and finally loft the splines together to form a smooth, unified surface, (which will be much easier for Solidworks to handle).


      The time consuming part of this is: Once I start a sketch on a plane, and use the "Intersection Curve" tool, I end up with dozens, or hundreds, of line segments, which I must then convert to a single spline.  That's a lot of clicks.  Would it be feasible to create a macro for this?  Essentially a macro that would convert closed, irregular polygons, (which have varying numbers of segments (or end points)) into a spline.


      Many thanks.

        • Re: Macro to create spline from line segments.
          Artem Taturevych

          Hi Robert,


          Please find the tool in attachment.


          You need to select or activate the sketch you want to process and run the ‘ConvertLinesToSpline.exe’ file from the attached .zip.


          Please let me know if you have any questions.


          Regards, Artem Taturevych | Snr. Developer | IC3D ANZ


          IC3DSteel – Novice Steel Solution for SolidWorks

          translationXpert – SolidWorks files language translator

          LinkedIn - SolidWorks API Group

          • Re: Macro to create spline from line segments.
            Sem Oudelaar

            Hello Robert,


            If I understand correctly you are making multiple sketches using the intersection curve option to project the cut surface as sketch lines.

            Doing this multiple times and then making the projected intersection into a loft surface.


            If you have a sketch with the projected lines (those dozens/hundreds of line segments) you can select the ones you want to make into a spline. For the sake of argument I will assume you want to make all the segments into 1 spline.


            Open the sketch -> select all the line segments -> use the "fit spline" function

            (you can choose to consume the original line segments, which I recommend due to their large quantity.)

            This is basicly what the macro would do.


            This will transform all line segments in that sketch into 1 spline. Doing this for each sketch you can then use the surface loft to connect the splines to create the required surface.


            I hope this is of any help,

            - Sem