Hi All,
I have been using this old trusty bit of botched code for a while now and it really needs updating. The issue is I'm not experienced enough to put the bits together.
Here is the original. It asks for the text to be selected then moved 100 from the justification point using the users point selection (I have one for top right & bottom)
;move text to left of object
(defun c:MOVETXTLFT()
(setvar "cmdecho" 0)
(setq ST (entsel "\nSelect text to justify: "))
(while
(= ST nil)
(progn
(prompt "\nText was not selected...")
(setq ST (entsel "\nSelect text to justify: "))
)
)
(setq PS (getpoint "\nPick point to justify to: "))
(command "justifytext" ST "" "ML")
(setq TML (cdr (assoc 11 (entget (car ST)))))
(command "move" ST "" TML PS)
(command "move" st "" "0,0" "@100<0")
(princ)
)
The issue is it doesn't recognise Mtext. If you happen to select Mtext it disappears off the screen.
I know roughly how to fix it but I’m struggling with integrating the vba stuff.... Looking at other lisp routines I think it can be done with bits of the below.
(if (setq i -1 ss (ssget "_:L" '((0 . "MTEXT,TEXT"))))
(while (setq ent (ssname ss (setq i (1+ i))))
(setq obj (vlax-ename->vla-object ent))
(if (eq "AcDbText" (vla-get-ObjectName obj))
(if (eq AcAlignmentLeft (vla-get-Alignment obj))
(progn
(setq tmp (vla-get-InsertionPoint obj))
(vla-put-Alignment obj acAlignmentMiddleCenter)
(vla-put-TextAlignmentPoint obj tmp))
(vla-put-Alignment obj acAlignmentMiddleCenter))
(vla-put-AttachmentPoint obj acAttachmentPointMiddleCenter))
(setq pt (vlax-get obj
(setq prop
(if (eq "TEXT" (cdr (assoc 0 (entget ent))))
'TextAlignmentPoint 'InsertionPoint))))
Any help would be greatly appreciated!