joemcanciller Posted December 13, 2018 Share Posted December 13, 2018 Hello guys, I'm here again asking for help to this routine. I want to copy the text in the leader and paste it on the table cells in this manner (See photos): 1. pick leader with text 2. select cell 1 to paste the first line of text with. 3. select cell 2 to paste the second line of text with. 4. select cell 3 to paste the third line of text with. and so on and so forth. I have this code in mleader, i dont know if it will help. This leader comes from combination of block attributes and dimension entities. (defun gav ( blk tag / val enx ) (while (and (null val) (setq blk (entnext blk)) (= "ATTRIB" (cdr (assoc 0 (setq enx (entget blk))))) ) (if (= (strcase tag) (strcase (cdr (assoc 2 enx)))) (setq val (cdr (assoc 1 (reverse enx)))) ) ) ) (defun c:pp() (setq obj (car(entsel "\nSelect Object: "))) (setq dim1(entget (car(entsel "\nSelect Dimension: ")))) (setq dimval1(cdr (assoc 42 dim1))) (setq d (strcat (rtos dimval1 2 2))) (setq dim2(entget (car(entsel "\nSelect Dimension: ")))) (setq dimval2(cdr (assoc 42 dim2))) (setq e (strcat (rtos dimval2 2 2))) (setq c (gav obj "LWI-0000")) (setq b (gav obj "CL")) (setq a (cdr(assoc 2 (entget obj)))) (setq txt (strcat a "\n" b "\n" c "\n" d "\n" e)) (setvar "cmleaderstyle" "PP") (command "_mleader" pause pause txt "") ) BTW. I used the getattributevalue for block entities created by @Lee Mac. Thanks to this. It really helped me a lot. Thanks in advance. PS: Please do it as simple as my code. Im new learning this lisp thing. Thanks ^^. hehe Quote Link to comment Share on other sites More sharing options...
Steven P Posted December 13, 2018 Share Posted December 13, 2018 If you look at Lee Macs Copy or Swap text which might give you a start ( http://www.lee-mac.com/copytext.html ) Using it, if you create your table and complete each row with something (for example a '.' or a '-'), copy the multileader and explode the text twice (to give just plain text, not mtext) and then use Lees Copy Text selecting each line of text from the copied-and-exploded multileader and put into the appropriate table cell. Someone will be cleverer than me and work out how to split up the multileader text into individual lines and paste them where you want, but this LISP might help you on your way Quote Link to comment Share on other sites More sharing options...
joemcanciller Posted December 13, 2018 Author Share Posted December 13, 2018 1 hour ago, Steven P said: If you look at Lee Macs Copy or Swap text which might give you a start ( http://www.lee-mac.com/copytext.html ) Using it, if you create your table and complete each row with something (for example a '.' or a '-'), copy the multileader and explode the text twice (to give just plain text, not mtext) and then use Lees Copy Text selecting each line of text from the copied-and-exploded multileader and put into the appropriate table cell. Someone will be cleverer than me and work out how to split up the multileader text into individual lines and paste them where you want, but this LISP might help you on your way thanks @Steven P. That would be possible, but it takes time to click back and forth. Maybe my last resort. hehe Quote Link to comment Share on other sites More sharing options...
joemcanciller Posted December 13, 2018 Author Share Posted December 13, 2018 Btw. I used data extraction. But it gives me this since it only have 1 content. Is it possible to break it as individual content to have distinct cells for each content? Thanks. :) Quote Link to comment Share on other sites More sharing options...
Steven P Posted December 13, 2018 Share Posted December 13, 2018 You could have a look at this - its not perfect and you might need to add things like checking you select text but it sort of works on my machine here. Also you need to get Lee Macs String to List routing ( LM:str->lst ) and put that in the same file (defun c:splitmtexts( / mytxt txtlst txtlen acount newtxt) ;;add in here check if you hit a text or not (setq mytext (vla-get-TextString(vlax-ename->vla-object (car (entsel))))) (setq txtlst (LM:str->lst mytext "\\P")) (setq txtlen (length txtlst)) (setq acount 0) (princ txtlst) ;;write to table items (while ( < acount txtlen) (setq newtxt (nth acount txtlst)) (setq ent (car (nentsel "\nSelect Table Text Letter:"))) (setq entlst (entget ent)) ;;check here if you hit text object (setq entlst (subst (cons 1 newtxt) (assoc 1 entlst) entlst)) (entmod entlst) (entupd ent) (princ newtxt) (setq acount (+ 1 acount)) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
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.