Rotate block?

Discussion in 'AutoCAD' started by taylor2k3, May 11, 2004.

  1. taylor2k3

    taylor2k3 Guest

    How can i rotate a block about its basepoint using a macro, just want to
    click button and block then rotates 180 degrees about its basepoint.

    thanks
     
    taylor2k3, May 11, 2004
    #1
  2. You can try this out:

    (defun c:rb (/ c ss ang flag a ename ent)

    (setq c (getstring "\nBlock name or ENTER to select items: ")
    ss (if (= c "") (ssget) (ssget "X" (list (cons 2 c))) )
    flag nil c 0)
    (initget "New")
    (prompt "\nEnter NEW for new rotation angle or enter amount to rotate;")
    (setq ang (getangle "\n\nNEW/<Angle to rotate>: "))
    (if (= ang "New") (setq flag T ang (getangle "\nNew angle: ")))
    (repeat (sslength ss)
    (setq ent (entget (setq ename (ssname ss c))) c (1+ c))
    (if (= "INSERT" (field 0 ent))
    (command "rotate" ename "" (field 10 ent)
    (rtd (if (not flag) ang (- ang (field 50 ent)) ))))
    )
    (princ))

    (defun FIELD (val ent) (cdr (assoc val ent)))
     
    Allen Johnson, May 11, 2004
    #2
  3. taylor2k3

    Jim Claypool Guest

    (defun c:rotblk ()
    (while (not (setq ename (entsel "\nSelect block to rotate: "))))
    (setq
    ename (car ename)
    ent (entget ename)
    )
    (if (= (cdr (assoc 0 ent)) "INSERT")
    (progn
    (setq
    pt (cdr (assoc 10 ent))
    ang (cdr (assoc 50 ent))
    )
    (setq ang (if (<= ang pi) (+ ang pi) (- ang pi)))
    (setq ent (subst (cons 50 ang) (assoc 50 ent) ent))
    (entmod ent)
    )
    (alert "Object selcted is not a block")
    )
    (princ)
    )
     
    Jim Claypool, May 11, 2004
    #3
  4. taylor2k3

    Warren Trost Guest

    Problem with rotating a block by the 50 code is if there are any attributes
    include they don't turn. Why not use the rotate command?
     
    Warren Trost, May 11, 2004
    #4
  5. It does....

     
    Allen Johnson, May 11, 2004
    #5
  6. Maybe you are replying to Jim Claypool's post instead?
     
    Allen Johnson, May 11, 2004
    #6
  7. taylor2k3

    Warren Trost Guest

    Sorry for not reading enough to see the "command" "rotate". I only saw the
    50 code. Gotta quit scanning and start reading! ;-)
     
    Warren Trost, May 12, 2004
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.