Message 1 of 4
Modifying view label with standard iproperty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I found this code below (for which credit goes to @Curtis_Waguespack), which can batch edit multiple drawing view labels at once.
which works really well.
Only thing is can only batch edit standard iproperties instead of customs.
Can anyone explain how i can edit the code to make it work like this:
Pos: <comments>
Material: <Material> with 3.2
Thickness: <vendor>mm
Qty: <company>x
The default view<scale> can be removed.
Thanks in advance.
Adding to that, which is not necessesary but rather more handy, it would be usefull to have a userform in which you can edit the text size. But I think this makes it far more difficult.
'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("My_iProp_1").PropId
o_iPropID_2 = oModel.PropertySets.Item("User Defined Properties").Item("My_iProp_2").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='My_iProp_1' FormatID='{D5CDD505-2E9C-101B-9397-08002B2CF9AE}' PropertyID='" _
& o_iPropID_1 & "'>My_iProp_1</Property><Br/>"
'format the custom iproperty string and add the property ID
oString2 = "<Property Document='model' PropertySet='User Defined Properties' " _
& "Property='My_iProp_2' FormatID='{D5CDD505-2E9C-101B-9397-08002B2CF9AE}' PropertyID='" _
& o_iPropID_2 & "'>My_iProp_2</Property><Br/>"
'add the custom iproperties to the view label
oView.Label.FormattedText = "<DrawingViewName/><Br/>" & oString1 & oString2
Catch
'do nothing if error
End Try
Next
Next
'end of ilogic code

