Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

quicker alternative changing annotative scale in objectcale

16 REPLIES 16
SOLVED
Reply
Message 1 of 17
boatman38
9038 Views, 16 Replies

quicker alternative changing annotative scale in objectcale

I would like to find a lisp that changes the scale of something that has an annotative scale and deletes all other scales in the object scale list.  Often i have many different scales of existing dimensions or objects. i waste a lot of time opening the annotation object scale dialogue box, selecting add, finding my scale and deleting the old scale. 

16 REPLIES 16
Message 2 of 17
Ian_Bryant
in reply to: boatman38

Hi,

you could try loading the attached LSP file.

The CH-ASC function adds the current Annoscale to a selected annotative object

and deletes all other scales from it.

Regards Ian

 

Message 3 of 17
boatman38
in reply to: boatman38

That works perfect!!!  thank you very much

Message 4 of 17

thank you, works great.

In localised Autocad versions you must put the "_" before the ssget parameters at Line 5

(if (setq ent (ssget "_:S:L"))

 

---
A. Zimmermann
www.hausbau-planung.de
Message 5 of 17
dkerns
in reply to: Ian_Bryant

This is a very useful lisp, but it would be awesome if you could window a group of dims and change them all at once.

Is that possible?

Message 6 of 17
dustin.walters
in reply to: dkerns

Yes this would be great to use on multiple items such as blocks, Mtext, Mleaders, etc.

 

Is that possible?

Message 7 of 17
dkerns
in reply to: dkerns

Bet Lee Mac could fix it.


Message 8 of 17
Lee_Mac
in reply to: dkerns

Try the following:

 

(defun c:chasc ( / cmd ent idx lst scl sel )
    (cond
        (   (= 1 (getvar 'cvport))
            (princ "\nThis command is only available in Modelspace.")
        )
        (   (setq sel (ssget "_:L" '((0 . "*TEXT,*DIMENSION,INSERT,HATCH,MULTILEADER"))))
            (setq cmd (getvar 'cmdecho)
                  scl (getvar 'cannoscale)
            )
            (setvar 'cmdecho 0)
            (repeat (setq idx (sslength sel))
                (if (setq ent (ssname sel (setq idx (1- idx)))
                          lst (LM:annoscales ent)
                    )
                    (progn
                        (if (not (member scl lst))
                            (command "_.-objectscale" ent "" "_a" scl "")
                        )
                        (if (setq lst (vl-remove-if '(lambda ( itm ) (= itm scl)) lst))
                            (progn
                                (command "_.-objectscale" ent "" "_d")
                                (foreach itm lst (command itm))
                                (command "")
                            )
                        )
                    )
                )
            )
            (setvar 'cmdecho cmd)
        )
    )
    (princ)
)

;; Annotative Scales  -  Lee Mac
;; Returns a list of all annotative scales associated with a supplied entity

(defun LM:annoscales ( ent / dic enx itm rtn )
    (if
        (and
            (setq enx (entget ent))
            (setq dic (cdr (assoc 360 (cdr (member '(102 . "{ACAD_XDICTIONARY") enx)))))
            (setq dic (cdr (assoc -1  (dictsearch dic "acdbcontextdatamanager"))))
            (setq dic (cdr (assoc -1  (dictsearch dic "acdb_annotationscales"))))
        )
        (while (setq itm (dictnext dic (not itm)))
            (setq rtn (cons (cdr (assoc 300 (entget (cdr (assoc 340 itm))))) rtn))
        )
    )
    (reverse rtn)
)

(princ)
Message 9 of 17
dkerns
in reply to: Lee_Mac

I knew you could do it! You are a lisp God!!!
Message 10 of 17

Great Code! Just curious on the ssget command, what does ":S:L" do i cant find it in the help anywhere?

Leland
Civil3d 2020
Windows 10 64x (32 gigs ram)
Message 11 of 17
ВeekeeCZ
in reply to: lelandleahy4987


@lelandleahy4987 wrote:

Great Code! Just curious on the ssget command, what does ":S:L" do i cant find it in the help anywhere?


See HERE. Or you can use autocad's HELP

Message 12 of 17
lelandleahy4987
in reply to: ВeekeeCZ

Great thanks!, Autocad's help didn't show a lot of these options. (note all the undocumented options) Why does Autodesk not show all the options? There should not be "undocumented" items!

 

thanks again! i will refer to Lee Mac's site first then autodesks 😃

Leland
Civil3d 2020
Windows 10 64x (32 gigs ram)
Message 13 of 17
e_c
Observer
in reply to: Lee_Mac

When using Lee Mac's code, it looks like it should automatically pick text, dimensions, hatch, etc, but it's always asking for me to select objects.  Am I missing something?  Do I have some weird configuration setting wrong?

I have thousands of objects I need to select to execute this code; seems like it actually SHOULD do what I want, but it's not working.

Message 14 of 17
dkerns
in reply to: e_c

Just window everything you want to change.

Message 15 of 17
e_c
Observer
in reply to: dkerns

If I do that, the script does some really weird stuff, and none of it is what it's supposed to.

Message 16 of 17
e_c
Observer
in reply to: e_c

So, turns out my computer was being odd apparently; rebooted and now the script works by highlighting all of my geometry.

Message 17 of 17
moon47usaco
in reply to: Lee_Mac

Thank you Lee Mac.

 

That routine is perfect. This fixes my number one gripe with how ACAD decided to set up changing/adding/deleting an objects scale. 

 

Seven clicks and two dialog boxes to change one objects scale. Repeated for every object type because properties will not show "Annotation Scale" for objects of different type when selected together.

 

This routine will save me lots of time... =]

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost