rkent Posted August 27, 2018 Posted August 27, 2018 I have used this lisp file for a long time, modifying it over the years but now I can't get it to work with an attribute block. I want it to call ATTEDIT when an attribute block is selected. This is from 1994 so I am sure there are more elegant ways to do this code but if this can be quickly patched that would be good enough for me. ; TIP1011.LSP: ME.LSP Multiple Editing (c)1994, Gary Goode ;;;modified 4.9.2003 to include mtext, dimensions, attdef and arctext ;This program will let you pick and edit multi text and attributes ;by window, pick or crossing using dialog boxes. ;modified to use textedit ;----------------------------------------------------------------- (defun C:ME (/ A B C D E F G H J K L M N P R) (graphscr) (setvar "CMDECHO" 0) (setvar "HIGHLIGHT" 1) (prompt "\nMulti-Edit is loaded ... ") (setq A (ssget) B (sslength A) C 0) (while (< C B) (setq D (ssname A C) E (entget D)) (setq F (car E)) (setq G (cdr E)) (setq H (car G)) (setq J (cdr H)) (setq K "TEXT") (setq L "INSERT") (setq M "DIMENSION") (setq N "MTEXT") (setq P "ATTDEF") (setq R "ARCALIGNEDTEXT") ;;updated with next section using textedit for most objects (if (= J K)(command ".TEXTEDIT" D "")) (if (= J L)(command ".ATTEDIT" D "")) (if (= J N)(command ".TEXTEDIT" D "")) (if (= J M)(command ".TEXTEDIT" D "")) (if (= J P)(command ".TEXTEDIT" D "")) (if (= J R)(command ".ARCTEXT" D "")) (setq C (1+ C))) (princ) ); end me.lsp Thanks for any help you can provide. Quote
Lee Mac Posted August 27, 2018 Posted August 27, 2018 (edited) Try something like this: (defun c:me ( / e i l s ) (setq l '( ("ATTDEF" . "_.TEXTEDIT") ("INSERT" . "_.ATTEDIT") ("TEXT" . "_.TEXTEDIT") ("MTEXT" . "_.TEXTEDIT") ("DIMENSION" . "_.TEXTEDIT") ("ARCALIGNEDTEXT" . "_.ARCTEXT") ) ) (if (setq s (ssget "_:L" '( (-04 . "<OR") (000 . "ATTDEF,*DIMENSION,TEXT,MTEXT,ARCALIGNEDTEXT") (-04 . "<AND") (000 . "INSERT") (066 . 1) (-04 . "AND>") (-04 . "OR>") ) ) ) (repeat (setq i (sslength s)) (setq i (1- i) e (ssname s i) ) (initcommandversion) (command (cdr (assoc (cdr (assoc 0 (entget e))) l)) e) ) ) (princ) ) Edited August 27, 2018 by Lee Mac Quote
rkent Posted August 27, 2018 Author Posted August 27, 2018 Lee, Thanks for looking at this. Your version doesn't edit the inserts in the order picked and it stops after the first mtext object rather than continuing when more than one has been selected. Thanks, rkent Quote
Grrr Posted August 28, 2018 Posted August 28, 2018 Heres a modification of Lee's suggestion - ; Multiple Editing (c)1994, Gary Goode ; Updated version at: https://www.cadtutor.net/forum/topic/65888-lsp-file-wont-recognize-attribute-block-need-help/ (defun C:ME nil (C:MultipleEditing)(princ)) (defun C:MultipleEditing ( / *error* acDoc c e i L s ) (setq L '( ("ATTDEF" (x) (command "_.TEXTEDIT" x "")) ("INSERT" (x) (if (member '(066 . 1) (entget x)) (command "_.ATTEDIT" x))) ("TEXT" (x) (command "_.TEXTEDIT" x "")) ("MTEXT" (x) (command "_.TEXTEDIT" x "")) ("DIMENSION" (x) (command "_.TEXTEDIT" x "")) ("ARCALIGNEDTEXT" (x) (command "_.ARCTEXT" x)) ) ) (defun *error* ( m ) (and c (setvar 'cmdecho c)) (and acDoc (vla-EndUndoMark acDoc)) (and m (princ m)) (princ) ); defun *error* (cond ( (setq s (ssget "_:L-I" '((000 . "ATTDEF,*DIMENSION,TEXT,MTEXT,ARCALIGNEDTEXT,INSERT")))) (if vlax-get-acad-object (progn (setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-EndUndoMark acDoc) (vla-StartUndoMark acDoc) ); progn ); if (and (setq c (getvar 'cmdecho)) (setvar 'cmdecho 0)) (repeat (setq i (sslength s)) (setq i (1- i) e (ssname s i) ) (initcommandversion) ((cdr (assoc (cdr (assoc 0 (entget e))) L)) e) ); repeat ) ); cond (*error* nil) (princ) ); defun C:MultipleEditing Couldn't figure out the ssget filter to select all the object types + attributed blocks (in theory Lee's suggestion should work - but I got XOR behavior, rather than OR). So I had to iterate and check every block reference if its attributed. And I hate posting "corrected" versions from a professional lispers that did 90% of the work.. but oh well, sorry Lee. I find this routine quite useful, so thanks guys! Quote
Lee Mac Posted August 28, 2018 Posted August 28, 2018 13 hours ago, rkent said: Lee, Thanks for looking at this. Your version doesn't edit the inserts in the order picked and it stops after the first mtext object rather than continuing when more than one has been selected. Thanks, rkent Odd - it worked in my brief testing. The following should correct the pick order - (defun c:me ( / e i l s ) (setq l '( ("ATTDEF" . "_.TEXTEDIT") ("INSERT" . "_.ATTEDIT") ("TEXT" . "_.TEXTEDIT") ("MTEXT" . "_.TEXTEDIT") ("DIMENSION" . "_.TEXTEDIT") ("ARCALIGNEDTEXT" . "_.ARCTEXT") ) ) (if (setq i -1 s (ssget "_:L" '( (-04 . "<OR") (000 . "ATTDEF,*DIMENSION,TEXT,MTEXT,ARCALIGNEDTEXT") (-04 . "<AND") (000 . "INSERT") (066 . 1) (-04 . "AND>") (-04 . "OR>") ) ) ) (while (setq i (1+ i) e (ssname s i)) (initcommandversion) (command (cdr (assoc (cdr (assoc 0 (entget e))) l)) e) ) ) (princ) ) Quote
rkent Posted August 28, 2018 Author Posted August 28, 2018 Grr - when I select the objects one at a time the order for editing is last picked is edited first, with the first pick being the last one edited. If I use a crossing window or a selection window then I see the order of editing the way you show in your video. Lee - yours still edits in the opposite order picked when pick individually. When selecting other than attributes it will halt and wait for me to select the next text again, I edit that, then it pauses to have be pick the next text. With the original you can pick individually text, attributes, etc, hit enter and then each one will be in edit mode in the order picked, first, second, third,...last. Thanks again for working on this, I appreciate your time and effort. rkent Quote
rkent Posted August 28, 2018 Author Posted August 28, 2018 I finally narrowed the problem with the original to the ATTEDIT not working in the lisp. After a search on the internet I found someone using (command (initdia) ".ATTEDIT" "0,0" "")) in their lisp file. I have no idea, yet, what the (initdia) does, but I used it and the original works just fine now. ; TIP1011.LSP: ME.LSP Multiple Editing (c)1994, Gary Goode ;;;modified 4.9.2003 to include mtext, dimensions, attdef and arctext ;This program will let you pick and edit multi text and attributes ;by window, pick or crossing using dialog boxes. ;modified to use textedit ;----------------------------------------------------------------- (defun C:ME (/ A B C D E F G H J K L M N P R) (graphscr) (setvar "CMDECHO" 0) (setvar "HIGHLIGHT" 1) (prompt "\nMulti-Edit is loaded ... ") (setq A (ssget) B (sslength A) C 0) (while (< C B) (setq D (ssname A C) E (entget D)) (setq F (car E)) (setq G (cdr E)) (setq H (car G)) (setq J (cdr H)) (setq K "TEXT") (setq L "INSERT") (setq M "DIMENSION") (setq N "MTEXT") (setq P "ATTDEF") (setq R "ARCALIGNEDTEXT") ;;updated with next section using textedit for most objects (if (= J K)(command ".TEXTEDIT" D "")) (if (= J L)(command (initdia) ".ATTEDIT" D "")) (if (= J N)(command ".TEXTEDIT" D "")) (if (= J M)(command ".TEXTEDIT" D "")) (if (= J P)(command ".TEXTEDIT" D "")) (if (= J R)(command ".ARCTEXT" D "")) (setq C (1+ C))) (princ) ); end me.lsp Thanks to everyone for helping with this request. rkent 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.