As requested, here are some quickly written LISP routines....
Originally Posted by
Rroger_D
1) Quick rotate text - in other words, simply click the text and click somewhere in space to rotate it. It will always automatically use it's insert point as the base point. and:
Quick Rotate Text:
Code:
(vl-load-com)
(defun c:QuickRotateText (/ *error* ss v pt ang acDoc)
(defun *error* (msg)
(cond ((not msg)) ; Normal exit
((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit)
((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it
)
(princ)
)
(while
(and
(setq ss (ssget ":S:E:L" '((0 . "MTEXT,TEXT"))))
(setq v (vlax-ename->vla-object (ssname ss 0)))
(setq ang
(acet-ss-drag-rotate
ss
(trans
(setq pt
(vlax-get
v
(cond
((= "AcDbMText" (vla-get-objectname v))
'insertionpoint
)
(T 'textalignmentpoint)
)
)
)
0
1
)
T
)
)
(or acDoc
(setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
)
)
(vla-startundomark acDoc)
(vla-rotate v (vlax-3d-point pt) ang)
(vla-endundomark acDoc)
)
(*error* nil)
)
Originally Posted by
Rroger_D
2) Quick move and rotate - similarly, select text, place somwhere, then click in space for it's orientation. Always using insert point as base point. IE without having to move/enter/select/enter/base point/destination/rotate/enter/base/rotation.
Quick Move And Rotate Text:
Code:
(vl-load-com)
(defun c:QuickMoveRotateText (/ *error* ss v pt1 pt2 acDoc ang)
(defun *error* (msg)
(cond ((not msg)) ; Normal exit
((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit)
((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it
)
(princ)
)
(while
(and
(setq ss (ssget ":S:E:L" '((0 . "MTEXT,TEXT"))))
(setq v (vlax-ename->vla-object (ssname ss 0)))
(setq pt2
(acet-ss-drag-move
ss
(trans
(setq pt1
(vlax-get
v
(cond
((= "AcDbMText" (vla-get-objectname v))
'insertionpoint
)
(T 'textalignmentpoint)
)
)
)
0
1
)
"\nSpecify second point: "
T
)
)
(or acDoc
(setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
)
)
(vla-startundomark acDoc)
(vlax-invoke v 'move pt1 pt2)
(if (setq ang (acet-ss-drag-rotate ss (trans pt2 0 1) T))
(vla-rotate v (vlax-3d-point pt2) ang)
)
(vla-endundomark acDoc)
)
(*error* nil)
)
For completeness, here's another....
Quick Copy And Rotate Text:
Code:
(vl-load-com)
(defun c:QuickCopyRotateText (/ *error* ss v pt1 pt2 acDoc oText ang)
(defun *error* (msg)
(if oText (vla-delete oText))
(cond ((not msg)) ; Normal exit
((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit)
((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it
)
(princ)
)
(while
(and
(setq ss (ssget ":S:E:L" '((0 . "MTEXT,TEXT"))))
(setq v (vlax-ename->vla-object (ssname ss 0)))
(setq pt2
(acet-ss-drag-move
ss
(trans
(setq pt1
(vlax-get
v
(cond
((= "AcDbMText" (vla-get-objectname v))
'insertionpoint
)
(T 'textalignmentpoint)
)
)
)
0
1
)
"\nSpecify second point: "
T
)
)
(or acDoc
(setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
)
)
(vla-startundomark acDoc)
(vlax-invoke (setq oText (vla-copy v)) 'move pt1 pt2)
(setq ss nil ss (ssadd (vlax-vla-object->ename oText)))
(if (setq ang (acet-ss-drag-rotate ss (trans pt2 0 1) T))
(progn
(vla-rotate oText (vlax-3d-point pt2) ang)
(vla-endundomark acDoc)
)
(vla-delete oText)
)
(setq oText nil)
)
(*error* nil)
)
Cheers