List Of Custom Commands

List Of Custom Commands

bradeneuropeArthur
Mentor Mentor
1,693 Views
6 Replies
Message 1 of 7

List Of Custom Commands

bradeneuropeArthur
Mentor
Mentor

Hi,

With the commandmanager you can list all Inventor Commands.

How can I have listed my own custom commands from my Custom Add-in here!

And how can I run these too with the commandmanager?

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Accepted solutions (1)
1,694 Views
6 Replies
Replies (6)
Message 2 of 7

Ralf_Krieg
Advisor
Advisor

Hello

 

Your own commands are also listed in the control definitions collection. You can try to filter with InternalName property. Let's say your custom commands all starts with your company name. Or you use the ClientID (the CLSID of your AddIn) to filter.

 

 

Dim oC As ControlDefinition
For Each oC In ThisApplication.CommandManager.ControlDefinitions
	If oC.InternalName.StartsWith("myCompanyName") Then
		Logger.Debug (oC.InternalName)
		'or uncomment to start the command
		'oC.Execute 
	End If
Next

 

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 3 of 7

WCrihfield
Mentor
Mentor

I sometimes filter to get my list of Macros, which is made easier by two different ways.  1) I can check ControlDefinition.DefinitionType property (uses the ControlDefinitionTypeEnum), and 2) because all the macros get listed in the command names starting with "macro:".

I have noticed that often other Add-in type commands have been listed with a similar starting text, I'm assuming it was for the purpose of making them easier to filter, recognize, and for consistency.

Here are some examples of some series of commands listed on my machine.  There are other series name starters too, these are just the ones incorporating the colon (:) separator to group their commands.

ACRD: (piping and electrical related stuff)

Archon: (a lot of stuff related to cameras, lights, animations, render, images, studios, etc.

CADC: (cable, wires, splices, loom, nailboard, piping, route, etc)

HSL: (more cable & piping stuff)

TP: (tube & pipe stuff)

So, if you're doing a lot of development, it might be a good idea to incorporate a somewhat similar naming scheme to make this process easier down the road.

 

Also, to slightly reduce processing time, I first filter for ControlDefinition.BuiltIn property = False, to eliminate a large percentage of String comparison checks.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 4 of 7

bradeneuropeArthur
Mentor
Mentor

@Ralf_Krieg wrote:

Hello

 

Your own commands are also listed in the control definitions collection. You can try to filter with InternalName property. Let's say your custom commands all starts with your company name. Or you use the ClientID (the CLSID of your AddIn) to filter.

 

 

Dim oC As ControlDefinition
For Each oC In ThisApplication.CommandManager.ControlDefinitions
	If oC.InternalName.StartsWith("myCompanyName") Then
		Logger.Debug (oC.InternalName)
		'or uncomment to start the command
		'oC.Execute 
	End If
Next

 

 


My Commands are not listed, Why is that?

@Ralf_Krieg 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 7

bradeneuropeArthur
Mentor
Mentor
Accepted solution

They are listed indeed.

I have searched wrong!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 6 of 7

Curtis_Waguespack
Consultant
Consultant

Hi @bradeneuropeArthur 

 

Similar to the above, I use this to get the commands into a notepad file, that I can then search for the command I'm looking for.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Dim oFolder As String = "C:\temp\"
Dim sPath As String = oFolder & "Inventor Command List.txt"

Dim oCommandMgr As CommandManager = ThisApplication.CommandManager
Dim oControlDefs As ControlDefinitions = oCommandMgr.ControlDefinitions
Dim oControlDef As ControlDefinition

'create folder
If Not System.IO.Directory.Exists(oFolder) Then 
    System.IO.Directory.CreateDirectory(oFolder)
End If

'create file
If System.IO.File.Exists(sPath) = False Then
	objWriter1 = System.IO.File.CreateText(sPath)
	objWriter1.Close()
End If

'edit file
Dim objWriter As New System.IO.StreamWriter(sPath)
objWriter.WriteLine("Inventor Command List")
objWriter.WriteLine("")
objWriter.WriteLine("Use Example:")
objWriter.WriteLine("1) Find the command in the list such as:")
objWriter.WriteLine("             AppViewCubeHomeCmd ")
objWriter.WriteLine("2) Then add it to the command manager line such as this, and use this line in your code:")
objWriter.WriteLine("            ThisApplication.CommandManager.ControlDefinitions.Item(" & Chr(34) & "AppViewCubeHomeCmd" & Chr(34) & ").Execute")
objWriter.WriteLine("____________________________________________________________________________________")
objWriter.WriteLine("")

For Each oControlDef In oControlDefs
	If oControlDef.DescriptionText =  "" Then
	objWriter.WriteLine(oControlDef.InternalName)
	Else
	objWriter.WriteLine(oControlDef.InternalName & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & _
	"  " & Chr(34) & oControlDef.DescriptionText & Chr(34))
	End If
Next
objWriter.Close()
Process.Start(sPath)


 

EESignature

Message 7 of 7

WCrihfield
Mentor
Mentor

Hi @bradeneuropeArthur , @Curtis_Waguespack , @Ralf_Krieg

 

I just created a new contribution post (includes both iLogic & VBA codes) which writes all available command (ControlDefinition) data out to a new Excel spreadsheet, as another resource/reference tool, and an alternative to the usual simple text file.  I figured it is somewhat related to what was discussed here, so I thought I would post a link to it here.  It doesn't really attempt to answer anyone's questions, it's just another way of outputting all command data (not just name/description) in another highly user friendly and searchable way.  It basically loops through all ControlDefinitions, records all their available property values to a 2-dimensional Array, then when done, it writes the Array data to a new Excel file.  The resulting Excel sheet has column headers, first row (with column headers) is frozen, and all column widths are auto-fit.  It creates 3251 rows of data (including headers row) on my machine, so it takes several seconds to create, but the outcome seems way better (for some purposes) than the usual simple text file to me.  Check it out.


If this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)