- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Alex,
I vote for splitting the workflow and using the built-in Wrap to surface function.
If the face and the points are selected they should be used by the command. ("Sketch3DProjectCmd") Your code could select them with the Document.SelectSet.Select method and run the command. The user would just have to click "Wrap to Surface" and "Ok". Below is VBA code I tested this with.
I created this ticket with Inventor Engineering:
"Need an API that does what Wrap to Surface in the UI Does"
'The part just had a cylinder and the sketch had some sketch points. The cylinder face and the sketch points are selected by code. The command is run and it uses the face and points.
Public Sub Test()
Dim odoc As PartDocument
Set odoc = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition
Set oDef = odoc.ComponentDefinition
Dim oSketch As PlanarSketch
Set oSketch = oDef.Sketches(2)
Dim oSkPnt As SketchPoint
For Each oSkPnt In oSketch.SketchPoints
Call odoc.SelectSet.Select(oSkPnt)
Next oSkPnt
Dim oFace As Face
Set oFace = oDef.SurfaceBodies(1).Faces(1)
Call odoc.SelectSet.Select(oFace)
Dim oControlDef As ControlDefinition
Call oControlDef.Execute
End Sub
Thanks,
Wayne
Wayne Brill
Developer Technical Services
Autodesk Developer Network