Invoke Edit Feature command

Invoke Edit Feature command

Anonymous
Not applicable
539 Views
2 Replies
Message 1 of 3

Invoke Edit Feature command

Anonymous
Not applicable

I want to launch the Edit Feature interface for editting by the user.  I was hoping for a PartFeature.Edit method, but no such luck. 

Is there a workaround or something I am missing?  I am will need this for Holes, fillets and extrudes.

 

Thanks

 

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

sanjay.ramaswamy
Alumni
Alumni

Here's the code to put an extrude feature in edit mode...

 

Sub EditFeature()
    
    Dim oDoc As PartDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oDef As PartComponentDefinition
    Set oDef = oDoc.ComponentDefinition
        
    Dim oFeature As ExtrudeFeature
    Set oFeature = oDef.Features.ExtrudeFeatures.Item(1)
   
    Call oDoc.SelectSet.Select(oFeature)
    
    Dim oCtrlDef As ControlDefinition
    Set oCtrlDef = ThisApplication.CommandManager.ControlDefinitions.Item("EditExtrudeCtxCmd")
    
    oCtrlDef.Execute

End Sub

 

The names (such as "EditExtrudeCtxCmd")  for the various edit feature commands can be found by executing this macro and searching the resulting text file...

 

Sub PrintCommandNames()

    Dim oControlDefs As ControlDefinitions
    Set oControlDefs = ThisApplication.CommandManager.ControlDefinitions

    Dim oControlDef As ControlDefinition
    
    Open "C:\temp\CommandNames.txt" For Output As #1

    Print #1, Tab(10); "Command Name"; Tab(75); "Description"; vbNewLine
    
    For Each oControlDef In oControlDefs

        Print #1, oControlDef.InternalName; Tab(55); oControlDef.DescriptionText
        
    Next
    Close #1
End Sub

 

Message 3 of 3

Anonymous
Not applicable

Perfect. 

Thank you Sanjay.

 

Jeff

0 Likes