TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: HasanCAD on October 20, 2013, 11:32:36 AM

Title: is there a way to select annotative objects for spacific scale?
Post by: HasanCAD on October 20, 2013, 11:32:36 AM
there are drawings come from the clinent which has a lot of annotative scales.
So, I want to select annotative objects which has spacific scale to delete unwanted scales and/or change to scale which i use.
for example objects which has scale 1:50

Thanks all
Title: Re: is there a way to select annotative objects for spacific scale?
Post by: HasanCAD on October 22, 2013, 08:29:19 AM
Is there no SSGET method for that
Title: Re: is there a way to select annotative objects for spacific scale?
Post by: pBe on October 22, 2013, 08:54:01 AM
Is there no SSGET method for that

Not that i know of. I guess there should be, otherwise select all annotative [Text/Mtext/BLocks/Dimensions.....] dig deep using entget until you hit
(3 . "ACDB_ANNOTATIONSCALES") then work from there?
Title: Re: is there a way to select annotative objects for spacific scale?
Post by: Crank on October 24, 2013, 05:41:19 PM
Perhaps this is an idea: Add all scales and then remove the ones you don't need:
Code: [Select]
(defun c:OnlyCScale (/ l3 l4 l5 l6 l7 SS CS n waarden ent lijst AV)
(setq SS (ssget "I"))
(command ".undo" "begin")
;(setq AV (getvar "ANNOALLVISIBLE"))
;(if AutoAnnoAllVisible (setvar "ANNOALLVISIBLE" 1))
(while (not SS)(setq SS (ssget)))
(command ".chprop" ss "" "Annotative" "y" "")
(setq CS (getvar "CANNOSCALE"))
(command "-OBJECTSCALE" SS "" "Add" CS "")
;(setvar "ANNOALLVISIBLE" AV)

(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)); verwijderen dubbelingen

(foreach n lijst; schalen sorteren en verwijderen
(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\nDeze selectie is voorzien van schaal " CS))
(if lijst (progn
(princ "\nen de volgende schalen zijn verwijderd van deze selectie:")
(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
))
)
Title: Re: is there a way to select annotative objects for spacific scale?
Post by: HasanCAD on October 27, 2013, 07:49:13 AM
Thankx Crank

i'll try and tell the result.