AnsweredAssumed Answered

Set Style spline in vba

Question asked by Paul Rogers on Dec 20, 2018
Latest reply on Dec 20, 2018 by Simon Turner

Hi all,

 

I use a vba script to plot a B-spline through a line of points to create a curve in SW2014. I've now upgraded to a SW2018 and have been trying to use the Style Spline option instead, which would be far better for my application and would save me having to use a rather complex regularization algorithm . I have seen examples of vba scripts to find the Style Spline degree (3,5,7) but not a way to set the degree. I've tried the usual trick of recording a macro but the resulting script is of no help.

 

More details of code I am currently using (a 10 x 10 grid of points has already been plotted, the code below creates a spline through each row):

 

'-----Curve generation-----

    Set Part = swApp.ActiveDoc

   

    Part.ClearSelection2 True

 

           For a = 1 To xColumns

                               

                m = 1 * a

                f = (xColumns * yRows) - (xColumns - a)

                'MsgBox ("End point of this column is " & f)

                               

                       For j = m To f

                          If m < (f + 1) Then

                             boolstatus = Part.Extension.SelectByID2("Point" & m & "@3DSketch1", "EXTSKETCHPOINT", 0, 0, 0, True, 1, Nothing, 0)

                            ' MsgBox ("selected point " & m)

                             m = m + xColumns

                           End If

                                      

                        Next j

                                                    

               Part.Insert3DSplineCurve False

                'MsgBox ("created curve " & q)

              Next a

'----- End of curve generation-----

 

(The code after this creates a loft throught the splines to create a surface).

 

Any help on this would be very greatfully received,

 

Many thanks,

 

Paul

We are clearing out the assessors shelves. Please could you let me know by 10am if there’s anything you don’t want recycling.

 

Thanks,

 

Paul

Outcomes