Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


macro to change all the Leader Symbol shapes to Filled Circle

macro to change all the Leader Symbol shapes to Filled Circle

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
    End If
End Sub

Please help me to solve this issue..

RE: macro to change all the Leader Symbol shapes to Filled Circle

My guess is you cannot count the number of leaders because there is no Count method. Try removing the If and end if.

DrawingLeaders (Collection)


A collection of all the drawing leaders currently managed by a drawing view of drawing sheet in a drawing document.


Method Index
Creates a drawing leader and adds it to the DrawingLeaders collection.
Returns a drawing leader using its index from the DrawingLeaders collection.
Removes a drawing leader from the DrawingLeaders collection.

RE: macro to change all the Leader Symbol shapes to Filled Circle

your code works well, no error for me when the view does have few texts to which I did add a multi leader and some text with leader and some other stuff like datum target, balloon and welding symbol.

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?

Eric N.
indocti discant et ament meminisse periti

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close