Med Che
New member
- Oct 21, 2023
- 8
Hi,
I am working on a macro that calculates the number of leaders associated with a 2D component in a CATIA drawing. I have created the macro, but I can't count the number of leaders for the 2D component (the component I want to count the leaders for is a Bonding symbol). Here is my macro:
***********************
Sub Bonding_Count()
Dim doc1 As Object
Set doc1 = CATIA.ActiveDocument
Dim mycomponent As Object
Dim mysel As Object
Set mysel = doc1.Selection
Dim mySheet As Object
Set mySheet = doc1.sheets
'MsgBox mySheet.Item(1).Name
Dim myview As Object
Set myview = mySheet.Item(1).views
mysel.Clear
mysel.Add myview.Item("VIEW AP")
mysel.Clear
mysel.Search "CATDrwSearch.DrwDitto,all"
MsgBox TypeName(mysel.Item(1).Value)
MsgBox mysel.Item(1).Value.leaderCount
End Sub
**************************************
And here is a part of the view where there is a Bonding linked by two leaders.
Thank you for helping me achieve my goal.
I am working on a macro that calculates the number of leaders associated with a 2D component in a CATIA drawing. I have created the macro, but I can't count the number of leaders for the 2D component (the component I want to count the leaders for is a Bonding symbol). Here is my macro:
***********************
Sub Bonding_Count()
Dim doc1 As Object
Set doc1 = CATIA.ActiveDocument
Dim mycomponent As Object
Dim mysel As Object
Set mysel = doc1.Selection
Dim mySheet As Object
Set mySheet = doc1.sheets
'MsgBox mySheet.Item(1).Name
Dim myview As Object
Set myview = mySheet.Item(1).views
mysel.Clear
mysel.Add myview.Item("VIEW AP")
mysel.Clear
mysel.Search "CATDrwSearch.DrwDitto,all"
MsgBox TypeName(mysel.Item(1).Value)
MsgBox mysel.Item(1).Value.leaderCount
End Sub
**************************************
And here is a part of the view where there is a Bonding linked by two leaders.
Thank you for helping me achieve my goal.