Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
in reply to: WCrihfield

Hi WCrihfield,

 

First, thanks for your reply.  I was beginning to wonder if there would be any replies.

 

Second, I was hoping that the Autodesk object library contained a method or function that was the equivalent of clicking on the Points option, specifying that a spline curve should be created, and then selecting the .xlsx file.  Apparently not, or at least, you didn't find it either.  While I was waiting, I continued to try to solve the puzzle, and eventually decided to try to do it the hard way, by doing pretty much exactly what you did--create an ObjectCollection object, open the Excel file, do a do/while loop (instead of for/next, as my .xlsx files contain an unknown number of coordinate sets) to read through each row of the spreadsheet, create a SketchPoint3D object from each set of coordinates, and then add that SketchPoint3D object both to the 3D Sketch (oSketch3D in your code) and to an ObjectCollection object (oPoints).

 

Once all of the SketchPoint3D objects were added to the 3D Sketch (oSketch3D) and to the ObjectCollection (oPoints), I then tried to feed that ObjectCollection (oPoints) to the .add function of the SketchSplines3D collection of the Sketch3D object (oSketch3D), as such in your code:

 

Dim oSpline As SketchSpline3D = oSketch3d.SketchSplines3D.Add(oPoints,SplineFitMethodEnum.kSmoothSplineFit)

 

Which doesn't quite work.  But we're close.  I think this is the "tiny detail" you missed:

 

The SketchSplines3D.Add function requires a collection of FitPoints (transient geometry) as the first argument.  In your code, you add SketchPoint3D objects to the oPoints collection object.

 

The only thing that has to be done to your code is to modify the last statement in your For/Next loop.  Instead of:

 

     oPoints.Add(oSkPt3d)

 

Let it be:

 

     oPoints.Add(oPoint)

 

oPoints thereby becomes a collection of FitPoint objects instead of a collection of SketchPoint3D objects and the SketchSplines3d.Add function successfully creates oSpline and adds it to the oSketch3D object.

 

Now, can anyone explain why the SketchControlPointSpline3D.Add function will take a collection of either FitPoint objects or SketchPoint3D objects, but the SketchSpline3D.Add function only accepts a collection of FitPoints.  Am I missing something?