What I am trying to do:
delete all blocks inserts not on my "keep" list.
(setq DELETEGRP (ssget "X"
'((0 . "INSERT") ; SELECT ONLY BLOCK INSERTS
)
)
KEEPGRP (ssget "X"
'((0 . "INSERT") ; SELECT ONLY BLOCK INSERTS
(-4 . "<OR") ; SELECT ALL BLOCKS IN THIS LIST
(2 . "DA_LE1")
(2 . "DA_BIDUAL-MINI")
(2 . "DT_TAP2")
(2 . "DT_TAP4")
(2 . "STA")
(2 . "UtilitySymbols")
(2 . "RCU_COMM")
(2 . "RCU_HHP")
(2 . "RP_PEDSTL")
(2 . "RP_CTIC")
(2 . "RP_UTCLST")
(2 . "SPLICE")
(2 . "RF_TRENCH")
(2 . "B_MDUADD")
(2 . "Storage Loop")
(2 . "Makready Legend")
(2 . "RF_STRAND")
(2 . "TCPX-X")
(2 . "TCP TAG")
(2 . "RN_UNKDROP")
(2 . "RN_OHDROP")
(2 . "RN_UGDROP")
(2 . "RP_PWR")
(2 . "RP_JNT")
(2 . "RP_TRANSJNT")
(2 . "RP_TRANSPWR")
(2 . "RP_TEL")
(2 . "RP_VLT")
(2 . "RCA_HHP")
(2 . "RCA_COMM")
(2 . "RA_ANCHOR")
(2 . "RA_OHGUY")
(2 . "RP_CRSSOVER")
(2 . "CITY_COUNTY_LIMITS")
(2 . "CELL_TWR")
(2 . "STATE HWY")
(2 . "FED HWY")
(2 . "INTERSTATE HWY")
(2 . "B_UNITCOMM")
(2 . "N-NORTH")
(2 . "HLECP Title Block - Packet Sheets")
(2 . "SHEET NAMES")
(2 . "APPROACH PLAN BOARDER")
(2 . "COMCAST*LEGEND")
(2 . "RP_LOCKBOX")
(2 . "B_ADDCOMM")
(2 . "B_ADDCOMM-MDU")
(2 . "B_Address")
(2 . "B_UNITMDU")
(2 . "BORING NOTE")
(2 . "C- I405-I5-I90-DB")
(2 . "CORVALLIS_UTILITY_CONFILCT_AVOID")
(2 . "dynamic block_tree4")
(2 . "FLAGGER_TRAFFIC_LIGHT")
(2 . "HANDHOLE")
(2 . "PROBUILD LEGEND")
(2 . "RF_CONDUIT")
(2 . "SALEM_Existing_Utilities_Legend")
(2 . "SALEM_TEMP_STREET_CLOSURE")
(2 . "SHRUB")
(2 . "SPRINGFIELD_NO_TCP_NEEDED")
(2 . "STREET_LIGHT")
(2 . "TREE_NOTE")
(2 . "UTILITY_CONFLICT_AVOID")
(2 . "C- I405-I5-I90-DB")
(2 . "PROBUILD")
(2 . "dynamic block_tree4")
(2 . "TCP TAG")
(2 . "APPROACH PLAN BOARDER")
; (2 . "temp")
; (2 . "temp")
; (2 . "temp")
; (2 . "temp")
; (2 . "temp")
; (2 . "temp")
(-4 . "OR>")
)
)
)
;; Remove the keep group selection from the delete group.
(if KEEPGRP
(repeat (setq i (sslength KEEPGRP))
(ssdel
(ssname KEEPGRP
(setq i (1- i))
)
DELETEGRP
)
)
)
(sssetfirst nil DELETEGRP) ; Take a look at the results.
My KEEPGRP only selects the first insert that it encounters of each OR member. Therefore, my delete group has block inserts that are also in the keep list.
I have included my test drawing, incase that anyone wants to experiment. There should be nothing selected in the end if this was to work correctly.
Solved! Go to Solution.
Link copied