Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
I have this macro to get rid of all these duplicate callout styles from our .iso files. Not sure but would like to know why these new callouts come in when pasting elements that are not callouts. Regardless, I have this macro below and am simply trying to figure out how to shorten it with a “For/While If/Then” string function of some sort. Also below is a version of my many failed attempts. Can anyone help?
Working code but long winded:
SubMacro Clean Out Callouts WHILE (exists(activedoc.callouts["YBAEcallout"]) = true) DELETE CALLOUT_STYLE "YBAEcallout" END while WHILE (exists(activedoc.callouts["Normal-1"]) = true) DELETE CALLOUT_STYLE "Normal-1" END while WHILE (exists(activedoc.callouts["Normal-1-1"]) = true) DELETE CALLOUT_STYLE "Normal-1-1" END while WHILE (exists(activedoc.callouts["Normal-1-1-1"]) = true) DELETE CALLOUT_STYLE "Normal-1-1-1" END while WHILE (exists(activedoc.callouts["Normal-1-1-1-1"]) = true) DELETE CALLOUT_STYLE "Normal-1-1-1-1" END while WHILE (exists(activedoc.callouts["Normal-1-1-1-1-1"]) = true) DELETE CALLOUT_STYLE "Normal-1-1-1-1-1" END while WHILE (exists(activedoc.callouts["Normal-1-1-1-1-1-1"]) = true) DELETE CALLOUT_STYLE "Normal-1-1-1-1-1-1" END while WHILE (exists(activedoc.callouts["Normal-1-1-1-1-1-1-1"]) = true) DELETE CALLOUT_STYLE "Normal-1-1-1-1-1-1-1" END while WHILE (exists(activedoc.callouts["Normal-1-1-1-1-1-1-1-1"]) = true) DELETE CALLOUT_STYLE "Normal-1-1-1-1-1-1-1-1" END while WHILE (exists(activedoc.callouts["Normal-1-1-1-1-1-1-1-1-1"]) = true) DELETE CALLOUT_STYLE "Normal-1-1-1-1-1-1-1-1-1" END while WHILE (exists(activedoc.callouts["Normal-1-1-1-1-1-1-1-1-1-1"]) = true) DELETE CALLOUT_STYLE "Normal-1-1-1-1-1-1-1-1-1-1" END while WHILE (exists(activedoc.callouts["Normal-1-1-1-1-1-1-1-1-1-1-1"]) = true) DELETE CALLOUT_STYLE "Normal-1-1-1-1-1-1-1-1-1-1-1" END while End submacro
An example of one of my many failed attempts:
Macro Test Clean Out Callouts WHILE (exists(activedoc.callouts["YBAEcallout"]) = true) DELETE CALLOUT_STYLE "YBAEcallout" END while DEFINE Norm AS String DEFINE Rept AS String DEFINE Ended AS String Norm = "Normal-1" #FOR Norm = Norm TO left(Norm, 8) Rept = left(Norm, 8) Ended = Norm Rept WHILE (exists(activedoc.callouts[Ended]) = true) DELETE CALLOUT_STYLE Ended END while #End for End macro
Solved! Go to Solution.
I figured the answer out all on my own!
Macro Clean Out Callouts WHILE (exists(activedoc.callouts["YBAEcallout"]) = true) DELETE CALLOUT_STYLE "YBAEcallout" END while Define h as Integer Define k as Integer Define BadCallout as String Select None k = ActiveDoc.calloutCount h = 1 #Starts loop that goes through all existing callouts. While ((h <> k + 1) = True) If (Right(ActiveDoc.callouts[h].style_name, 2) = "-1") then BadCallout = ActiveDoc.callouts[h].style_name Delete CALLOUT_STYLE BadCallout #Reduce number of overall callouts because of callout deletion. k = ActiveDoc.calloutCount Else h = h + 1 End If End While End macro
I figured the answer out all on my own!
Macro Clean Out Callouts WHILE (exists(activedoc.callouts["YBAEcallout"]) = true) DELETE CALLOUT_STYLE "YBAEcallout" END while Define h as Integer Define k as Integer Define BadCallout as String Select None k = ActiveDoc.calloutCount h = 1 #Starts loop that goes through all existing callouts. While ((h <> k + 1) = True) If (Right(ActiveDoc.callouts[h].style_name, 2) = "-1") then BadCallout = ActiveDoc.callouts[h].style_name Delete CALLOUT_STYLE BadCallout #Reduce number of overall callouts because of callout deletion. k = ActiveDoc.calloutCount Else h = h + 1 End If End While End macro