Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Override DisabledCommandTypes

2 REPLIES 2
Reply
Message 1 of 3
LarsBJepsen
464 Views, 2 Replies

Override DisabledCommandTypes

Hi,

 

I have this code which disables all Commands that can affect the geometry of the model, including running macros. I would like to be able to run macros while all other commands are disabled, so the question is if there is any way to override the disabledcommandtypes to enable running of macros while all other commands in "kEditMaskCmdType" are disabled?

 

/Lars 

 

Sub Noneditble()

Dim oDoc As Document
Set oDoc = ThisApplication.activedocument

oDoc.DisabledCommandTypes = kEditMaskCmdType

End Sub
2 REPLIES 2
Message 2 of 3
LarsBJepsen
in reply to: LarsBJepsen

I have the code below, that should do some of what I Want, but it's not working - i get an error at line13 (oDoc.DisabledCommandList.Remove (oPrintCmd)). oDoc.DisabledCommandTypes = 4 ,disables file operations like save and print, and then i try to enable the print command again.

 

Sub ReadOnly()

Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument

oDoc.DisabledCommandTypes = 4

Dim oPrintCmd As ControlDefinition
Set oPrintCmd = ThisApplication.CommandManager.ControlDefinitions.Item("AppFilePrintCmd")

oDoc.DisabledCommandList.Remove (oPrintCmd)

End Sub

 

Message 3 of 3
LarsBJepsen
in reply to: LarsBJepsen

One step closer, but still not enabling the print command. 

Sub test()

Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument

oDoc.DisabledCommandTypes = 4

Dim controlDef As ControlDefinition

    For Each controlDef In ThisApplication.CommandManager.ControlDefinitions

        If (controlDef.InternalName = "AppFilePrintCmd") Then

            If controlDef.Enabled = False Then
                controlDef.Enabled = True
            End If
                   
            Exit For

       End If

 Next

End Sub

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report