Jump to content

Recommended Posts

Posted

This routine extracts text from a dimension, but extracts it as mtext

I would like it to be just text and not mtext

can someone help me

thanks

(defun c:EXC (/ e el p1 p2)


  (if (and (setq e (car (nentsel "\nPick dimension text: ")))
	   (setq p1 (cdr (assoc 10 (setq el (entget e)))))
	   (setq p2 (getpoint p1 "\nSpecify second point: "))
      )
    (entmakex (append (vl-remove-if '(lambda (x) (= 330 (car x))) el) (list (cons 10 p2))))
  )
(setq LastEnt (entlast))

;;;
(setq tx (list
	     "text1"
	     "text2"
             
	     ))
  (setq i -1
	el (entget LastEnt)
	next T)
  (while next
    (setq i (rem (1+ i) (length tx))
	  el (subst (cons 1 (nth i tx)) (assoc 1 el) el)
	  el (entmod el)
	  st (getstring)
	  next (= "" st))
    )
  (setq el (if (> (strlen st) 0) (subst (cons 1 st) (assoc 1 el) el) el)
	el (entmod el))
;;;

(princ)
):

 

 

Posted (edited)

Hi
The easiest way is to explode up the text.
You can add at the end
 

(vla-explode (vlax-ename->vla-object (setq eu (entlast))))
(entdel eu)

 

Edited by GLAVCVS
  • Like 2
  • Thanks 1
Posted (edited)

Another option, more respectful of the original format, could be to replace your Entmakex with this one.

(entmakex
  (foreach as el
    (setq l (if (setq v (cond ((= (setq c (car as)) 0) '(0 . "TEXT"))
			      ((member c '(8 1 40 50 7 72)) as)
			      ((= c 71) (cons c (cadr (assoc (cdr as) '((1 2) (2 1) (3 0) (4 0) (5 0))))))
			      ((= c 73) '(73 . 2))
			      ((member c '(10 11)) (cons c p2))
		        )
	        )
	        (append l (list v))
	        l
	    )
    )
  )
)

 

Edited by GLAVCVS
Code revised to make it a little simpler
  • Like 2
  • Thanks 1
Posted

If you decide on the second option, do not forget to include in the list of local variables, after   (defun c:EXC (/   the new entmakex variables: as l c v

  • Thanks 1
Posted

thank you master

  • Like 1

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...