Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reactor lisp for rotating plain text in a block

Status
Not open for further replies.

vbcad

Technical User
Jul 12, 2002
159
US
I have a reactor lisp obtained from another website, (author was not given) It works great for attributes but I am trying to figure out how to use it for plain text in a block as well. Any ideas how this can be modified to rotate the text and attributes back to zero? below is the code.
Code:
(defun Attributs_ini(Rea Cde)
  (setq dernier_ent (entlast))
)
(defun Attributs_rot_0(Rea Cde / bl js i n)
  (cond
    ((eq (car Cde) "EXECUTETOOL")
      (setq js (ssget "_L"))
    )
    ((eq (car Cde) "ROTATE")
      (setq js (ssget "_p"))
    )
    ((eq (car Cde) "MIRROR")
      (setq js (ssget "_p"))
    )
    ((eq (car Cde) "GRIP_ROTATE")
      (setq js (cadr (ssgetfirst)))
    )
    ((eq (car Cde) "GRIP_MIROR")
      (setq js (cadr (ssgetfirst)))
    )
;    ((eq (car Cde) "INSERT")
;      (setq js (ssadd))
;      (ssadd (entlast) js)
;    )
;    ((eq (car Cde) "COPY")
;      (setq js (ssadd) n (entnext dernier_ent))
;      (while n
;        (ssadd n js)
;        (setq n (entnext n))
;      )
;    )
;    ((eq (car Cde) "UCS")
;      (setq js (ssget "x" (list (cons 0 "INSERT"))))
;    )
  )
  (if js
    (progn
      (setq n 0)
      (while (ssname js n)
        (setq bl (entget (ssname js n)))
        (if (eq (cdr (assoc 0 bl)) "INSERT")
          (if (cdr (assoc 66 bl))
            (progn
              (while (not (eq (cdr (assoc 0 bl)) "SEQEND"))
                (if (eq (cdr (assoc 0 bl)) "ATTRIB")
                  (progn
                    (setq bl (subst (cons 50 0) (assoc 50 bl) bl))
                    (entmod bl)
                    (entupd (cdr (assoc -1 bl)))
                  )
                )
                (setq bl (entget (entnext (cdr (assoc -1 bl)))))
              )
            )
          )
        )
        (setq n (1+ n))
      )
    )
  )
  (princ)
)
(defun c:srot0(/ i j n)
  (if (setq i (vlr-reactors :vlr-Command-Reactor))
    (progn
      (setq n 1 i (nth n (car i)))
      (while i
        (setq j nil)
        (if (or (eq (cdr (car (vlr-reactions i))) 'ATTRIBUTS_ROT_0) (eq (cdr (car (vlr-reactions i))) 'ATTRIBUTS_INI))
          (setq j i)
        )
        (if j
          (vlr-remove j)
          (setq n (1+ n))
        )
        (if (setq i (vlr-reactors :vlr-Command-Reactor))
          (setq i (nth n (car i)))
        )
      )
      (if mrea_rot0
        (princ "\n\tDisable angle 0 of the Attributes")
      )
      (setq mrea_rot nil)
    )
  )
  (princ)
)
(defun c:rot0()
  (if (not mrea_rot0)
    (progn
      (c:srot0)
      (vlr-command-reactor nil '((:vlr-commandwillstart . Attributs_ini)))
      (setq mrea_rot0 (vlr-command-reactor nil '((:vlr-commandEnded . Attributs_rot_0))))
      (princ "\n\tEnable angle 0 of the Attributes")
    )
    (princ "\n\tAngle 0 of the Attributes is ready")
  )
  (princ)
)
(vl-load-com)
(princ (strcat "\n\tFor enable angle 0 of the Attributes, command ROT0.\n\tfor backward, command SROT0."))
(princ)
 
So you want to rotate text that is part of the main block definition? That would be a change to the block definition, changing all occurrences (inserts) of the block.

Perhaps a dynamic block is called for to handle this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top