Page 1 of 1

Extracting spline data using API

Posted: Wed Jun 29, 2022 4:12 pm
by edcoggins
Greetings and Salutations;

I'm in the process of learning the API and have an interesting question to ask.

A 5 point spline is created with the API. See images below showing the spline and the immediate window output from the creation of the spline.
SplinefromMacro7.PNG
ImmediateWindowfromMacro7.PNG
ImmediateWindowfromMacro7.PNG (3.9 KiB) Viewed 669 times
A different routine is used to extract the spline points but only 3 points are extracted. See image below showing only 3 points returned instead of the 5 points that created the spline.
ImmediateWindowfromExtractSplinePoints.PNG
Attached are the macro files macro7.swp and ExtractSplinePoints.swp. Macro7 creates the spline and function GetSplinePts1 in ExtractSplinePoints returns the points from the selected spline.

Just FYI...I did not write the original code but only added code to print to the immediate window and to a file in c:\temp. All of the code was found in the SW API Help.

If the spline is selected in SW, there are 5 points on the spline.

Any idea why the number of points returned by the API is not equal to the number of points in the spline shown in SW??

Thanks in advance!

Re: Extracting spline data using API

Posted: Fri Jul 08, 2022 11:29 am
by edcoggins
Update: I was able to find example code in the API Help that found all of the spline points. The example code is found under the GetSketchSegments Method (ISketch).