Ilogic Drawing view scales

Ilogic Drawing view scales

Anonymous
Not applicable
1,257 Views
4 Replies
Message 1 of 5

Ilogic Drawing view scales

Anonymous
Not applicable

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

 

0 Likes
Accepted solutions (2)
1,258 Views
4 Replies
Replies (4)
Message 2 of 5

Vladimir.Ananyev
Alumni
Alumni
Accepted 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,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 3 of 5

Anonymous
Not applicable
Accepted solution

Thank you Vladimir,

 

  You have saved me soooo much time, you are a star 🙂

 

0 Likes
Message 4 of 5

Vladimir.Ananyev
Alumni
Alumni

🙂


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 5 of 5

Anonymous
Not applicable

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

 

 

0 Likes