Rotate Autocad Drawing 90 Degrees

  1. #1

    Remco Koedoot is offline

    Member


    Default AutoLisp to rotate an attribute, for example +90 degrees.

    Hi CAD designers,

    I am looking for a solution by AutoLisp to rotate an attribute, for example +90 degrees.
    For example the attribute is already rotated 12 degrees.
    With the lisp routine it has to be rotated 12+90=102 degrees.

    I have already a wonderfull lisp routine below wich rotate the attribute 90 degrees. But the problem is if the attribute is already rotated, for example 12 degrees, the result is that the attibute is rotated to 90 degrees. I want as result: 12+90=102 degrees.
    See the attachment.

    Please ,anyone can help me?
    Thanks in advanche.


  2. #2

    ledgehead is offline

    Member


    Default Re: AutoLisp to rotate an attribute, for example +90 degrees.

    Hello,

    Included with AutoCAD Express tools there is a command called TORIENT. "Rotates text, mtext, attribute definitions, and blocks with attributes for readability."

    Hunter

    Quote Originally Posted by remcokoedoot View Post

    Hi CAD designers,

    I am looking for a solution by AutoLisp to rotate an attribute, for example +90 degrees.
    For example the attribute is already rotated 12 degrees.
    With the lisp routine it has to be rotated 12+90=102 degrees.

    I have already a wonderfull lisp routine below wich rotate the attribute 90 degrees. But the problem is if the attribute is already rotated, for example 12 degrees, the result is that the attibute is rotated to 90 degrees. I want as result: 12+90=102 degrees.
    See the attachment.

    Please ,anyone can help me?
    Thanks in advanche.


  3. #3

    ReachAndre is offline

    I could stop if I wanted to


    Default Re: AutoLisp to rotate an attribute, for example +90 degrees.

    Take a look at the link, I had a similar question years ago.

    https://forums.augi.com/showthread.p...to-remain-at-0

    aaronic_abacus helped out big time and posted the follwoing code

    Code:

    (DEFUN C:SAR (/ BS BSL CT NOFUV NOFNU LP NE NEL NEAET NEA NEAS OFNU NNEL)  (PROMPT "\n*SET ATTRIBUTE ROTATION* ")  (PROMPT "\nSelect block with attributes to rotate: ")  (SETQ BS (SSGET '((-4 . "<AND") (0 . "INSERT") (66 . 1) (-4 . "AND>")) ))  (SETQ BSL (SSLENGTH BS))  (SETQ CT (- BSL 1))  (SETQ NOFUV (GETANGLE "\nNew attribute rotation angle: "))  (SETQ LP 1)  (WHILE LP   (SETQ NE (SSNAME BS CT))   (SETQ CT2 0)   (SETQ LP2 1)   (WHILE LP2    (SETQ NE (ENTNEXT NE))    (SETQ NEL (ENTGET NE))    (SETQ NEAET (CDR (ASSOC 0 NEL)))    (SETQ NEA (ASSOC 50 NEL))    (SETQ NEAS (CDR NEA))    (IF (= NEAET "ATTRIB")      (PROGN      (IF (/= NEA NIL)       (PROGN        (SETQ NOFNU (CONS 50 NOFUV))        (SETQ OFNU NEA)        (SETQ NNEL (SUBST NOFNU OFNU NEL))        (ENTMOD NNEL)        (ENTUPD NE)      ));END PROGN/IF NEA    ));END PROGN/IF NEAET    (IF (= NEAET "SEQEND") (SETQ LP2 NIL))   );END WHILE LP2   (SETQ CT (- CT 1))   (IF (< CT 0) (SETQ LP NIL))  );END WHILE LP  (PRINC) );END SAR
    Hope this helps.

  4. #4

    Remco Koedoot is offline

    Member


    Default Re: AutoLisp to rotate an attribute, for example +90 degrees.

    This is a good solution ReachAndre. Your lisp works fine. Only I have to set the rotation angle for each attribute separatly. I want a lisp wich calculated it.

  5. #5

    Remco Koedoot is offline

    Member


    Default Re: AutoLisp to rotate an attribute, for example +90 degrees.

    I know that but I want to do it for all attributes by a lisp.. I want a lisp which calculated the rotation angle.

  6. #6

    Default Re: AutoLisp to rotate an attribute, for example +90 degrees.

    Try this and let me know .

    Code:

    (defun c:Test (/ ss ro)   ;;	Tharwat Al Shoufi		;;   ;;	Date: 10.Sep.2014		;;   (if (and (setq ro (getdist "\n Specify rotation angle [Degrees] :"))            (princ "\n Select Attributed Blocks :")            (setq ss (ssget "_:L" '((0 . "INSERT")(66 . 1))))            )     ((lambda (i / sn)        (while (setq sn (ssname ss (setq i (1+ i))))          (mapcar '(lambda (x) (vla-put-rotation x (+ (vla-get-rotation x) (* pi (/ ro 180.0)))))                  (vlax-invoke (vlax-ename->vla-object sn) 'getattributes))          ))       -1       )     )   (princ)   )(vl-load-com)

  7. #7

    Remco Koedoot is offline

    Member


    Default Re: AutoLisp to rotate an attribute, for example +90 degrees.

    Thanks Tharwat.
    When I select one attribute then it rotated all attributes in the same block. Is it possible to filter the one attribute which I had selected?

winklerexclaugher.blogspot.com

Source: https://forums.augi.com/showthread.php?157372-AutoLisp-to-rotate-an-attribute-for-example-90-degrees

0 Response to "Rotate Autocad Drawing 90 Degrees"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel