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: 

Using iLogic to Refresh Standard Components

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
willAM42F
233 Views, 5 Replies

Using iLogic to Refresh Standard Components

Hi there,

 

Is there a way to use iLogic to refresh standard content center components (basically, execute the same command as clicking the button below: Assembly File -> Manage tab -> Content Center panel)?

willAM42F_0-1720713149817.png

 

Thanks in advance for any help you're able to provide!

5 REPLIES 5
Message 2 of 6
WCrihfield
in reply to: willAM42F

You can try running this line of code:

ThisApplication.CommandManager.ControlDefinitions.Item("CCV2RSCButton").Execute

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 6
willAM42F
in reply to: willAM42F

That worked! Thanks very much.

 

For the future, are there resources that come with Inventor or are on the Autodesk website that I could have found that information in? I looked around but wasn't able to find anything.

Message 4 of 6
WCrihfield
in reply to: willAM42F

Hi @willAM42F.  You would not have been able to find that one anywhere in Inventor's help documentation.  However, there is an old VBA macro example (Link below) in the Inventor help system that shows us one possible way to list out all of the 'commands' (ControlDefinition names), which would result in a similar resource to what I used.  But I have a relatively advanced Excel spreadsheet representation of all of those ControlDefinitions, which shows pretty much every aspect of them, not just their names.  I obtained that primarily by creating my own further developed iLogic/vb.net version of a code like that, which writes data to Excel, instead of a text file.

https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DumpControlDefinitions_Sample 

 

There are also ways to 'listen' for the command that happens when you click on a tool button in Inventor's user interface, when clicking that button executes a command.  There is a lot of stuff in the Inventor API and in the iLogic API now, but still not everything we can do manually can be done by us users by code yet.  I generally do not like to have to rely on executing commands to make stuff happen by code, but sometimes we do not have much choice.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 6
willAM42F
in reply to: willAM42F

Hi, @WCrihfield,

 

Thanks for the detailed reply. I didn't realize how deep Inventor's coding functionality goes.

 

Are there any example code snippets for that "listening" functionality that you mentioned? That could be a useful tool for me.

Message 6 of 6
WCrihfield
in reply to: willAM42F

Hi @willAM42F.  This is a relatively vast, and somewhat advanced subject, so not sure I can do it justice in one or two typed up forum responses.  There are not really that many Autodesk provided, fully functional example codes for you to review that deal directly with handling Inventor events.  And the few that do, are usually in VBA, which is quite outdated and unsecure (but still useful).  Plus, reviewing one or two 'event handler' examples, if they are not well commented, explaining everything, may leave you with more questions than answers.

Below is one such 'API Sample' provided in Inventor's online help area, which has an example using the UserInputEvents.OnDrag event handler, but this is a relatively complicated looking one to look at, with a lot of other stuff going on, when just getting started with the subject.

https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=UserInputEventsSink_OnDrag_Sample 

 

I used to have an article on the subject of creating and using custom event handlers from within iLogic rules hosted in the knowledge.autodesk.com area back in 2020, but they took all user submitted articles down a year or so back.  I still have most of what was in that article in a PDF, so I will attach that here.  It is only a little more than would fit on one page, so not super in-depth or detailed, but may be a good starting point.  It only contains one example code, but within that one code example, two event handlers are being used.  Things could have been handled in a more robust way, but its an old example and I knew less then than I know now about these things.  I have several other examples on hand, but some of them may contain company specific stuff that I would have to generalize or simplify.  There is a limited list of events that we have access to 'handle' this way, and that PDF only shows 'most' of the main objects that have multiple events listed under each of them.  There have been a few more added since then.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report