Message 1 of 4
Ilogic - View Label with Custom Iproperties ignoring projected view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello. Pleas I need some help, with this, i really try from many ways, but my knowledge of coding tis pretty basic
I am working with this little code that get the "Custom Iproperties" from the assemblies & parts into the drawing view labels, and it works fine, actually more than I want.
I want to run the rule only for the "Base View" because I don't wanna see all the information of the part/assemblies in the projected view again, I want to see only the custom IPropeties that I call "Item#" & "name view (ex. Side. Top etc.) in the projected views.
I run two rules now,
#1 for the View Names
#2 for the Label information (Custom Iproperties)
Rule#1
'active sheet Dim tmpSheet As Sheet = ThisDrawing.ActiveSheet.Sheet Dim tmpView As DrawingView For Each tmpView In tmpSheet.DrawingViews Dim myDrawingViewName As String = "" If tmpView.Type = ObjectTypeEnum.kDrawingViewObject Then 'Which text for which orientation Select Case tmpView.Camera.ViewOrientationType Case ViewOrientationTypeEnum.kBackViewOrientation myDrawingViewName = "Back View" Case ViewOrientationTypeEnum.kBottomViewOrientation myDrawingViewName = "Bottom View" Case ViewOrientationTypeEnum.kFrontViewOrientation myDrawingViewName = "Front View" Case ViewOrientationTypeEnum.kIsoBottomLeftViewOrientation myDrawingViewName = "Isometric View" Case ViewOrientationTypeEnum.kIsoBottomRightViewOrientation myDrawingViewName = "Isometric View" Case ViewOrientationTypeEnum.kIsoTopLeftViewOrientation myDrawingViewName = "Isometric View" Case ViewOrientationTypeEnum.kIsoTopRightViewOrientation myDrawingViewName = "Isometric View" Case ViewOrientationTypeEnum.kLeftViewOrientation myDrawingViewName = "Left View" Case ViewOrientationTypeEnum.kRightViewOrientation myDrawingViewName = "Right View" Case ViewOrientationTypeEnum.kTopViewOrientation myDrawingViewName = "Top View" Case Else myDrawingViewName = "" End Select 'Change if view orientation was found If Not myDrawingViewName = "" Then 'change drawing view name tmpView.Name = myDrawingViewName End If If tmpView.isflatpatternview =True Then tmpView.Name = "FLAT PATTERN" End If End If myDrawingViewName = "" Next
Rule #2
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_0 = oModel.PropertySets.Item("User Defined Properties").Item("Item#").PropId o_iPropID_1 = oModel.PropertySets.Item("User Defined Properties").Item("Title_").PropId o_iPropID_2 = oModel.PropertySets.Item("User Defined Properties").Item("Description_").PropId o_iPropID_3 = oModel.PropertySets.Item("User Defined Properties").Item("Finish").PropId o_iPropID_4 = oModel.PropertySets.Item("User Defined Properties").Item("Qty#").PropId Catch 'here you could add a message that one or more of the custom iProperties were not found End Try 'set prefix, if needed Dim sPrefix As String sPrefix0 = "ITEM: " sPrefix1 = "TITLE: " sPrefix2 = "DESCRIPTION: " sPrefix3 = "FINISH: " sPrefix4 = "TOTAL Req.: " Try 'format the custom iproperty string and add the property ID oString0 = sPrefix0 & "<Property Document='model' PropertySet='User Defined Properties' " _ & "Property='Item#' FormatID='{D5CDD505-2E9C-101B-9397-08002B2CF9AE}' PropertyID='" _ & o_iPropID_0 & "'>item#</Property><Br/>" 'format the custom iproperty string and add the property ID oString1 = sPrefix1 & "<Property Document='model' PropertySet='User Defined Properties' " _ & "Property='Title_' FormatID='{D5CDD505-2E9C-101B-9397-08002B2CF9AE}' PropertyID='" _ & o_iPropID_1 & "'>Title_</Property><Br/>" 'format the custom iproperty string and add the property ID oString2 = sPrefix2 & "<Property Document='model' PropertySet='User Defined Properties' " _ & "Property='Description_' FormatID='{D5CDD505-2E9C-101B-9397-08002B2CF9AE}' PropertyID='" _ & o_iPropID_2 & "'>Description_</Property><Br/>" 'format the custom iproperty string and add the property ID oString3 = sPrefix3 & "<Property Document='model' PropertySet='User Defined Properties' " _ & "Property='Finish' FormatID='{D5CDD505-2E9C-101B-9397-08002B2CF9AE}' PropertyID='" _ & o_iPropID_3 & "'>Finish</Property><Br/>" 'format the custom iproperty string and add the property ID oString4 = sPrefix4 & "<Property Document='model' PropertySet='User Defined Properties' " _ & "Property='Qty#' FormatID='{D5CDD505-2E9C-101B-9397-08002B2CF9AE}' PropertyID='" _ & o_iPropID_4 & "'>Qty#</Property><Br/>" 'add the custom iproperties to the view label oView.Label.FormattedText = "<DrawingViewName/><Br/>" & oString0 & oString1 & oString2 & oString3 & oString4 Catch 'do nothing if error End Try If Not oView.Label.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextLeft Then oView.Label.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextLeft End If Next Next
And I get this.
attached file