;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (replacetagvalue tag newvalue ent)
;; tag - the attribute name
;; newvalue - the new value for that attribute
;; ent - the ent name of the entity
;; returns T if change is made
;; else returns nil
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun replacetagvalue (tag newvalue ent / elist)
(if (and (assoc 66 (setq elist (entget ent))))
(progn
(setq ent (entnext ent)
elist (entget ent)
)
(while
(not
(or
(= (cdr (assoc 0 elist)) "SEQEND")
(= (cdr (assoc 2 elist)) tag)
)
)
(setq ent (entnext ent)
elist (entget ent)
)
)
)
)
(if (= (cdr (assoc 0 elist)) "SEQEND")
nil
(progn (setq elist (entget ent))
(setq elist (subst (cons 1 newvalue) (assoc 1 elist) elist))
(entmod elist)
T
)
)
);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (gettagvalue tag ent)
;; tag - the attribute name
;; ent - the ent name of the entity
;; returns attribute value if not ""
;; else returns nil
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun gettagvalue (tag ent / elist)
(if (and (assoc 66 (setq elist (entget ent))))
(progn
(setq ent (entnext ent)
elist (entget ent)
)
(while
(not
(or
(= (cdr (assoc 0 elist)) "SEQEND")
(= (cdr (assoc 2 elist)) tag)
)
)
(setq ent (entnext ent)
elist (entget ent)
)
)
)
)
(if (= (cdr (assoc 0 elist)) "SEQEND")
nil
(progn
(setq elist (entget ent)
elist (reverse elist)
)
(cdr (assoc 1 elist))
)
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DCS to Delete Cable block Spaces Didn't get this to work
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:DCS (/ fiber_cable_ss i cable_count)
(setq fiber_cable_ss (ssget "_X" '((2 . "FIBER_CABLE"))))
(sssetfirst nil fiber_cable_ss)
(repeat (setq i (sslength fiber_cable_ss))
(if
(setq cable_count (gettagvalue
"CABLE_COUNT"
(ssname fiber_cable_ss (setq i (1- i)))
)
)
(progn
(setq cable_count (vl-list->string
(vl-remove 32 (vl-string->list cable_count))
)
)
(replacetagvalue "CABLE_COUNT" cable_count (ssname fiber_cable_ss i))
)
)
)
(setq fiber_cable_ss nil)
(princ)
)
(princ "\nDCS to Delete Cable block Spaces")
FIBER_CABLE is a block with among other data attributes CABLE_COUNT.
a default for CABLE_COUNT was "1-7XD;\\P 1608AA,156;\\P 1608AA,P0156:7-8;11-12XD;\\P 1608AA,P0156:S7,1-3;\\P16-24XD"
For some reason our ACAD to GIS conversation tool was having trouble with the spaces (and perhaps the \P) but when the spaces were deleted it was fine. I delete the spaces out of the block and the sample inserts in the template. And was trying to write a lisp to process previous production work.
Since then the spaces have "reappeared" in work that my drafters had cleaned of spaces.
I am thinking now that it is a function of multiline attributes.
This DCS is just as simple as choose a FIBER_CABLE block. Select similar. Find [Find " "] [Replace ""] <replace all>.