Tharwat Posted September 20, 2010 Posted September 20, 2010 Hello I wonder why this routine is not working for multiple selected Mtexts ! It would implement only on one mtext. (defun c:TESt (/ ss) (if (setq ss (ssget '((0 . "MTEXT")))) ((lambda (i / e ins end ang dis) (setq e (entget (ssname ss (setq i (1+ i))))) (setq ins (cdr (assoc 10 e))) (setq end (cdr (assoc 42 e))) (setq ang (cdr (assoc 50 e))) (setq dis (polar ins ang end)) (entmakex (list (cons 0 "LINE") (cons 10 ins) (cons 11 dis) ))) -1 ) (alert "Nothing's Selected") ) (command "_.erase" ss "") (princ) ) Many thanks. Tharwat Quote
alanjt Posted September 20, 2010 Posted September 20, 2010 You aren't stepping through the selection set. ((lambda (i / e ins end ang dis) (setq e (entget (ssname ss (setq i (1+ i))))) (setq ins (cdr (assoc 10 e))) You need to use while or repeat. Quote
alanjt Posted September 20, 2010 Posted September 20, 2010 Since you basically have it, here's a bit to chew on... (defun c:Test (/ ss) (if (setq ss (ssget "_:L" '((0 . "MTEXT")))) ((lambda (i / e l p) (while (setq e (ssname ss (setq i (1+ i)))) (setq l (entget e)) (if (entmake (list '(0 . "LINE") (setq p (assoc 10 l)) (cons 11 (polar (cdr p) (cdr (assoc 50 l)) (cdr (assoc 42 l)))) ) ) (entdel e) ) ) ) -1 ) ) (princ) ) Know that this will only work properly on Left justified MText. Quote
Tharwat Posted September 20, 2010 Author Posted September 20, 2010 Thank you so much Alanjt. That was really fantastic. Here is mine after getting the right way from your help... (defun c:TESt (/ ss) (if (setq ss (ssget '((0 . "MTEXT")))) ((lambda (i / ent e ins end ang dis) (while (setq ent (ssname ss (setq i (1+ i)))) (setq e (entget ent)) (setq ins (cdr (assoc 10 e))) (setq end (cdr (assoc 42 e))) (setq ang (cdr (assoc 50 e))) (setq dis (polar ins ang end)) (entmakex (list (cons 0 "LINE") (cons 10 ins) (cons 11 dis) )) (entdel ent))) -1 ) ) (princ) ) I looked for the DXF codes that would help me to get the length of text but without a result. So how to get it as well of mtext ? Many thanks Tharwat Quote
Sweety Posted September 21, 2010 Posted September 21, 2010 A very interseting Thread. Nice Routines Alanjt & Tharwat . I also would like to know how to get the length of Text since in DXf codes are do not include the the end point of Text ? Thankxxxxxxxxxxxxx. Quote
Lt Dan's legs Posted September 21, 2010 Posted September 21, 2010 *FOR BOX* lookup textbox in developer help *AS SHOWN ABOVE* insertion point dxf 10 endpoint dxf 42 angle dxf 50 Quote
Recommended Posts
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.