CommandDefinitions Property not available in C# but is available in VB.Net

CommandDefinitions Property not available in C# but is available in VB.Net

LukeDavenport
Collaborator Collaborator
611 Views
5 Replies
Message 1 of 6

CommandDefinitions Property not available in C# but is available in VB.Net

LukeDavenport
Collaborator
Collaborator

 

Bit of a strange one this. The 'Item' property of the CommandDefinitions object isn't available when I'm in a C# project (see screenshot)01-C.png

 

 

But it is available as usual when in a VB.Net project - see screenshot01-V.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I need to use this 'Item' property to access an Inventor command directly by name instead of having to loop through a couple of thousand commands to find the right one. 

 

I'm using Visual Studio 2015 and referencing the 2018 Inventor interop. Can anyone replicate this (just create two new empty projects and paste two lines in) or shed any light on why this property is missing?

Thanks,

Luke

 

 

 

 

 

 

 

0 Likes
Accepted solutions (1)
612 Views
5 Replies
Replies (5)
Message 2 of 6

bradeneuropeArthur
Mentor
Mentor

I see the same issue!!

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 3 of 6

Anonymous
Not applicable

.

0 Likes
Message 4 of 6

LukeDavenport
Collaborator
Collaborator

Good, thank you for checking. Not sure how it is possible to expose a property in one .Net language, but not in another?

 

It appears you can see the other Read Only properties available for the CommandDefinitions object, just not 'Item'.

 

And its not just an intellisense problem, you can't compile if you try to go ahead and type it in anyway.

 

Anyone from Autodesk have any ideas?

0 Likes
Message 5 of 6

nmunro
Collaborator
Collaborator
Accepted solution

C# does not use the Item property to access members of a collection. You should be able to access a specific ControlDefinition by using something like

 

InventorApplication.CommandManager.ControlDefintions["control_defintion_name"].Execute

 

Neil

 

        


https://c3mcad.com

Message 6 of 6

LukeDavenport
Collaborator
Collaborator

Neil that's it! I must have missed that in C# 101. Slowly getting rid of my VB blinkers 🙂

Thanks

0 Likes