Update drawing properties from model iProperties Automatically

Update drawing properties from model iProperties Automatically

Anonymous
Not applicable
7,107 Views
17 Replies
Message 1 of 18

Update drawing properties from model iProperties Automatically

Anonymous
Not applicable

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

0 Likes
Accepted solutions (1)
7,108 Views
17 Replies
Replies (17)
Message 2 of 18

alessandro.gasso
Community Manager
Community Manager
Accepted solution

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

Anonymous
Not applicable

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.

0 Likes
Message 4 of 18

Anonymous
Not applicable

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

0 Likes
Message 5 of 18

alessandro.gasso
Community Manager
Community Manager

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.
0 Likes
Message 6 of 18

Anonymous
Not applicable

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!

0 Likes
Message 7 of 18

alessandro.gasso
Community Manager
Community Manager

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

Anonymous
Not applicable

That fixed it!  Thank you.

0 Likes
Message 9 of 18

Anonymous
Not applicable

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?

0 Likes
Message 10 of 18

Anonymous
Not applicable

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?

0 Likes
Message 11 of 18

Anonymous
Not applicable

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?

0 Likes
Message 12 of 18

johnsonshiue
Community Manager
Community Manager

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
0 Likes
Message 13 of 18

ian_solomon
Contributor
Contributor

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

0 Likes
Message 14 of 18

A.Acheson
Mentor
Mentor

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
Contributor
Contributor

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

0 Likes
Message 16 of 18

A.Acheson
Mentor
Mentor

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
0 Likes
Message 17 of 18

ian_solomon
Contributor
Contributor
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
0 Likes
Message 18 of 18

A.Acheson
Mentor
Mentor

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
0 Likes