Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
wayne.brill
in reply to: AlexFielder

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