Possible to use an iLogic script to set "Update Copied Properties" checkboxes in a drawing's document settings?

Possible to use an iLogic script to set "Update Copied Properties" checkboxes in a drawing's document settings?

claudio.ibarra
Advocate Advocate
246 Views
1 Reply
Message 1 of 2

Possible to use an iLogic script to set "Update Copied Properties" checkboxes in a drawing's document settings?

claudio.ibarra
Advocate
Advocate

In Inventor 2023, I'd like to, if possible, establish which properties get copied from a model by script. Older drawings have all of them off, some drawings have all of them on, and the organization wants specific properties copied and not copied when the "update copied properties" button is invoked.

 

Is it possible to have a script that lists ALL of the properties in a "turn on" section and "turn off" section, and then I can just comment out the lines as needed for each section?

 

My thinking is to add it to the "after open" event trigger for drawings.

 

claudioibarra_0-1730998085672.png

 

 

0 Likes
247 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

Hi @claudio.ibarra.  The short answer is no.  We do not yet have full access to all of those settings by code yet.

We do have access to these setting though:

DrawingSettings.CustomPropertySourceFile 

ThisDrawing.ResourceFileName 

ThisDrawing.KeepExtraResources  

 

Edit:  If we set those setting the way we want them in our drawing template, then every new drawing we create using that template will use those settings to automatically copy those properties from the model into the drawing when we place the first view of a model into that new drawing.  If you currently have a drawing open, and you already have model view in it, then you open those settings, you will be able to see any custom iProperties in that model.  However, you will not be able to see all other current or future custom properties from all other model files that are not in that drawing at that time...so you may have to update those settings from time to time.

 

We can create our own custom iLogic rules that will copy specific properties from 'the model' to the drawing.  But if we use our own rules, then it is up to us to manage how/when they get ran.  But rules like this would only be useful after the first view of a model has been placed into the drawing, not when the drawing is first created.  There is no event listed in the iLogic Event Triggers dialog for when we place the first view into a new drawing either, so that would need to be 'handled' by a custom Inventor API event handler, such as what are used within an Inventor add-in.

 

There is a command button in the ribbon for updating the properties that were copied over into the drawing by those built-in settings, and we can simulate clicking that command button by code, but it is not ideal yet.  There is no Inventor API method for that task, that I know of, yet.

Below is some code that can simulate clicking that button, and clicking the yes button in the dialog.

ThisApplication.CommandManager.ControlDefinitions.Item("UpdateCopiedModeliPropertiesCmd").Execute2(False)
AppActivate(ThisApplication.Caption)
System.Windows.Forms.SendKeys.SendWait("y")
ThisApplication.UserInterfaceManager.DoEvents

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)