Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
From within the drawing document, I am trying to retrieve the expression of the properties of the model document. I am trying with the following code (for design tracking properties). I can't get this, I believe!
oModelDoc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName) Dim invDesignProps As PropertySet invDesignProps = oModelDoc.PropertySets.Item("Design Tracking Properties") Dim invProperty_Tracking As Inventor.Property MessageBox.Show("invDesignProps.Count: " & InvDesignProps.Count, oRuleNo) Dim invCustomProps As PropertySet invCustomPros = oModelDoc.PropertySets.Item("Inventor User Defined Properties") Dim invProperty_Custom As Inventor.Property MessageBox.Show("invCustomProps.Count: " & invCustomPros.Count, oRuleNo) ' Get the design tracking property set. For Each invProperty_Tracking In InvDesignProps ' MessageBox.Show("invProperty_Tracking.Expression: " & invProperty_Tracking.Expression, oRuleNo) If invProperty_Tracking.Name = "Description" Then MessageBox.Show("invProperty_Tracking.Expression: " & invProperty_Tracking.Expression, oRuleNo) End If Next invProperty_Tracking
I request help.
The rule below works for parts (and assemblies: may not be required)
Sub Main() oRuleNo = "iL0061" oDoc = ThisApplication.ActiveDocument Dim invDesignProps As PropertySet invDesignProps = oDoc.PropertySets.Item("Design Tracking Properties") Dim invProperty_Tracking As Inventor.Property ' MessageBox.Show("invDesignProps.Count: " & InvDesignProps.Count, oRuleNo) Dim invCustomProps As PropertySet invCustomPros = oDoc.PropertySets.Item("Inventor User Defined Properties") Dim invProperty_Custom As Inventor.Property ' MessageBox.Show("invCustomProps.Count: " & invCustomPros.Count, oRuleNo) ' Get the design tracking property set. For Each invProperty_Tracking In InvDesignProps If invProperty_Tracking.Name = "Description" Then MessageBox.Show("invProperty_Tracking.Expression (Description): " & invProperty_Tracking.Expression, oRuleNo) Exit Sub Else '' MessageBox.Show("invProperty_Tracking.Expression: " & invProperty_Tracking.Expression, oRuleNo) ' For Each invProperty_Custom In invCustomPros 'i = 0 To invCustomPros.count-1 ' ' MessageBox.Show("invProperty_Tracking.Expression: " & invProperty_Tracking.Expression, oRuleNo) '' If invProperty_Tracking.Expression = invProperty_Custom.Expression Then ' If invProperty_Custom.Name = "Length_Test" Then ' MessageBox.Show("invProperty_Custom.Expression: " & invProperty_Custom.Expression, oRuleNo) ' Exit Sub ' Else '' oYN = MessageBox.Show("Continue?", oRuleNo, MessageBoxButtons.YesNo) '' If oYN = vbNo Then Exit Sub End If ' Next invProperty_Custom Next invProperty_Tracking End Sub
Solved! Go to Solution.