ilogic - copy drawing iproperty to model iproperty

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello!
I currently work in a company that has uses an automatic file numbering system for ipt and iam files. The idw file names are picked from the project's Master document register. In other words, the models get a random number / name, while the idw's are predined. This means that there's NO link what so ever between the model file name and the idw file name.
Now i want to create an ilogic rule that simply copies the idw's file name to a custom iproperty in the model.
I would like to do this, so I can find out (without opening vault) which idw is linked to a specific model.
Does anyone know how to do this?
I made this rule, which only works for models with the same name, doesn't it?
SyntaxEditor Code Snippet
'copy idw drawing number to ipt custom iproperties'Exit rule If no Part or Assembly Is in the drawing yet If (ThisDrawing.ModelDocument Is Nothing) Then Return 'get the file name of the doc the drawing points to modelName = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName) 'read the values from the iProperties in the part file'then apply to the iProperties with the same name in the drawing file iProperties.Value(modelName,"Custom", "Drawing Number")=iProperties.Value("Project", "Part Number")
PS. I already created to custom iproperty in the model, to avoid any problems there.
thank you in advance!