How to update surface with VBA

How to update surface with VBA

stevec781
Collaborator Collaborator
533 Views
2 Replies
Message 1 of 3

How to update surface with VBA

stevec781
Collaborator
Collaborator

I have an imported b spline surface and have managed to extract all the data I need to scale it.  However I cant figure out how to send the data back and get it to update.

Does anyone know how to do it.  Here's the code so far

 

Dim Order(1) As Long, NumPoles(1) As Long, NumKnots(1) As Long, IsRational As Boolean, IsPeriodic() As Boolean
Dim IsClosed() As Boolean, IsPlanar As Boolean, PlaneVector(1) As Double

Call obsurface.GetBSplineInfo(Order, NumPoles, NumKnots, IsRational, IsPeriodic, IsClosed, IsPlanar, PlaneVector)

Dim pole(71) As Double, knotUdims(12) As Double, knotVdims(5) As Double, weights() As Double
Call obsurface.GetBSplineData(pole, knotUdims, knotVdims, weights)

Dim n As Integer
For n = 0 To 71
pole(n) = pole(n) * 2 'scale surface points

Next n
'now send data back and update
Call obsurface.GetBSplineInfo(Order, NumPoles, NumKnots, IsRational, IsPeriodic, IsClosed, IsPlanar, PlaneVector)
oPartdoc.Update

 

the last part doesnt work

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

ekinsb
Alumni
Alumni

You can't directly manipulate a surface in the way you're trying.  Typically, all surfaces in a model are the result of some feature operation.  Even importing a file (STEP, IGES, etc.) is considered a feature operation.  The resulting surfaces are just the result of the feature operation and the surfaces are dependent on the feature for their definition.  The way to modifiy a surface is to create a new surface that represents the modified version of the original surface and then using the Delete Face feature, delete the original face, and then use the Stitch or Sculpt command to combine it into the solid model.

 

There's some new API functionality in Inventor 2011 that provides the ability to directly create surfaces and solids without going through the typical feature operations.  You still need to use a non-parameter base feature to import the surface or solid into Inventor but the actual definition of the geometry is not feature based.  The "What's New" information at www.autodesk.com/developinventor contains some information and a sample demonstrating this new functionality.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes
Message 3 of 3

stevec781
Collaborator
Collaborator

Thanks Brian

I'm not sure I quite understand.  I have a part with the first feature being an imported iges surface.  Then I create a new iges (in other software) that is same general shape, just different size.  What I want to do is swap the data for the original surface with the data from the new iges so that the part is now based on the new iges.

 

Will this be possible?

Thanks

Steve

0 Likes