Jump to content

UnFormat.lsp does not work in Autocad 2021


Recommended Posts

Posted

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
)

 

  • Thanks 1
Posted
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.

  • Like 1
Posted
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...

  • Like 1
Posted
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.

Posted (edited)

No, I didn't understand why the first code didn't work.

Edited by Nikon
Posted
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 . )

Posted
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?

  • Thanks 1
Posted
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.

Posted (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 by Nikon
Posted

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

Posted (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 by Nikon
Posted

That's a point - forget what I said.

  • Like 1
Posted
1 hour ago, Nikon said:

Thanks! Won't this affect the work of other lisp programs ?

 

Not in my experience, but it's possible.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...