goldy2000 Posted August 20, 2009 Posted August 20, 2009 Hello!! I have an old lisp which need some reparation....I have 2 text which needs to be divided by line (like shown in picture). Lisp can be like this: - select upper text - select down text - text height - select location where to put Is it possible to make? Anybody have something similiar?? Thanks in advance for any help.... hthc.LSP Quote
CAB Posted August 20, 2009 Posted August 20, 2009 Here is al alternate way. Puts a line above selected text. (defun c:hthc (/ ENT ELST BB LL HT P1 P2) (while (and (setq ent (car (entsel "Selektiraj donji text"))) (setq elst (entget ent)) (= (cdr (assoc 0 elst)) "TEXT") ) (setq bb (textbox (list (assoc -1 elst)))) (setq ll (cdr (assoc 10 elst)) ht (cdr(assoc 40 elst)) p1 (polar ll (/ pi 2) (* ht 1.333)) p2 (polar p1 0 (abs (- (caadr bb)(caar bb)))) ) (entmake (list (cons 0 "LINE") (cons 6 "BYLAYER") (cons 8 "linija") (cons 10 p1) (cons 11 p2) ) ) ) (princ) ) Quote
Lee Mac Posted August 20, 2009 Posted August 20, 2009 Another option: (defun c:fract (/ tEnt1 tEnt2 tEnt) (vl-load-com) (and (setq tEnt1 (car (entsel "\nSelect Upper Text: "))) (eq "TEXT" (cdadr (entget tEnt1))) (setq tEnt2 (car (entsel "\nSelect Lower Text: "))) (eq "TEXT" (cdadr (entget tEnt2))) (setq tEnt (M-Text '(0 0 0) (strcat "\{\\H0.7x;\\S" (cdr (assoc 1 (entget tEnt1))) "/" (cdr (assoc 1 (entget tEnt2))) ";}"))) (command "_.move" tEnt "" '(0 0 0) pause)) (princ)) (defun M-Text (pt val) (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 pt) (cons 1 val)))) Quote
goldy2000 Posted August 21, 2009 Author Posted August 21, 2009 Thanks CAB for your time, but don't quite understand your lisp, it ask me to select down text and then it puts upper line nad nothing after that, or I'm wrong?? Quote
goldy2000 Posted August 21, 2009 Author Posted August 21, 2009 Hello Lee, good idea for lisp, is it possible that final product is made from (single line text - line - single line text) because I would probably need to write numbers so it is easier to manipulate with text..and to see about text height? thx.. Quote
CAB Posted August 21, 2009 Posted August 21, 2009 Thanks CAB for your time, but don't quite understand your lisp, it ask me to select down text and then it puts upper line nad nothing after that, or I'm wrong?? Had no idea what or why you were moving objects. Not clear if you wanted to move the line or the text or all the above. Rather than guess I left that part for you to implement. I just gave you a way to create the line based on the Text Size selected & place the line above that selected text at a mid point where the gap would normally appear when continued plain text is created. Perhaps if you would explain the intent of the "MOVE" part of your routine? Quote
Lee Mac Posted August 21, 2009 Posted August 21, 2009 Hello Lee, good idea for lisp, is it possible that final product is made from (single line text - line - single line text) because I would probably need to write numbers so it is easier to manipulate with text..and to see about text height? thx.. That is a completely different program from that which I have provided - not a quick modification. Quote
goldy2000 Posted August 21, 2009 Author Posted August 21, 2009 That is a completely different program from that which I have provided - not a quick modification. No problem, I supposed it is little bit complicated..Dont waste your time for that, is it possible to make something different, maybe to select text and put one under other, and after that I will manually put line between it? :wink: Quote
alanjt Posted August 21, 2009 Posted August 21, 2009 No problem, I supposed it is little bit complicated..Dont waste your time for that, is it possible to make something different, maybe to select text and put one under other, and after that I will manually put line between it? :wink: just explode the mtext, you'll get 2 piece of dtext and a line. Quote
Glen Smith Posted August 21, 2009 Posted August 21, 2009 Can you not just use MTEXT with the top line set with an underscore font? You could even build a block which is just 2 attributes, the top one with its font set as underscore. Then you can export using ATTOUT. Or maybe I don't understand what you are trying to do. Glen Quote
Lee Mac Posted August 21, 2009 Posted August 21, 2009 Didn't know you could explode to get that Alan, well, this then maybe: (defun c:fract (/ tEnt1 tEnt2 tEnt) (vl-load-com) (and (setq tEnt1 (car (entsel "\nSelect Upper Text: "))) (eq "TEXT" (cdadr (entget tEnt1))) (setq tEnt2 (car (entsel "\nSelect Lower Text: "))) (eq "TEXT" (cdadr (entget tEnt2))) (setq tEnt (M-Text '(0 0 0) (strcat "\{\\H0.7x;\\S" (cdr (assoc 1 (entget tEnt1))) "/" (cdr (assoc 1 (entget tEnt2))) ";}"))) (not (command "_.move" tEnt "" '(0 0 0) pause)) (command "_.explode" tEnt)) (princ)) (defun M-Text (pt val) (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 pt) (cons 1 val)))) Quote
alanjt Posted August 21, 2009 Posted August 21, 2009 just explode the mtext, you'll get 2 piece of dtext and a line. lol, i never thought i'd quote myself. not pretty, but this would work. (defun c:fract (/ tEnt1 tEnt2 tEnt) (and (setq tEnt1 (car (entsel "\nSelect Upper Text: "))) (eq "TEXT" (cdadr (entget tEnt1))) (setq tEnt2 (car (entsel "\nSelect Lower Text: "))) (eq "TEXT" (cdadr (entget tEnt2))) (setq tEnt (M-Text '(0 0 0) (strcat "\{\\H0.7x;\\S" (cdr (assoc 1 (entget tEnt1))) "/" (cdr (assoc 1 (entget tEnt2))) ";}"))) [color=Red] (not (command "_.move" tEnt "" '(0 0 0) pause)) (command "_.explode" tEnt))[/color] (princ)) (defun M-Text (pt val) (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 pt) (cons 1 val)))) i also took out the (vl-load-com) Quote
alanjt Posted August 21, 2009 Posted August 21, 2009 haha, i didn't see you had posted a response. thought it might be a nice little shortcut. Didn't know you could explode to get that Alan, well, this then maybe: (defun c:fract (/ tEnt1 tEnt2 tEnt) (vl-load-com) (and (setq tEnt1 (car (entsel "\nSelect Upper Text: "))) (eq "TEXT" (cdadr (entget tEnt1))) (setq tEnt2 (car (entsel "\nSelect Lower Text: "))) (eq "TEXT" (cdadr (entget tEnt2))) (setq tEnt (M-Text '(0 0 0) (strcat "\{\\H0.7x;\\S" (cdr (assoc 1 (entget tEnt1))) "/" (cdr (assoc 1 (entget tEnt2))) ";}"))) (not (command "_.move" tEnt "" '(0 0 0) pause)) (command "_.explode" tEnt)) (princ)) (defun M-Text (pt val) (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 pt) (cons 1 val)))) Quote
Lee Mac Posted August 21, 2009 Posted August 21, 2009 haha.. both are almost identical... great minds think alike eh.. not sure why I had vl-load-com in there... I think I was going to use vla-addMText at one point and forgot to take it out Quote
goldy2000 Posted August 21, 2009 Author Posted August 21, 2009 Had no idea what or why you were moving objects. Not clear if you wanted to move the line or the text or all the above. Rather than guess I left that part for you to implement. I just gave you a way to create the line based on the Text Size selected & place the line above that selected text at a mid point where the gap would normally appear when continued plain text is created. Perhaps if you would explain the intent of the "MOVE" part of your routine? This lisp is written by my friend couple of years ago, so he gave me it to use, but it doedn't fits me, so I cannot give you answer about it, as I dont know to write lisp, sorry, but my question was to select text and to put on exact place (with mouse pointer). I like your start of lisp, when select down text it puts line up, thanks for your effort!!! Quote
alanjt Posted August 21, 2009 Posted August 21, 2009 haha.. both are almost identical... great minds think alike eh.. not sure why I had vl-load-com in there... I think I was going to use vla-addMText at one point and forgot to take it out verbatim actually, lol. i guess so. i figured you were going that route originally, just thought i'd take it out. Quote
goldy2000 Posted August 21, 2009 Author Posted August 21, 2009 Thanks a lot people, you helped me a lot!!! How about text size, is it changeable in the lisp? Every time it shows in 0.07 height? hmmmm... Quote
goldy2000 Posted August 21, 2009 Author Posted August 21, 2009 But great solution to explode it, I never supposed that Mtext could explode in that way....clever idea.. Quote
Lee Mac Posted August 21, 2009 Posted August 21, 2009 Thanks a lot people, you helped me a lot!!! How about text size, is it changeable in the lisp? Every time it shows in 0.07 height? hmmmm... It just goes on the TextSize set out in your Standard Text Style, you can add more lines to the entmakex list if you want to stray from default values. But great solution to explode it, I never supposed that Mtext could explode in that way....clever idea.. I didn't realise either - good to know though Quote
alanjt Posted August 21, 2009 Posted August 21, 2009 It just goes on the TextSize set out in your Standard Text Style, you can add more lines to the entmakex list if you want to stray from default values. I didn't realise either - good to know though i know posted this one on here eons ago, but who cares: (defun makeMTEXT (pt txt width txtsize / entl) (setq entl (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") (cons 10 pt) (cons 40 txtsize) (cons 41 width) '(71 . 1) ; Attachment point '(72 . 5) ; Drawing Direction (cons 1 txt) (cons 7 (getvar "TEXTSTYLE")) '(11 1.0 0.0 0.0) (cons 42 txtsize) (cons 43 txtsize) '(50 . 0.0) ) ) (entmake entl) ) 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.