Hi I am currently trying to pull a custom parameter out of a main view in a drawing sheet, the end goal is to rename the sheet to the value of that parameter, however whenever I run the code the parameter cannot be found. I have changed the parameter value from "Panel ID" on Line 21 to "Author" and the Author can be found, but my custom iProperty cannot. I am not sure if my code is looking to the correct property set and cannot find much on this, any help would be appreciated. (I am currently in the debugging stage to find the property and I am new to iLogic coding hence not adding the name change part yet)
(Running while searching for "Panel ID")
(Running while searching for "Author")
(IProperties on Assembly "11366-H2557")
Code will be linked below.
Solved! Go to Solution.
Solved by WCrihfield. Go to Solution.
' Get the current drawing document Dim doc As DrawingDocument = ThisDoc.Document ' Loop through all the sheets in the drawing For Each sheet As Sheet In doc.Sheets ' Get the first view on the sheet Dim view As DrawingView = Sheet.DrawingViews.Item(1) ' Check if the view exists If Not view Is Nothing Then ' Print the name of the sheet being checked Debug.Print("Checking sheet: " & Sheet.Name) ' Get the associated model Dim model As Document = view.ReferencedDocumentDescriptor.ReferencedDocument ' Check if the model exists and has the desired iProperty If Not model Is Nothing Then Try ' Get the value of the desired iProperty (replace "CustomProperty" with your actual iProperty name) Dim customPropertyValue As String = model.PropertySets.Item("Inventor Summary Information").Item("Panel ID").Value ' Output the value of the iProperty MsgBox("The value of the custom property is: " & customPropertyValue & vbCrLf & "Checked on sheet: " & Sheet.Name) Catch ex As Exception ' Handle the case where the property doesn't exist ' You can add your custom error handling here MsgBox("The desired iProperty does not exist in the model.") End Try End If End If Next
Hi @joe_love-gunn. There are always at least 4 PropertySets in every document, but some may have more than that. The fourth PropertySet is always the 'custom' one. It will always exist, but it will not have properties in it, by default, until you add some into it, one way or another. The name of that PropertySet is "Inventor User Defined Properties" (in English), and its 'InternalName" is "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}", which will work in all languages. I usually just specify PropertySets.Item(4) though, because it is always at that Index position.
The first 3 PropertySets are a fixed size, so we can not add more Properties into them, or remove any properties from them. And only some of those properties are Read/Write, while many are ReadOnly.
I have attached a PDF of an Excel sheet I created, which shows all all the 'standard' PropertySets & Properties, but also shows a coupe of the others (not all possible others though).
Wesley Crihfield
(Not an Autodesk Employee)