Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

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.

Posted

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

Posted

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.

Posted

*FOR BOX*

lookup textbox in developer help

 

*AS SHOWN ABOVE*

insertion point dxf 10

endpoint dxf 42

angle dxf 50

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...