Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hi everybody, is they have any way to incorporate someting in this macro to do not delete line who is lock or invisible???
Thank to all!!!
Macro Delete_Unused_Pens
Define p as Integer
Define i as Integer
Define CheckMe as String
Define E1 as Element
Zoom Page
Select None
Wait Timer 1
#Sets values of variables.
i = ActiveDoc.PenCount
p = 1
#Starts loop that goes through all existing pens.
While ((p <> i + 1) = True)
Select None
CheckMe = ActiveDoc.Pens[p].Name
Select if Pen is equal to CheckMe
If (Exists (ActiveDoc.FirstSelectedElement) = False) Then
Set Active Pen CheckMe
Create Line 0 0 1 1
E1 = ActiveDoc.FirstSelectedElement
Create object_info E1
E1.Info.Name = "Delete_Me"
On Error Goto WhoCares
Delete Pen CheckMe "$ISO_NOPEN"
Else
p = p + 1
End If
#Reduce number of overall pens because of pen deletion.
i = ActiveDoc.PenCount
End While
Select None
Select if Object_Name is Equal to 'Delete_Me'
Delete Selection
Select None
Zoom Page
End Macro
SubMacro WhoCares
End Submacro