- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I was able to get a code from another forum post and modified it to my needs to include our custom properties. I'm now having two issues I can't find the answer to. I'm attaching the code I'm using as well as the .ipt and .idw files.
1. I'm trying to make it so that the label automatically shows up correctly when a view is created. I saved the iLogic rule in the template file and also opened the "Event Triggers" and applied this rule to all of them. It seems to run the rule when I do a save, but ideally I would like it to populate when the view is created. I thought applying the rule to "Drawing View Change" would do this, but it doesn't.
2. I want to have two different view labels, one for .ipt files and one for .iam files. How can I modify this code to do that?
'start of ilogic code Dim oDoc As DrawingDocument: oDoc = ThisDoc.Document oModel = ThisDoc.ModelDocument Dim oSheets As Sheets Dim oSheet As Sheet Dim oViews As DrawingViews Dim oView As DrawingView oSheets = oDoc.Sheets For Each oSheet In oSheets oViews = oSheet.DrawingViews For Each oView In oViews oView.ShowLabel = True Try 'get the property ID for these custom iProperties from the model referenced by the view o_iPropID_1 = oModel.PropertySets.Item("User Defined Properties").Item("FCE_PartNumber").PropId o_iPropID_2 = oModel.PropertySets.Item("User Defined Properties").Item("DESCRIPTION_AP").PropId o_iPropID_3 = oModel.PropertySets.Item("User Defined Properties").Item("MATERIAL_A").PropId o_iPropID_4 = oModel.PropertySets.Item("User Defined Properties").Item("STANDARD_A").PropId Catch 'here you could add a message that one or more of the custom iProperties were not found End Try Try 'format the custom iproperty string and add the property ID oString1 = "<Property Document='model' PropertySet='User Defined Properties' " _ & "Property='FCE_PartNumber' FormatID='{D5CDD505-2E9C-101B-9397-08002B2CF9AE}' PropertyID='" _ & o_iPropID_1 & "'>FCE_PartNumber</Property><Br/>" 'format the custom iproperty string and add the property ID oString2 = "<Property Document='model' PropertySet='User Defined Properties' " _ & "Property='DESCRIPTION_AP' FormatID='{D5CDD505-2E9C-101B-9397-08002B2CF9AE}' PropertyID='" _ & o_iPropID_2 & "'>DESCRIPTION_AP</Property><Br/>" 'format the custom iproperty string and add the property ID oString3 = "<Property Document='model' PropertySet='User Defined Properties' " _ & "Property='MATERIAL_A' FormatID='{D5CDD505-2E9C-101B-9397-08002B2CF9AE}' PropertyID='" _ & o_iPropID_3 & "'>MATERIAL_A</Property><Br/>" 'format the custom iproperty string and add the property ID oString4 = "<Property Document='model' PropertySet='User Defined Properties' " _ & "Property='STANDARD_A' FormatID='{D5CDD505-2E9C-101B-9397-08002B2CF9AE}' PropertyID='" _ & o_iPropID_4 & "'>STANDARD_A</Property><Br/>" oStringScale = "<StyleOverride FontSize='0.3'>SCALE <DrawingViewScale/></StyleOverride>" 'add the custom iproperties to the view label oView.Label.FormattedText = oString1 & oString2 & oString3 & oString4 & oStringScale Catch 'do nothing if error End Try Next Next 'end of ilogic code
Solved! Go to Solution.