Squirltech 发表于 2022-7-6 07:39:55

Another "First" - Text to Line

I have a co-worker looking for a way to make certain strings of text into linework. Is this even possible? I thought there might be a LISP routine out there that does something like this.
 
Example: Carthage County Line =---- -- ---- -- ---- -- ---- (or something)

BlackBox 发表于 2022-7-6 07:44:37

... Not sure I fully understand what you're requesting; perhaps this is what you're after?
 
http://apps.exchange.autodesk.com/ACD/Detail/Index?id=appstore.exchange.autodesk.com%3aText-to-Geometry%3aen

Squirltech 发表于 2022-7-6 07:50:19

Thanks RenderMan but I'm not looking for the lines that make up the text to become linework.
 
I'm wanting something to read "County Line" and make a line in the drawing with a phantom linetype. I don't even know if something like this is even possible?

BlackBox 发表于 2022-7-6 07:56:53

You want "County Line" to be the command, or something found in the drawing... I am still not understanding.
 
If I am understanding you correctly, you're wanting a routine to detect a *Text entity that includes (or consists of) "County Line" in the Objects TextString, and then you want the code to create a *Line entity within the drawing's ModelSpace? Where?
 
Perhaps a before and after pic would help? More information is needed, methinks.

Squirltech 发表于 2022-7-6 08:00:15

 
This is exactly what I'm looking for! Is this possible? Again, this is more of a curiosity than a necessity.

Tyke 发表于 2022-7-6 08:03:32

Is this something like in a drawing legend? Could the start point of the line be a set vertical and horizontal offset from the insertion point of the text and the line a set length? Or does the line need start and end points?

Lee Mac 发表于 2022-7-6 08:06:48

Maybe something like this?
 

;; Text Linetype-Lee Mac;; Creates and loads a custom linetype containing the specified text.;; The linetype will use the Standard TextStyle in the linetype definition.;; The space between dashes in the linetype is calculated based on the number of;; characters in the supplied string, with an additional spacing of 0.05 drawing units.;; Using a monospace font for the linetype will produce the best results.(defun c:txtlt ( / *error* des str tmp val var )   (defun *error* ( msg )       (mapcar 'setvar var val)       (if (= 'file (type des))         (close des)       )       (if (and tmp (findfile tmp))         (vl-file-delete tmp)       )       (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))         (princ (strcat "\nError: " msg))       )       (princ)   )      (cond       (   (= "" (setq str (getstring t "\nSpecify Text for Linetype: "))))       (   (null               (and                   (setq tmp (vl-filename-mktemp nil nil ".lin"))                   (setq des (open tmp "w"))                   (write-line (strcat "*" str "," str " ----" str "----" str "----") des)                   (write-line (strcat "A,.5,-.05,[\"" str "\",STANDARD,S=.1,R=0.0,X=0.0,Y=-.05]," (rtos (- (/ (strlen str) -10.0) 0.05) 2 1)) des)                   (not (setq des (close des)))                   (findfile tmp)               )         )         (princ "\nUnable to create custom linetype definition.")       )       (   (progn               (setq var '(cmdecho expert)                     val(mapcar 'getvar var)               )               (mapcar 'setvar var '(0 5))               (command "_.-linetype" "_L" "*" tmp "")               (mapcar 'setvar var val)               (vl-file-delete tmp)               (tblsearch "LTYPE" str)         )         (princ (strcat "\n" str " linetype created successfully."))       )       (   (princ (strcat "\nUnable to load linetype " str)))   )   (princ))(princ)Or have I misunderstood?

Squirltech 发表于 2022-7-6 08:12:24


 
Does this help?
 
Select "COUNTY LINE" and from that, create a line/polyline at a certain length with a PHANTOM linetype. (Just as an example)

Squirltech 发表于 2022-7-6 08:16:14

 
Thanks Lee! That works pretty slick but not exactly what I'm looking for.

Squirltech 发表于 2022-7-6 08:19:47

 
It would be really handy for creating a legend Tyke! I hadn't thought of that but it's a great idea.
页: [1] 2
查看完整版本: Another "First" - Text to Line