macro to change all the Leader Symbol shapes to Filled Circle
macro to change all the Leader Symbol shapes to Filled Circle
(OP)
macro to change all the Leader Symbol shapes to Filled Circle
Here is the macro i am trying, to change the leader symbol shape for all texts having leaders.
'Option Explicit
Sub CATMain()
Dim drawingDocument1 As DrawingDocument
Set drawingDocument1 = CATIA.ActiveDocument
Dim selection1 As Object
Set selection1 = drawingDocument1.Selection
selection1.Search "(CATTPSSearch.CATTPSText + CATDrwSearch.DrwText), all"
Dim oText As DrawingText
Dim oLeader As DrawingLeader
For i = 1 To selection1.Count2
Set oText = selection1.Item2(i).Value
If oText.Leaders.Count > 0 Then -> Error is here
For Each oLeader In oText.Leaders
oLeader.HeadSymbol = catFilledCircle
Next
End If
Next
End Sub
Please help me to solve this issue..
Here is the macro i am trying, to change the leader symbol shape for all texts having leaders.
'Option Explicit
Sub CATMain()
Dim drawingDocument1 As DrawingDocument
Set drawingDocument1 = CATIA.ActiveDocument
Dim selection1 As Object
Set selection1 = drawingDocument1.Selection
selection1.Search "(CATTPSSearch.CATTPSText + CATDrwSearch.DrwText), all"
Dim oText As DrawingText
Dim oLeader As DrawingLeader
For i = 1 To selection1.Count2
Set oText = selection1.Item2(i).Value
If oText.Leaders.Count > 0 Then -> Error is here
For Each oLeader In oText.Leaders
oLeader.HeadSymbol = catFilledCircle
Next
End If
Next
End Sub
Please help me to solve this issue..





RE: macro to change all the Leader Symbol shapes to Filled Circle
DrawingLeaders (Collection)
IUnknown
|
+---IDispatch
|
+---CATBaseUnknown
|
+---CATBaseDispatch
|
+---Collection
|
+---DrawingLeaders
--------------------------------------------------------------------------------
A collection of all the drawing leaders currently managed by a drawing view of drawing sheet in a drawing document.
--------------------------------------------------------------------------------
Method Index
Add
Creates a drawing leader and adds it to the DrawingLeaders collection.
Item
Returns a drawing leader using its index from the DrawingLeaders collection.
Remove
Removes a drawing leader from the DrawingLeaders collection.
RE: macro to change all the Leader Symbol shapes to Filled Circle
the view still have its name and this text is picked by the search, but this did not crash the script as leaders.count come back with value 0.
Try to identify which text your script fails on and work on it, maybe a text is corrupted? did you clean the drawing?
Can you post the drawing with the failing text?
indocti discant et ament meminisse periti