Hi Guys & Girls,
I found this script through the forum (see below), which highlights the view scales within a drawing. I was wondering if it could be adapted, so that the rule only takes the view scales of the active sheet at the time the rule is ran?
As currently it runs the script takes all the sheets and all the views that are in the drawing document.
Any help would be greatly apprieciated. 🙂
Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 5960 StartFragment: 314 EndFragment: 5928 StartSelection: 314 EndSelection: 314 SyntaxEditor Code Snippet
'active drawing documentDimoDrawDocAsDrawingDocument=ThisDrawing.Document'get scale of all views in this drawing documentForEachoSheetAsSheetInoDrawDoc.SheetsForEachoViewAsDrawingViewInoSheet.DrawingViewsMessageBox.Show("Sheet: "&oSheet.Name&vbNewLine&vbNewLine&_"View: "&oView.Name&vbNewLine&vbNewLine&_"Scale: "&oView.Scale, "View Scale")NextNext
Solved! Go to Solution.
Solved by Vladimir.Ananyev. Go to Solution.
The following iLogic code collects scales of all views in the active sheet:
'active drawing document Dim oDrawDoc As DrawingDocument=ThisDrawing.Document
'get scale of all views in the active sheet Dim oSheet As Sheet = oDrawDoc.ActiveSheet Dim St As String = "Sheet: " & oSheet.Name & vbNewLine & vbNewLine For Each oView As DrawingView In oSheet.DrawingViews St = St & "View: " & oView.Name & " " & _ "Scale: " & oView.Scale & vbNewLine Next MessageBox.Show( St, "View Scale" )
Cheers,
🙂
Hello,
many thanks for the solution.
I have integrated the code:
Sub Main()'active drawing document Dim oDrawDoc As DrawingDocument=ThisDrawing.Document 'get scale of all views in the active sheet Dim oSheet As Sheet = oDrawDoc.ActiveSheet Dim St As String = "Foglio: " & oSheet.Name & vbNewLine & vbNewLine For Each oView As DrawingView In oSheet.DrawingViews St = St & "Vista: " & oView.Name & " " & _ "Scala: " & scale(oView.Scale) & vbNewLine Next MessageBox.Show( St, "View Scale" ) End Sub Function scale (ByVal ss as Double) If ss < 1 Then alfa = 1/ss scale = "1:" & alfa End If If ss = 1 Then scale = "1:" & alfa If ss >1 Then alfa = ss/1 scale = alfa & ":1" End If End Function
BR
Alberto
Can't find what you're looking for? Ask the community or share your knowledge.