Jump to content

TEXT TO LINE


pegasus

Recommended Posts

Hi,

I want to explode the text and mtexts written in a certain layer and make a line. The txtexp command both has to make a selection and pulls it to the current layer. Is there any solution about this? Thank you from now.

Link to comment
Share on other sites

 

7 minutes ago, BIGAL said:

Post a image or better yet a dwg.

 

here is an mtext. With the autocad txtexp command, this text takes the properties of whatever layer exists at that moment. I also wrote the texts I want to line in a single layer and I want to select the text, text in that layer.

0.dwg

Link to comment
Share on other sites

;;----------------------------------------------------------------------------;;
;; EXPLODES TEXT AND MOVES TO CURRENT LAYER
(defun C:FOO (/ SS SS1 LastEnt lay)
  (vl-load-com)
  (setq ss1 (ssadd))
  (if (setq SS (ssget))
    (progn
      (setq LastEnt (entlast))
      (command "_.Txtexp" SS "")
      (while (setq LastEnt (entnext LastEnt))
        (ssadd LastEnt SS1)
      )
    )
  )
  (if (> (sslength SS1) 0)
    (progn
      (command "_.CHPROP" SS1 "" "_LA" (getvar 'clayer) "")
    )
  )
  (princ)
)

 

Edited by mhupp
Link to comment
Share on other sites

14 minutes ago, mhupp said:
;;----------------------------------------------------------------------------;;
;; EXPLODES TEXT AND MOVES TO CURRENT LAYER
(defun C:FOO (/ SS SS1 LastEnt lay)
  (vl-load-com)
  (setq ss1 (ssadd))
  (if (setq SS (ssget))
    (progn
      (setq LastEnt (entlast))
      (vl-cmdf "_.Txtexp" SS "")
      (while (setq LastEnt (entnext LastEnt))
        (ssadd LastEnt SS1)
      )
    )
  )
  (if (> (sslength SS1) 0)
    (progn
      (command "_.CHPROP" SS1 "" "_LA" (getvar 'clayer) "")
    )
  )
  (princ)
)

 

sorry, didn't work  

but there is TXTEXP command in Autocad. how does it not detect

 

Select objects:
_.Txtexp Unknown command "TXTEXP".  Press F1 for help.
Command: <Selection set: 639>

Link to comment
Share on other sites

I do not why , fom lisp I get this

 

image.thumb.png.cbf68752a9a45c93c430effd25d7435a.png

 

But from command line TXTEXP. work as expected

 

image.thumb.png.5c24216a92bee20f44bb289f48978d7f.png

 

neither with  

 

image.png.fb73025c9ead9b0e4135196980d78450.png

 

Edited by devitg
add vl-cmdf
  • Like 1
Link to comment
Share on other sites

13 minutes ago, devitg said:

I do not why , fom lisp I get this

 

image.thumb.png.cbf68752a9a45c93c430effd25d7435a.png

 

But from command line TXTEXP. work as expected

 

image.thumb.png.5c24216a92bee20f44bb289f48978d7f.png

 

neither with  

 

image.png.fb73025c9ead9b0e4135196980d78450.png

 

 

 

 

I get the same result with add vl-cmdf . what could be the reason

Link to comment
Share on other sites

Best answer is download "Text 2 geom by Seant", he lingers here at times. He should advise you of correct download link. This will do True Type Fonts as well.

 

 image.png.21dab53f40fac4a80c6615f88436c59b.png

Link to comment
Share on other sites

maybe when the text and mtexts are lines, I should be in that layer with the command and all the selected text,mtexts in the layer I specified should return to the line. But of course it throws an error. where did i go astray?

 

(defun c:fin ( / ss i e)
(setq (ssget 'CLayer (layerName "LAYER1")))
(and
(if (setq ss (ssget "_X" '((0 . "TEXT,MTEXT"))))
(and (wcmatch (vla-get-objectname mdl) "AcDbMText,AcDbText")
              (wcmatch (strcase (vla-get-layer mdl)) "LAYER1"))
         )
)         
    (repeat (setq i (sslength ss))
    (setq e (ssname ss (setq i (1- i))))
       (command-s "_.Zoom" "Object" e "")    
    (sssetfirst nil (ssadd e))(C:TXTEXP)
            )
           )

Link to comment
Share on other sites

1 hour ago, tombu said:

Honestly have no idea what you're trying to do but the quickest and easiest way to create a linetype with text is using ronjonp's "Make Linetype With Embedded Characters": https://www.theswamp.org/index.php?topic=47058.msg520876#msg520876

no actually it is not. I want text and mtexts written in a certain layer to make the selection txtexp. The lines formed should carry the properties of the previous layer, not the current one.

Link to comment
Share on other sites

Try with this

(defun c:my_txtexp ( / ss n ent dxf_ent lay sel lastent next lastent e dxf_e)
  (setq ss (ssget ":L" '((0 . "*TEXT"))))
  (cond
    (ss
      (if (not c:txtexp) (load "txtexp"))
      (repeat (setq n (sslength ss))
        (ssadd)
        (setq
          ent (ssname ss (setq n (1- n)))
          dxf_ent (entget ent)
          lay (cdr (assoc 8 dxf_ent))
          sel (ssadd ent)
          lastent (entlast)
        )
        (sssetfirst nil sel)
        (c:txtexp)
        (if (and lastent (entget lastent))
          (progn
            (setq
              sel nil
              sel (ssadd)
            )
            (while
              (setq next (entnext lastent))
              (ssadd next sel)
              (setq lastent next)
              sel
            )
          )
        )
        (if sel
          (repeat (setq i (sslength sel))
            (setq
              e (ssname sel (setq i (1- i)))
              dxf_e (entget e)
              dxf_e (subst (cons 8 lay) (assoc 8 dxf_e) dxf_e)
              dxf_e (subst (cons 62 256) (assoc 62 dxf_e) dxf_e)
            )
            (entmod dxf_e)
          )
        )
      )
    )
  )
  (prin1)
)

 

  • Like 1
Link to comment
Share on other sites

really thank you for your help @Tsuky. Even in this state, it is very useful to select the text and mtexts in the layer I want with select similar and run this command.

 

16 hours ago, Tsuky said:

Try with this

(defun c:my_txtexp ( / ss n ent dxf_ent lay sel lastent next lastent e dxf_e)
  (setq ss (ssget ":L" '((0 . "*TEXT"))))
  (cond
    (ss
      (if (not c:txtexp) (load "txtexp"))
      (repeat (setq n (sslength ss))
        (ssadd)
        (setq
          ent (ssname ss (setq n (1- n)))
          dxf_ent (entget ent)
          lay (cdr (assoc 8 dxf_ent))
          sel (ssadd ent)
          lastent (entlast)
        )
        (sssetfirst nil sel)
        (c:txtexp)
        (if (and lastent (entget lastent))
          (progn
            (setq
              sel nil
              sel (ssadd)
            )
            (while
              (setq next (entnext lastent))
              (ssadd next sel)
              (setq lastent next)
              sel
            )
          )
        )
        (if sel
          (repeat (setq i (sslength sel))
            (setq
              e (ssname sel (setq i (1- i)))
              dxf_e (entget e)
              dxf_e (subst (cons 8 lay) (assoc 8 dxf_e) dxf_e)
              dxf_e (subst (cons 62 256) (assoc 62 dxf_e) dxf_e)
            )
            (entmod dxf_e)
          )
        )
      )
    )
  )
  (prin1)
)

 

 

Link to comment
Share on other sites

On 1/29/2023 at 6:28 PM, BIGAL said:

Best answer is download "Text 2 geom by Seant", he lingers here at times. He should advise you of correct download link. This will do True Type Fonts as well.

 

 image.png.21dab53f40fac4a80c6615f88436c59b.png

It doesn't work with newer windows and newer Autocad so it was deleted. https://forums.autodesk.com/t5/autocad-forum/text-to-graphics-vector/m-p/9147387#M1000252

Link to comment
Share on other sites

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