- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @Daan_M. If your main concern in this last post is how to access the iProperties of other documents that are not being referenced by the active document, then you could use one of two different routes. All iProperties are stored within Document objects, and the Document object must be open before you can access its iProperties. So if you follow the normal Inventor API path to access them, instead of that iLogic shortcut snippet, you will not have to worry about anything.
Each Document type object (including PartDocument, AssemblyDocument, DrawingDocument, and others) has a direct property named PropertySets, which returns a PropertySets type object. That is a collection type that contains multiple PropertySet type objects accessed by its Item property. Then each PropertySet is also a collection type object which contains multiple Property objects, accessed through its Item property. The Property object is nicknamed as iProperty. There are at least 4 PropertySet objects found in every Document type object. The first 3 PropertySets are the standard ones in which all the Property names & ID's can not be changed, and many of their values can not be changed either, but there are also several of the most common ones that have Read/Write values. The fourth PropertySet is the 'custom' one, and it does not contain any Properties by default, until you either add some, or expose some Parameters as custom iProperties. It is also possible for there to be multiple other PropertySets for other purposes. For instance, parts generated by Content Center will often have 1 or 2 other PropertySets present which may contain Content Center related information specific to that document. And when we add rules to the 'This Document' tab of the Event Triggers dialog, that saves those settings to a special hidden PropertySet in the background also.
So, an example of accessing a specific iProperty (like "Part Number") of a specific document would be something like the following.
Dim oDoc As Document = ThisDoc.Document
Dim sPN As String = oDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value
MessageBox.Show("Part Number = " & sPN, "Part Number", MessageBoxButtons.OK, MessageBoxIcon.Information)
And to familiarize your self with what the names and Index positions of the PropertySets and Properties is, you can create a rule that iterates over each PropertySet, captures its information, then iterates through each of its Properties, captures its information, then reports about all of it at the end. That is partially how I created the attached PDF of an Excel spreadsheet about the iProperties, to make it easier to find the ones I want, and help others out too.
Wesley Crihfield
(Not an Autodesk Employee)