- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @supriya_chaugule. I do not think there is any API code for that specific task. There are API objects for FreeFormFeatures, FreeFormFeature, & FreeFormFeatureProxy, but no Add or Copy type method for creating new ones, or converting someting else to a FreeFormFeature. So, the best I could come up with is some simple code that basically attempts to simulate the manual process, which is: Pre-select all the faces of the body, then execute that convert command, then just simulate clicking the OK button, without specifying any options. This worked OK for me in a simple block type part example.
Dim oPDoc As PartDocument = ThisDoc.Document
Dim oBody As SurfaceBody = oPDoc.ComponentDefinition.SurfaceBodies.Item(1)
Dim oFaces As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
For Each oFace In oBody.Faces
oFaces.Add(oFace)
Next
Dim oCDs As ControlDefinitions = ThisApplication.CommandManager.ControlDefinitions
Dim oCD1 As ControlDefinition = oCDs.Item("TSplineConvertToTSplineCmd")
Dim oCD2 As ControlDefinition = oCDs.Item("AppContextual_OKCmd")
oPDoc.SelectSet.SelectMultiple(oFaces)
oCD1.Execute
oCD2.Execute
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS)
.
Wesley Crihfield
(Not an Autodesk Employee)