Steven P Posted 4 hours ago Posted 4 hours ago I'll put this one here for later. I have a suspicion that the text is still there, just not visible - very small perhaps. This will show all the mtext values (first 256 characters anyway) in the drawing. Run it after your unformat just to confirm that the texts have been deleted or are just not visible. (defun c:GrabTexts ( / MySS acount MyEnt) (setq myss (ssget "_X" '((0 . "mtext")))) (setq acount 0) (while (< acount (sslength myss)) (setq Myent (ssname Myss acount)) (princ "\n")(princ (assoc 1 (entget MyEnt))) (setq acount (+ acount 1)) ) ; end while ) 1 Quote
Nikon Posted 4 hours ago Author Posted 4 hours ago 29 minutes ago, GLAVCVS said: Write before (vla-put-textstring obj (vla-get-TextString obj)) this: (print (vla-get-TextString obj)), загрузите, запустите и опубликуйте скриншот того, что произошло в командной строке PS: Also make sure you've closed all the parentheses in your Lisp expression: your last message seems to be missing a closing parenthesis. ((= otyp "MTEXT")(print (vla-get-TextString obj))(vla-put-TextString obj (supriFMT (vla-get-TextString obj)))) ; AcDbMText It looks like it worked! Thank you all! I'll test it again. 1 Quote
Nikon Posted 4 hours ago Author Posted 4 hours ago 34 minutes ago, GLAVCVS said: Write before (vla-put-textstring obj (vla-get-TextString obj)) this: (print (vla-get-TextString obj)), загрузите, запустите и опубликуйте скриншот того, что произошло в командной строке PS: Also make sure you've closed all the parentheses in your Lisp expression: your last message seems to be missing a closing parenthesis. ((= otyp "MTEXT")(print (vla-get-TextString obj))(vla-put-TextString obj (supriFMT (vla-get-TextString obj)))) ; AcDbMText It looks like it worked! Thank you all! I'll test it again. But I still haven't figured out what the problem is... 1 Quote
GLAVCVS Posted 4 hours ago Posted 4 hours ago 4 minutes ago, Nikon said: ... But I still haven't figured out what the problem is... Maybe you deleted some parentheses when you removed the T argument. Quote
Nikon Posted 4 hours ago Author Posted 4 hours ago (edited) No, I didn't understand why the first code didn't work. Edited 4 hours ago by Nikon Quote
Nikon Posted 3 hours ago Author Posted 3 hours ago 59 minutes ago, Steven P said: I have a suspicion that the text is still there, just not visible - very small perhaps. This will show all the mtext values (first 256 characters anyway) in the drawing. Run it after your unformat just to confirm that the texts have been deleted or are just not visible. (defun c:GrabTexts ( / MySS acount MyEnt) (setq myss (ssget "_X" '((0 . "mtext")))) (setq acount 0) (while (< acount (sslength myss)) (setq Myent (ssname Myss acount)) (princ "\n")(princ (assoc 1 (entget MyEnt))) (setq acount (+ acount 1)) ) ; end while ) GRABTEXTS Writing on the command line: (1 . ) (1 . ) Quote
GLAVCVS Posted 3 hours ago Posted 3 hours ago 1 hour ago, Nikon said: No, I didn't understand why the first code didn't work. It's simply that your version of LM:UnFormat (I don't know if it's the original or modified one) isn't compatible with some localized versions of AutoCAD. Is your version of AutoCAD 2019 on the same PC as the 2021 version? 1 Quote
Nikon Posted 2 hours ago Author Posted 2 hours ago 54 minutes ago, GLAVCVS said: Is your version of AutoCAD 2019 on the same PC as the 2021 version? Yes, both versions are on the same computer. And before that, everything worked in autocad 2015. That's why I'm at a loss. Thank you very much. Quote
Nikon Posted 1 hour ago Author Posted 1 hour ago (edited) 50 minutes ago, Lee Mac said: Try setting LISPSYS=0 if you haven't already. After changing the variable LISPSYS=0, you need to restart Autocad. The code UNFORMAT worked perfectly! Thanks! Won't this affect the work of other lisp programs ? Edited 50 minutes ago by Nikon Quote
Steven P Posted 45 minutes ago Posted 45 minutes ago If you want you can do something like (setq LispSys_Old (getvar 'lispsys)) (setvar 'lispsys 0) ... do your code here (setvar 'lispsys LispSys_Old) to set it and reset it to what it was if you are worried about the change affecting other things. I would normally set a variable and return it to what it was with the least code in between in case the LISP is interrupted or to put in error handling to return it to its original value Quote
Nikon Posted 39 minutes ago Author Posted 39 minutes ago (edited) 6 minutes ago, Steven P said: If you want you can do something like (setq LispSys_Old (getvar 'lispsys)) (setvar 'lispsys 0) ... do your code here (setvar 'lispsys LispSys_Old) to set it and reset it to what it was if you are worried about the change affecting other things. I would normally set a variable and return it to what it was with the least code in between in case the LISP is interrupted or to put in error handling to return it to its original value But after changing LISPSYS, the code only worked after restarting Autocad... So it's impossible to configure it in the code? Edited 38 minutes ago by Nikon Quote
Lee Mac Posted 13 minutes ago Posted 13 minutes ago 1 hour ago, Nikon said: Thanks! Won't this affect the work of other lisp programs ? Not in my experience, but it's possible. 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.