dddn
Mechanical
- Nov 26, 2022
- 35
Hi all,
I am trying to write a macro with CATScript language that will read and print dimensional values associated with baloons;
attached is the starting situation and I want to get a msgbox that says: Baloon1 Value 50; Baloon2 Value 100; Baloon3 Value Ø25.69
I try to wirte this, but doesn't work:
Sub CATMain()
Dim drawingDocument1 As DrawingDocument
Dim drawingView1 As DrawingView
Dim drawingDimensions1 As DrawingDimensions
Dim drawingDimension1 As DrawingDimension
Dim DrawingDimValue1 As DrawingDimValue
Dim Selection1 As Object
Dim SavedLockStatus As Boolean
Set drawingDocument1 = CATIA.ActiveDocument
Set Selection1 = drawingDocument1.Selection
'Selection1.Search "CATDrwSearch.DrwDimension,all"
Selection1.Search "CATDrwSearch.DrwBalloon,all"
For i = 1 To Selection1.Count2
Set drawingDimension1 = Selection1.Item2(i).Value
Set drawingDimensions1 = drawingDimension1.Parent
Set DrawingDimValue1 = drawingDimension1.GetValue
msgbox DrawingDimValue1.Value
Next
Selection1.Clear
End Sub
I am trying to write a macro with CATScript language that will read and print dimensional values associated with baloons;
attached is the starting situation and I want to get a msgbox that says: Baloon1 Value 50; Baloon2 Value 100; Baloon3 Value Ø25.69
I try to wirte this, but doesn't work:
Sub CATMain()
Dim drawingDocument1 As DrawingDocument
Dim drawingView1 As DrawingView
Dim drawingDimensions1 As DrawingDimensions
Dim drawingDimension1 As DrawingDimension
Dim DrawingDimValue1 As DrawingDimValue
Dim Selection1 As Object
Dim SavedLockStatus As Boolean
Set drawingDocument1 = CATIA.ActiveDocument
Set Selection1 = drawingDocument1.Selection
'Selection1.Search "CATDrwSearch.DrwDimension,all"
Selection1.Search "CATDrwSearch.DrwBalloon,all"
For i = 1 To Selection1.Count2
Set drawingDimension1 = Selection1.Item2(i).Value
Set drawingDimensions1 = drawingDimension1.Parent
Set DrawingDimValue1 = drawingDimension1.GetValue
msgbox DrawingDimValue1.Value
Next
Selection1.Clear
End Sub