Extracting spline data using API

Programming and macros
edcoggins
Posts: 13
Joined: Thu Apr 29, 2021 11:46 am
Answers: 0

Extracting spline data using API

Unread post 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 687 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!
Attachments
ExtractSplinePoints.swp
(66.5 KiB) Downloaded 71 times
Macro7.swp
(34 KiB) Downloaded 65 times
edcoggins
Posts: 13
Joined: Thu Apr 29, 2021 11:46 am
Answers: 0

Re: Extracting spline data using API

Unread post 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).
Post Reply