pavilon Posted August 25, 2015 Share Posted August 25, 2015 I have a dcl and a lisp that list all text and mtext in a drawing and I want to delete selected texts on the list by Delete button on DCL but I need to resolve(if possible): 1) My first goal to delete multiple texts by selection does not work! I get an error of : error: bad argument type: consp nil 2) Overwriting duplicated texts or group similar texts 3) Sorting out text from A_Z , 0-9, etc. 4) how can stay in dialogue until I finish erasing desired texts? Now it closing dialogue(although delete not working properly) attached is my lisp and dcl. Thanks deltext.dcl DELTEXT.LSP Quote Link to comment Share on other sites More sharing options...
rlx Posted August 25, 2015 Share Posted August 25, 2015 I have not read your lisp file (yet) , things 2 do you know, but as for point 3 in your wishlist , I think you need to hide your dialog because erasing texts mean updating your display and that is forbidden when a dialog is active. Gr. Rlx Quote Link to comment Share on other sites More sharing options...
rlx Posted August 25, 2015 Share Posted August 25, 2015 (edited) Just had a quick look during my break and your code stops at (nth item t_lst) because t_lst is nil. Do you mean (nth item l) instead of t_lst ? ... as in (setq l (_list_texts)) gr.Rlx Edited August 25, 2015 by rlx Quote Link to comment Share on other sites More sharing options...
rlx Posted August 25, 2015 Share Posted August 25, 2015 (edited) Ok , my boss is gonna kill me for not having this drawings ready yet ;-) but try this : (vl-load-com) ;scan for string (defun sfs ( %p1 %p2 / ss i enum etyp elist) (if (setq elist '() i 0 ss (ssget "c" %p1 %p2)) (while (setq enum (ssname ss i)) (setq etyp (cdr (assoc 0 (entget enum)))) (if (member etyp '("TEXT" "MTEXT"))(setq elist (append elist (list enum)))) (setq i (1+ i)))) elist ) (defun rdup ( i / o );remove duplicates (vl-remove-if '(lambda (x) (cond ((vl-position x o) t) ((setq o (cons x o)) nil))) i)) (defun rlx_deltxt ( / txt-ent-list stringlist ent) (setq txt-ent-list (sfs (getvar "extmin") (getvar "exmax"))) (setq stringlist (rdup retlist)) (foreach ent txt-ent-list (if (member (vla-get-textstring ent) stringlist) (entdel ent)))) your retlist can contain duplicates so i remove them first. with sfs (scan for string) i scan the entire dwg for text / mtext finaly i test each (m)text entity if it contains one of the selected strings and if it does it will be deleted. I haven't tested it yet gr. Rlx Edited August 25, 2015 by rlx Quote Link to comment Share on other sites More sharing options...
rlx Posted August 25, 2015 Share Posted August 25, 2015 (if (= (start_dialog) 1) (progn (do_atn) (unload_dialog dcl_id) (princ "\nTexts Deleted ..:\n") (princ retlist) (princ) ) ) BTW , add just add my code to your lsp and replace (do_atn) at the end of your code with (rlx_deltxt) gr. Rlx Quote Link to comment Share on other sites More sharing options...
pavilon Posted August 27, 2015 Author Share Posted August 27, 2015 Ohh..i didn't get notification and did not realize you fixed that. Thank you very much for your time and hope you are still well Quote Link to comment Share on other sites More sharing options...
rlx Posted August 28, 2015 Share Posted August 28, 2015 Actually , my 'boss' is sick @ home right now (problems with his back) so no problem there ;-) Hope your app works now gr. Rlx Quote Link to comment Share on other sites More sharing options...
catoscuro Posted September 4, 2015 Share Posted September 4, 2015 Hello Pavilon, could you update your routine with rlx considerations, I understand very little lisp and not achieving it work. Thank you 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.