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: 

Update drawing properties from model iProperties Automatically

17 REPLIES 17
SOLVED
Reply
Message 1 of 18
wseaston
6117 Views, 17 Replies

Update drawing properties from model iProperties Automatically

Hi There,

 

I like to keep the properties of my drawing the same as those of my model. Currently I must remember to hit the "updat copied properties" button in the drawing to discard any old drawing properties and replace them with the properties from the model.

 

Is there any way to automate this task (perhaps on saving the drawing?) I presume an iLogic rule could be created in the drawing template, just not sure how to go about it.

 

Thanks

17 REPLIES 17
Message 2 of 18
alessandro.gasso
in reply to: wseaston

Here’s an iLogic rule that will do it.  

 

Dim oControlDef as ControlDefinition  = ThisApplication.CommandManager.ControlDefinitions.Item("UpdateCopiedModeliPropertiesCmd")
oControlDef.Execute

 

Rule.png

 

For this rule, you have to uncheck the Silent Operation option on the Options tab in the rule editor if you want to see the prompt "This command will overwrite...".  

 

Option.png

 

You could set the rule to run on the After Open Document and/or Before Save Document events (using Manage -> iLogic -> Event Triggers).

 

Trigger.png

 

I hope it helps.

 

Kind regards,

Alessandro



Alessandro Gasso
Fusion 360 – Simulation/Generative Design Adoption Specialist
Autodesk, Inc.
Message 3 of 18

This works great!  Thank you!

I've added this rule to our drawing template and have also set the rule to run silently (kept the silent operation option checked) to get rid of the nagging prompt.  This keeps the part iProperties and drawing iProperties synced.

Autodesk Product Design Suite Ultimate 2015 (Inventor 2015 Pro SP1, Vault 2015 Pro Update 1)
MacbookPro OSx 10.9, Boot Camp
Windows 7, 64-bit
Intel Core i7 2.6 GHz
16GB
SSDs
NVIDIA GeForce GT 750M with 2GB of GDDR5
Message 4 of 18

Alessandro,

 

Regarding silent operation.  I am running your iLogic rule as specified, however I don't want the pop-up window that says: "This command will overwrite specified drawing iProperty values with the model's value. Do you want to continue?", so I have silent operation checked.

 

I thought running the command with silent operation selected would prevent this pop-up; however it does not.  I've input the rule into our drawing templates and I don't want everyone to be pestered by this window.  I realize I can chose to hide that prompt by selecting "Do not show this message again ever", but....

 

I thought silent operation meant silent operation.

 

-Jeff

Autodesk Product Design Suite Ultimate 2015 (Inventor 2015 Pro SP1, Vault 2015 Pro Update 1)
MacbookPro OSx 10.9, Boot Camp
Windows 7, 64-bit
Intel Core i7 2.6 GHz
16GB
SSDs
NVIDIA GeForce GT 750M with 2GB of GDDR5
Message 5 of 18

Hi Jeff,

 

As you can see from the attached video, it works for me.

 

If you want, you can share your template with me.

 

Thanks and regards,

Alessandro



Alessandro Gasso
Fusion 360 – Simulation/Generative Design Adoption Specialist
Autodesk, Inc.
Message 6 of 18

Yeah, it looks like it works great for you.  I wonder what I'm doing differently.

 

I have the rule triggering only "Before Save Document" due to everytime I open the drawing, it would show as a change had been made.  This would make it impossible to change the state from Inventor.

 

I also have selected, "don't run automatically" when parameters change.

 

I've attached the drawing and part template.  These are in progress... and I'm definitely open to any suggestions you may have.  Thanks for the video!

Autodesk Product Design Suite Ultimate 2015 (Inventor 2015 Pro SP1, Vault 2015 Pro Update 1)
MacbookPro OSx 10.9, Boot Camp
Windows 7, 64-bit
Intel Core i7 2.6 GHz
16GB
SSDs
NVIDIA GeForce GT 750M with 2GB of GDDR5
Message 7 of 18

Thanks for reporting the problem.

 

There was a little issue in the original rule that if you run it manually, the Silent operation option is respected, but, if the rule is started by the trigger, the option is disregarded and you get the prompt.

 

This is the difference between my video and what you are doing.

 

Please, replace the original rule with the one below, provided by Mike Deck and everything should work as expected.

 

Dim oControlDef as ControlDefinition  = ThisApplication.CommandManager.ControlDefinitions.Item("UpdateCopiedModeliPropertiesCmd")

oControlDef.Execute2(True)

 

Kind regards,

Alessandro



Alessandro Gasso
Fusion 360 – Simulation/Generative Design Adoption Specialist
Autodesk, Inc.
Message 8 of 18

That fixed it!  Thank you.

Autodesk Product Design Suite Ultimate 2015 (Inventor 2015 Pro SP1, Vault 2015 Pro Update 1)
MacbookPro OSx 10.9, Boot Camp
Windows 7, 64-bit
Intel Core i7 2.6 GHz
16GB
SSDs
NVIDIA GeForce GT 750M with 2GB of GDDR5
Message 9 of 18

Does this iLogic work in 2017?  I have tried this script a couple of times and I have not gotten it to automatically populate the iproperties.  Am I missing some thing?

Message 10 of 18
ggrieriii
in reply to: jeff_jordan

I also added both versions of this rule to my drawings and ran it. Absolutely nothing happened. I copied the rules verbatim. Was there some edit I was supposed to have made? Does this rule serve the same purpose as automatically pushing the Update All Sheets button (which is what I want) or does it only update certain properties in the drawings?

Message 11 of 18

Hi. I do realize this forum was started in 2011. But I tried implementing the iLogic rule in 2020. But for some reason, I get the error stating: Type 'ControlDefinition' is not defiend. Do you know if this iLogic rule is compatible with Inventor 2020?

Message 12 of 18
johnsonshiue
in reply to: Pieter.v.B

Hi Pieter,

 

It should work. I tried the same code on 2020 and I did not get an error. I think maybe you have multiple model references. Inventor can get confused by which one to push the iProperties from. Could you share an example exhibiting the behavior here?

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 13 of 18
ian.solomon
in reply to: wseaston

I am now finding this iLogic rule does not work in Version 2022. Absolutely nothing happens

Message 14 of 18
A.Acheson
in reply to: ian.solomon

This ilogic rule below is just activating the "UpdateCopiedModeliProperties" button in the drawing ribbon.

 

Dim oControlDef as ControlDefinition  = ThisApplication.CommandManager.ControlDefinitions.Item("UpdateCopiedModeliPropertiesCmd")

oControlDef.Execute2(True)

 

It sounds like the copy model properties check boxes (what to copy from model to drawing) haven't been selected. Can you check that?

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 15 of 18
ian.solomon
in reply to: A.Acheson

All of the buttons I want to copy are checked. Basically I have to do it manually now.
I did have it set with a trigger to update before saving. It just fails to work at the moment

Message 16 of 18
A.Acheson
in reply to: ian.solomon

Are you getting any error message? Can you add a message box into the rule to ensure it is firing when you save?

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 17 of 18
ian.solomon
in reply to: A.Acheson

Not sure how to add message box, but I am getting no error message at all, either when I save, or when I run the rule manually, it simply does not copy the properties
Message 18 of 18
A.Acheson
in reply to: ian.solomon

Here is the message box added

Dim oControlDef as ControlDefinition  = ThisApplication.CommandManager.ControlDefinitions.Item("UpdateCopiedModeliPropertiesCmd")

oControlDef.Execute2(True)
MessageBox.Show("The copy iproperties rule has run")

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan

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

Post to forums  

Autodesk Design & Make Report