I need to read the value of Custom iProperty CUTDETAIL, which is created by Mitter function in Frame Generator. When I try to read the property in iLogic, or VBA, error message says that such property doesn't exist. It looks like the property CUTDETAIL is not a standard Inventor iProperty. Is the any way how to read the value?
Following is the VBA code I used.
Thank you!!
Public Sub MitterRead() ' Get the active part document. Dim invPartDoc As PartDocument Set invPartDoc = ThisApplication.ActiveDocument 'Get the custom property set. Dim invCustomPropertySet As PropertySet Set invCustomPropertySet = _ invPartDoc.PropertySets.Item("Inventor User Defined Properties") ' Attempt to get "CUTDETAIL1". On Error Resume Next Dim invVolumeProperty As Property Set invVolumeProperty = invCustomPropertySet.Item("CUTDETAIL1") MsgBox (invVolumeProperty.Value) If Err.Number <> 0 Then MsgBox ("Error") Else End If End Sub
Solved! Go to Solution.
Solved by Mike.Wohletz. Go to Solution.
Never expect anything normal when working with frame generator files, while you were asking for the display name the actual name is not the same. I don't know if some consistency exists in how things are done, but if so I sure wish it was published. The code below will get what you want in iLogic.
' Get the active part document. Dim invPartDoc As PartDocument = ThisApplication.ActiveDocument 'Get the custom property set. Dim invCustomPropertySet As PropertySet = invPartDoc.PropertySets.Item("Inventor User Defined Properties") ' Attempt to get "CUTDETAIL1". Try For Each p As Inventor.Property In invCustomPropertySet If p.DisplayName = "CUTDETAIL1" Then MsgBox(p.Value) End If 'MsgBox(p.DisplayName & vbLf & p.Value & vbLf & p.Name) Next Catch ex As Exception MsgBox(ex.Message) End Try
Just to add some precision to Mike's post :
you cannot retrieve "CUTDETAILx" custom property via a call like invCustomPropertySet.Item("CUTDETAIL1"), because when you do so, the accessor looks the value in the Name property of the custom property.
Yet for a reason I ignore, you will be able to find "CUTDETAILx" name into the property DisplayName, as Mike's post suggests, while the Name property contains a GUID.