Macro to read value dimension associate at Baloon
Macro to read value dimension associate at Baloon
(OP)
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
RE: Macro to read value dimension associate at Baloon
Running the following macro will display balloon information referencing the dimensions in the active sheet.
CODE --> vba
This is the result when the macro is executed.
There is a limit to the number of characters that can be displayed in the MsgBox, so if you have a large number of balloons, it may not be possible to display all of them.
RE: Macro to read value dimension associate at Baloon
However I need the CATScript, but starting from VBA I can also trace the CATScript code.
Thank you very much, great job.