How to create a closed 3D bspline using the API

How to create a closed 3D bspline using the API

jean-marc_langlois
Contributor Contributor
547 Views
2 Replies
Message 1 of 3

How to create a closed 3D bspline using the API

jean-marc_langlois
Contributor
Contributor

Hi all,

 

I have some data I'm trying to write to Inventor using the API, and I have been unable so far to create a closed bspline programmatically...

 

Through the "TransientGeometry::CreateBSplineCurve" and the "Sketch3d::SketchFixedSplines3d::Add" methods, I create bsplines and get the expected result, but for closed curves, I am clueless at this point - I never was able to end up with a programmatrically created bspline instance whose "CLosed" property was true...

 

I'm assuming this can be done, as when importing the attached IGES file in Inventor, I end up with a "SketchSpline3d" instance whose "Closed"property is "True"...

 

Thanks for any help that can be provided

0 Likes
548 Views
2 Replies
Replies (2)
Message 2 of 3

jean-marc_langlois
Contributor
Contributor

Some more info on this...

 

Through sime VBA code, I can access the SketchSpline instance I programmatically created, and its "Closed" property is 'false', but accessing its BSplineInfo, the returned 'IsClosed' parameter is 'true'..? 

 

Is there an explanation for this, or is this an inconsistency ?

 

This is the code I'm running:

 

=============================================================

 

Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument

 

Dim oCompDef As PartComponentDefinition
Set oCompDef = oPartDoc.ComponentDefinition

 

Dim sketch As sketch3d
Set sketch = oCompDef.Sketches3D(1)

 

Rem get the Spline3d instance
Dim spline3d As SketchSpline3D
Set spline3d = sketch.SketchSplines3D(1)

 

Dim order As Long
Dim numPoles As Long
Dim numKnots As Long
Dim isRational As Boolean
Dim isPeriodic As Boolean
Dim isClosed As Boolean
Dim isPlanar As Boolean
Dim planeVector(1 To 3) As Double

Dim curve As BSplineCurve
Set curve = spline3d.Geometry

 

Rem get the curve's bspline info
Call curve.GetBSplineInfo(order, numPoles, numKnots, isRational, isPeriodic, isClosed, isPlanar, planeVector)

 

Rem this assertion fails !
Debug.Assert isClosed = spline3d.Closed

 

=============================================================

0 Likes
Message 3 of 3

Anonymous
Not applicable

Hi,

 

Have you ever been able to solve your problem? I seem to be stuck even a step before you. I can create a BSplineCurve but adding it to the SketchFixedSplines3d gives me an exception. Also - trying to create a closed BSplineCurve gives me a falsearugmentsexception when creating the spline. sadly the documentation is nearly non-existend for the functions.

 

any help would be appreciated, thx

0 Likes