Author Topic: Reset - Delete all Annotative Scales for all objects  (Read 1233 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Reset - Delete all Annotative Scales for all objects
« on: September 16, 2015, 09:18:33 AM »
Ok. not having a smart time with this one. Can someone help me figure this out? lol. I have several mtexts, dtexts, dimensions, mleaders that all have various scales. All I am trying to do is delete all the scales in those objects except the current scale.
Civil3D 2020

Crank

  • Water Moccasin
  • Posts: 1503
Re: Reset - Delete all Annotative Scales for all objects
« Reply #1 on: September 16, 2015, 01:54:34 PM »
I'm sure this can be done better, but this is what I use:
Code: [Select]
(defun c:OnlyCScale (/ l3 l4 l5 l6 l7 SS CS n waarden ent lijst)
(setq SS (ssget "I"))
(command ".undo" "begin")
(while (not SS)(setq SS (ssget)))
(command ".chprop" ss "" "Annotative" "y" "")
(setq CS (getvar "CANNOSCALE"))
(command "-OBJECTSCALE" SS "" "Add" CS "")

(setq n 0 lijst '())
(repeat (sslength SS)
(setq ent (ssname SS n))
(setq waarden (get_ent_scales (entget ent)))
(if waarden (setq lijst (append waarden lijst)))
(setq n (1+ n))
)

(setq lijst (remove_doubles lijst))

(foreach n lijst
(if (/= n CS)(progn
(if (= (strlen n) 3)(setq l3 (vl-sort (cons n l3)'<)))
(if (= (strlen n) 4)(setq l4 (vl-sort (cons n l4)'<)))
(if (= (strlen n) 5)(setq l5 (vl-sort (cons n l5)'<)))
(if (= (strlen n) 6)(setq l6 (vl-sort (cons n l6)'<)))
(if (= (strlen n) 7)(setq l7 (vl-sort (cons n l7)'<)))
(command "-OBJECTSCALE" SS "" "Del" n "")
))
)
(setq lijst (append l3 l4 l5 l6 l7))
(princ (strcat "\n\nThis scale was added " CS))
(if lijst (progn
(princ "\nand these have been removed:")
(foreach n lijst (princ (strcat " " n)))
))
(command ".undo" "end")
(princ)
)
(defun remove_doubles (lst); by Gile
(if lst (cons (car lst) (remove_doubles (vl-remove (car lst) lst))))
)
(defun get_ent_scales (ent / annotative lijst n schalen collect)
; zie ook: http://www.theswamp.org/index.php?topic=24171.0
(defun collect (key lijst / n return)
(foreach n lijst
(if (= key (car n))
(setq return (cons (cdr n) return))
)
)
return
)

(setq annotative (cdr (assoc 360 ent)))

(if annotative (progn
(setq lijst
(entget (cdr (assoc 350
(entget (cdr (assoc 360
(member '(3 . "AcDbContextDataManager"); Get the right 360-code
(entget annotative)
)
)))
)))
)

(foreach n (collect 350 lijst)
(setq schalen (cons
(cdr (assoc 300 (entget (cdr (assoc 340 (entget n))))))
schalen
)
)
)
schalen
))
)
« Last Edit: September 16, 2015, 02:04:12 PM by Crank »
Vault Professional 2023     +     AEC Collection

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Re: Reset - Delete all Annotative Scales for all objects
« Reply #2 on: September 16, 2015, 03:23:23 PM »
DUDE! you rock. Thank you so much!
Civil3D 2020