Message 1 of 1
Setting Drawing View labels to correct view by code (New code for you to use)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
this code will change the view names to the correct view name. It will iterate through all views in a sheet and set the name & scale. There is also an option to choose scale if you dont need it.
Enjoy 🙂
Public Sub SetViewLabels() Dim oDoc As DrawingDocument Set oDoc = ThisApplication.ActiveDocument Dim oSheets As Sheets Dim oSheet As Sheet Dim oViews As DrawingViews Dim oView As DrawingView Dim iView As Integer Dim iViewText As String Dim Ret As Long Dim mBar As ProgressBar Ret = MsgBox("Would you like to add the Scale too?", vbYesNo) Set oSheets = oDoc.Sheets For Each oSheet In oSheets Set oViews = oSheet.DrawingViews For Each oView In oViews iView = oView.Camera.ViewOrientationType Select Case iView Case 10764 iViewText = "FRONT ELEVATION" Case 10763 iViewText = "ISOMETRIC VIEW" Case 10754 iViewText = "PLAN ELEVATION" Case 10757 iViewText = "BOTTOM ELEVATION" Case 10758 iViewText = "LEFT ELEVATION" Case 10755 iViewText = "RIGHT ELEVATION" Case 10756 iViewText = "BACK ELEVATION" Case 10759 iViewText = "TOP RIGHT ISO VIEW" Case 10760 iViewText = "TOP LEFT ISO VIEW" Case 10761 iViewText = "BOTTOM RIGHT ISO VIEW" Case 10762 iViewText = "BOTTOM LEFT ISO VIEW" Case Else End Select Select Case oView.ViewType Case 10503 'TREAT THE SECTION TEXT TO LINE UP CORRECTLY iViewText = "SECTION '<DrawingViewName/> - <DrawingViewName/>'" Case 10502 'TREAT THE SECTION TEXT TO LINE UP CORRECTLY iViewText = "DETAIL '<DrawingViewName/>'" Case 10499 'TREAT THE SECTION TEXT TO LINE UP CORRECTLY iViewText = "AUXILIARY VIEW - '<DrawingViewName/>'" Case Else End Select Select Case Ret Case 6 oView.Label.FormattedText = iViewText & vbCrLf & "SCALE - <DrawingViewScale/>" '& oView.ScaleString oView.ShowLabel = True oView.Label.ConstrainToBorder = True Case Else oView.Label.FormattedText = iViewText End Select Next Next End Sub
Attached a link to a video to demonstrate
Thanks
nigel
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.