Inventor API VBA 3D Loft with Rails

Anonymous

Inventor API VBA 3D Loft with Rails

Anonymous
Not applicable

I am writing a code that grabs points from an excel to create two closed 3d sketches defined by splines and then loft between them. I also want to be able to create rails between all the corresponding points. 

 

My first question is how to change the fit method of a spline with api VBA? Creating a 3D spline using the SketchSplines3D command defaults to minimum energy, but I'd rather use standard or autocad curve fitting.

 

My second question is about the rails. I want the program to be able to use a different number of points each time if required. I can create all my sketches for the top and bottom surfaces and can create the sketches for the rails all using loops but I cannot add the rails to the loft definition using LoftDefinition.LoftRails.Add Profile within the loop and if I put it outside the loop that creates the rail sketch lines only the last line is added to the loft feature as a rail. How can I create a different number of rails each time the program is run and have them all added to the loft feature?

 

Thanks for any help.

0 Likes
Reply
Accepted solutions (2)
843 Views
4 Replies
Replies (4)

LukeDavenport
Collaborator
Collaborator
Accepted solution
Hi acurtin,

You will need a separate 3D sketch for each rail I believe.
Luke

Anonymous
Not applicable
How can I do that if the number of sketches can vary each time the program is run?
0 Likes

Anonymous
Not applicable
After some more work I was able to use your suggestion and get the rails to work.

Any idea on the curve fit method? Standard Fit is set as the default in my application settings and is used when manually creating a spline but when I make a spline with code it defaults to minimum energy.
0 Likes

LukeDavenport
Collaborator
Collaborator
Accepted solution
I haven't looked at your description properly, but it should just be the
setting in the BSplineDefinition called FitMethod that you want. The 3
settings are below:

BSplineDef.FitMethod = SplineFitMethodEnum.kSmoothSplineFit
BSplineDef.FitMethod = SplineFitMethodEnum.kSweetSplineFit
BSplineDef.FitMethod = SplineFitMethodEnum.kACADSplineFit

Cheers
Luke
0 Likes