Jump to content

Rotate an object to match an angle without knowing the angle?


Recommended Posts

Is there a quick way to rotate an object to match an angle without knowing what the angle is? I am using AutoCAD 2011 now. I was using 2007 and I had an add on command the would rotate an object using a base point and picking the two lines that make up the angle, and it would match the angle you wanted. I can not get that command to load in 2011. Thank you for your help.

Link to comment
Share on other sites

you could rotate it via snapping to a node along the angular line, worst case scenario you might have to rotate it 90 degrees after that to get the proper orientation.

Link to comment
Share on other sites

Thank you. I feel dumb now. You get used to doing everything the same way all the time and when you change to a new release you have to relearn everything again. Thank you again.

Link to comment
Share on other sites

Or you could use the Osnap Parallel.

 

This takes a bit of getting used to, because it involves hovvering over the target object until you see the reference marks, and then moving the cursor until you see the alignment marks, before clicking.

 

Or Rotate using the Reference option

Edited by eldon
More thoughts
Link to comment
Share on other sites

  • 5 years later...

I'm reviving this because I need something like it, but with a difference, i want aling to rotate my object relatively to the 1st source point, but I don't want it to move the object afterwards, instead i want him to stay in his place, and just with the same angle. Is such thing possible?

Link to comment
Share on other sites

Aren't you basically describing the rotate command (rotate about a point without moving the object being rotated)? You just have to figure out what the angle of rotation is going to be. There must be a couple of ways of doing that.

Link to comment
Share on other sites

Sounds like the same as Eldon offered osnap parallel leave object where it is but parallel to two points etc. But in a lisp. pick line near end that establishes rotate pt, get angle of line, pick two new points rotate line correct amount.

Link to comment
Share on other sites

You could also use the ROTATE command with the Reference option. This allows you to rotate objects using object snaps as reference points.

Link to comment
Share on other sites

You could also use the ROTATE command with the Reference option. This allows you to rotate objects using object snaps as reference points.

 

It is always nice when someone agrees with you, even after nearly 6 years! see post #5

Link to comment
Share on other sites

Wrote this lisp about 20 years ago as a replacement to the ROTATE command so no extra button is required. Still use it all the time. It works for objects including hatches, text, dimension text, blocks and attributes. It only works for a single object and only if the command is called first, otherwise it defaults to the ROTATE command. For text it defaults to a single pick for direction, but gives you an option for selecting two points if you want to match direction to another object.

