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

Quick Attribute Alignment Toggle LISP

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
thomas_schlüssi
367 Views, 5 Replies

Quick Attribute Alignment Toggle LISP

Hey!

 

I'm looking for a LISP that changes the orientation/alignment of an attribute from center left to center right.

Like a quick toggle.

So when its currently center left it gets set to center right and vice versa.

 

Maybe someone can help.

5 REPLIES 5
Message 2 of 6

Possibly...

 

(defun c:AttJustLR ( / e j)
  
  (if (and (setq e (car (nentsel "\nAttribute: ")))
	   (setq j (getpropertyvalue e "Justify"))
	   )
    (setpropertyvalue e "Justify" (if (= j 9) 11 9)))
  (princ)
  )

 

Message 3 of 6

Works just fine. Thanks a lot!

I only have two other questions:
- How would you change the lisp to be able to use it with multiple attributes at once?

- Where did you get the information from which number represents which text orientation? Is there an overview for this?
Message 4 of 6


@thomas_schlüssi wrote:
- How would you change the lisp to be able to use it with multiple attributes at once?

No easy way - it's a nested object. You would need to select blocks (not atts directly) and somehow determine which atts should be justified. It could be by their tag or order in the definition. But all that requires much complex and lengthy code. So to reply to your naive question of how to change it? Remove it all and start over. 

 

 


@thomas_schlüssi wrote:
- Where did you get the information from which number represents which text orientation? Is there an overview for this?

These newer functions g/setpropertyvalue are not so well documented. The easiest is to pick some existing object and dump all the properties by this line:

(dumpallproperties (car (entsel)))

If it's nested object, then nentsel.

 

Message 5 of 6

Ok, thanks for the info!
Message 6 of 6

Hi, its me again. 🙂

 

I use this LISP very often and have one more request.
Is it possible to use the LISP with multi-line attributes?

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report