Left Sidebar
Right Sidebar
06/10/18: Modifying view scale (UNIX)
A CATScript which will modify views scale. The macro will skip the views which are not created and will do the job in the order specified in the message box.
Sub CATMain()
MsgBox "First 2 inputs are for Main View Scale and Background View Scale: Even if you will modify these 2 scales, you will not notice any modifications, that's why implicit value is 1. 1st value is for Main, 2nd for Background, 3rd for Front, 4th for Top, 5th for Up, 6th for Left, 7th for Right, 8th for ISO. Use only double value, do NOT use 1:2 or 1/2 (for example)"
Dim theDrawing As DrawingDocument
Set theDrawing = CATIA.ActiveDocument
Dim aSheet As DrawingSheet
Dim aView As DrawingView
Dim i As Integer, j As Integer
For i = 1 To theDrawing.Sheets.count
Set aSheet = theDrawing.Sheets.Item(i)
For j = 1 To aSheet.Views.count
Set aView = aSheet.Views.Item(j)
' Retrieve the drawing components collection of the target drawing view
Dim o2DComponents As DrawingComponents
Set o2DComponents = aView.Components
'Gets the View Scale;
aView.Scale = InputBox("Enter drawing scale", "scale", "1")
If aView.Scale = "" Then
MsgBox "The Macro has been aborted."
Exit Sub
End If
Next
Next
End Sub
Sub CATMain()
MsgBox "First 2 inputs are for Main View Scale and Background View Scale: Even if you will modify these 2 scales, you will not notice any modifications, that's why implicit value is 1. 1st value is for Main, 2nd for Background, 3rd for Front, 4th for Top, 5th for Up, 6th for Left, 7th for Right, 8th for ISO. Use only double value, do NOT use 1:2 or 1/2 (for example)"
Dim theDrawing As DrawingDocument
Set theDrawing = CATIA.ActiveDocument
Dim aSheet As DrawingSheet
Dim aView As DrawingView
Dim i As Integer, j As Integer
For i = 1 To theDrawing.Sheets.count
Set aSheet = theDrawing.Sheets.Item(i)
For j = 1 To aSheet.Views.count
Set aView = aSheet.Views.Item(j)
' Retrieve the drawing components collection of the target drawing view
Dim o2DComponents As DrawingComponents
Set o2DComponents = aView.Components
'Gets the View Scale;
aView.Scale = InputBox("Enter drawing scale", "scale", "1")
If aView.Scale = "" Then
MsgBox "The Macro has been aborted."
Exit Sub
End If
Next
Next
End Sub
Category: Developer's corner
Posted by: ferdo