;;; Change Entinty Direction
;;; acad.lsp: (autoload "ENT_DIR" '("ED"))
;;; Macro: ^P(or C:ed (load "ent_dir.lsp"));ed
;;; BY: TOM BEAUFORD
;;; BeaufordT@LeonCountyFL.gov
;;; LEON COUNTY PUBLIC WORKS ENGINEERING SECTION
;==================================================================
(defun C:ED (/ ss en pt e1 ed ha nol nha edb ed1 count la ofa os osa ang)
 (setq oldab (getvar "angbase"))
 (setvar "angbase" 0)
 (setq ss (ssget "I"))
 (if (= ss nil)(setq en (entsel "\nPick Entity or Press Enter to Select objects: ")))
 (if en
   (setq pt (cadr en)    ;pick coordinates
         e1 (car en)     ;entinty name
         ed (entget e1)  ;entinty list
   )
 );if
 (cond
  ((= "HATCH" (cdadr ed))
  (progn
   (setq  ha (cdr(assoc 52 ed))                             ;existing hatch angle
         nol (cdr(assoc 78 ed))                             ;# of pat lines
         nha (getangle "Pick Hatch Direction")              ;new hatch angle
          ed (subst(cons 52 nha)(assoc 52 ed)ed)            ;subst new hatch angle
         edb (list(car ed))                                 ;entinty list beg
         ed1 (cdr ed)                                       ;working entinty list
       count 0
   )
;edb = entinty list up to pattern lines
   (while(/= 53 (caar ed1))
     (setq edb (append edb (list(car ed1)))
           ed1 (cdr ed1)
     )
   )
   (repeat nol
     (setq la (assoc 53 ed1)                                ;existing pat line angle
           la (list(cons 53 (+ (- nha ha)(cdr la))))        ;new pat line angle
          ed1 (member (assoc 53 ed1) ed1)                   ;working entinty list
           pt (list (cdr(assoc 43 ed1))(cdr(assoc 44 ed1))) ;existing pat line base point
          ofa (+ (- nha ha)(angle '(0 0) pt))               ;new offset angle
           pt (polar '(0 0) nha (distance '(0 0) pt))       ;new pat line base point
     )
     (if (or(car pt)(cadr pt))
       (setq pt (polar '(0 0) ofa (distance '(0 0) pt))) ;new pat line base point
     )
     (setq edb (append edb la)                               ;add new pat line angle
           edb (append edb (list(cons 43 (car pt))))         ;add pat line x
           edb (append edb (list(cons 44 (cadr pt))))        ;add pat line y
            os (list (cdr(assoc 45 ed1))(cdr(assoc 46 ed1))) ;existing pat line offset
           osa (angle '(0 0) os)                             ;existing offset angle
           osa (+ (- nha ha) osa)                            ;new offset angle
            os (polar '(0 0) osa (distance '(0 0) os))       ;new pat line offset
           edb (append edb (list(cons 45 (car os))))         ;add offset x
           edb (append edb (list(cons 46 (cadr os))))        ;add offset y
           ed2 (member (assoc 79 ed1)ed1)
           ed1 (cdr ed1)
         count (+ 1 count)
     )
     (if(/= count nol)
       (while(/= 53 (caar ed2))
         (setq ed3 (list(car ed2))
               ed2 (cdr ed2)
               edb (append edb ed3)
         );setq
       );while
     );if
   );repeat
   (setq ed2 (cdr(member(assoc 46 ed1)ed1)))
   (setq edb (append edb ed2))
  (setq ed edb)
  (entmod ed)
  (entupd e1)
  ));progn

  ((= "DIMENSION" (cdadr ed))
  (progn
   (setq pt (list (cadr(assoc 11 ed)) (caddr(assoc 11 ed)))
         ed (subst(cons 53 (getangle pt "Pick Text Angle"))(assoc 53 ed)ed))
  (entmod ed)
  ));progn

  ((or(= "TEXT" (cdadr ed))(= "MTEXT" (cdadr ed)))
  (progn
    (setq ang (angtos (cdr (assoc 50 ed))0 3))
    (prompt (strcat "\nCurrent Angle is <" ang "> "))
    (if(or(= "MTEXT" (cdadr ed))(=(+(cdr(assoc 72 ed))(cdr(assoc 73 ed)))0))
      (setq pt (list (cadr(assoc 10 ed)) (caddr(assoc 10 ed))))
      (setq pt (list (cadr(assoc 11 ed)) (caddr(assoc 11 ed))))
    )
    (setq ed (subst(cons 50 (getangle pt "\nPick or Enter new angle or Enter to pick two points for direction..."))
                   (assoc 50 ed)ed))
    (if(=(cdr(assoc 50 ed))nil)
      (setq pt (getpoint "\nPick two points for direction...")
            ed (subst(cons 50 (getangle pt "\nPick new direction..."))
                   (assoc 50 ed)ed))
    )
  (entmod ed)
  ));progn

  ((= "INSERT" (cdadr ed))
  (progn
   (setq en1 (nentselp "go get it" pt))
   (setq e1 (car en1))  ;entinty name
   (setq ed (entget e1)) ;entinty list
   (if(/= "ATTRIB" (cdadr ed))
     (progn
       (setq ed (entget (car en))
            ang (angtos (cdr (assoc 50 ed))0 3)
             pt (list (cadr(assoc 10 ed)) (caddr(assoc 10 ed)))
       ); setq
       (prompt (strcat "\nCurrent Angle is <" ang "> "))
       (setq ed(subst(cons 50 (getangle pt "Pick or Enter Block new Angle..."))
                     (assoc 50 ed)ed))
     );progn
     (progn
       (setq ang (angtos (cdr (assoc 50 ed))0 3)
              pt (list (cadr(assoc 10 ed)) (caddr(assoc 10 ed)))
       ); setq
       (prompt (strcat "\nCurrent Angle is <" ang "> "))
       (setq ed(subst(cons 50 (getangle pt "Pick or Enter new Attribute Angle..."))
                     (assoc 50 ed)ed))
     );progn
   );if
  (entmod ed)
  (entupd e1)
  ));progn

  (en(command "_rotate" en))

  (t(command "_rotate"))

 );cond
 (setvar "angbase" oldab)
 (setq ss nil)
 (princ)
)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...