Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ilogic Drawing view scales

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Fleagle8t
1079 Views, 4 Replies

Ilogic Drawing view scales

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

 

4 REPLIES 4
Message 2 of 5

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

Thank you Vladimir,

 

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

 

Message 4 of 5

🙂


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 5 of 5

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.

Post to forums  

Autodesk Design & Make Report