haisagiviz Posted September 25, 2019 Posted September 25, 2019 Hi everyone, I am using Quick unformat Mtext lisp from Lee Mac, it is great lisp but I want to keep Paragraph format for Mtext. Anyone can help me to fix it in this lisp. ;;------------------------------------------------------------;; ;;--- REMOVE FORMAT MTEXT --- ;;------------------------------------------------------------;; ;; Quick Unformat - Lee Mac ;; Returns a string with all MText formatting codes removed. ;; rgx - [vla] Regular Expressions (RegExp) Object ;; str - [str] String to process (defun LM:quickunformat ( rgx str ) (if (null (vl-catch-all-error-p (setq str (vl-catch-all-apply '(lambda nil (vlax-put-property rgx 'global actrue) (vlax-put-property rgx 'multiline actrue) (vlax-put-property rgx 'ignorecase acfalse) (foreach pair '( ("\032" . "\\\\\\\\") (" " . "\\\\P|\\n|\\t") ("$1" . "\\\\(\\\\[ACcFfHKkLlOopQTW])|\\\\[ACcFfHKkLlOopQTW][^\\\\;]*;|\\\\[ACcFfKkHLlOopQTW]") ("$1$2/$3" . "([^\\\\])\\\\S([^;]*)[/#\\^]([^;]*);") ("$1$2" . "\\\\(\\\\S)|[\\\\](})|}") ("$1" . "[\\\\]({)|{") ("\\$1$2$3" . "(\\\\[ACcFfHKkLlOoPpQSTW])|({)|(})") ("\\\\" . "\032") ) (vlax-put-property rgx 'pattern (cdr pair)) (setq str (vlax-invoke rgx 'replace str (car pair))) ) ) ) ) ) ) str ) ) Thank you so much. HAI Quote
haisagiviz Posted October 1, 2019 Author Posted October 1, 2019 Hi @Lee Mac Can you help me to custom this lisp because I do not need to remove Paragraph override of Mtext. Thank you. Quote
Emmanuel Delay Posted October 1, 2019 Posted October 1, 2019 Can you share with all of us what exactly you want? What exactly this .lsp does that you don't want, and what result you do want... ? 1 Quote
Lee Mac Posted October 1, 2019 Posted October 1, 2019 Change: ("$1" . "\\\\(\\\\[ACcFfHKkLlOopQTW])|\\\\[ACcFfHKkLlOopQTW][^\\\\;]*;|\\\\[ACcFfKkHLlOopQTW]") to: ("$1" . "\\\\(\\\\[ACcFfHKkLlOopQTW])|\\\\[ACcFfHKkLlOoQTW][^\\\\;]*;|\\\\[ACcFfKkHLlOoQTW]") And: ("\\$1$2$3" . "(\\\\[ACcFfHKkLlOoPpQSTW])|({)|(})") to: ("\\$1$2$3" . "(\\\\[ACcFfHKkLlOoPQSTW])|({)|(})") 1 Quote
BIGAL Posted October 2, 2019 Posted October 2, 2019 (edited) Took a moment lower case p is removed makes sense \\p in mtext. ^p in Word search replace not ^P Edited October 2, 2019 by BIGAL 1 Quote
haisagiviz Posted October 2, 2019 Author Posted October 2, 2019 Thank everyone so much. I will learn from it. All of you are amazing. Quote
haisagiviz Posted October 3, 2019 Author Posted October 3, 2019 On 10/2/2019 at 12:55 AM, Lee Mac said: Change: ("$1" . "\\\\(\\\\[ACcFfHKkLlOopQTW])|\\\\[ACcFfHKkLlOopQTW][^\\\\;]*;|\\\\[ACcFfKkHLlOopQTW]") to: ("$1" . "\\\\(\\\\[ACcFfHKkLlOopQTW])|\\\\[ACcFfHKkLlOoQTW][^\\\\;]*;|\\\\[ACcFfKkHLlOoQTW]") And: ("\\$1$2$3" . "(\\\\[ACcFfHKkLlOoPpQSTW])|({)|(})") to: ("\\$1$2$3" . "(\\\\[ACcFfHKkLlOoPQSTW])|({)|(})") Thank @Lee Mac I fixed it but it was not working. Sorry but could you please confirm the code again. Quote
haisagiviz Posted October 3, 2019 Author Posted October 3, 2019 On 10/1/2019 at 8:23 PM, Roy_043 said: Maybe try StripMtext. Thank you so much. I knew this lisp before but I just want to run LISP in the background for this case. Not in DCL. Quote
haisagiviz Posted October 3, 2019 Author Posted October 3, 2019 On 10/1/2019 at 10:06 PM, Emmanuel Delay said: Can you share with all of us what exactly you want? What exactly this .lsp does that you don't want, and what result you do want... ? I have the exported DWG from other CAD tool like Revit. And I want to use the LISP to fix some problem of exported files automatically. And Mtext is overrided is one of the problems. I want to remove all of overrided of Mtext but keep only Paragraph. Mr. Lee Mac is knew this issue. Thank all of you. Quote
BIGAL Posted October 4, 2019 Posted October 4, 2019 Hi Lee the version posted is different to what is now on your web site so trying to work out the rgx value. 1 Quote
Lee Mac Posted October 4, 2019 Posted October 4, 2019 On 10/3/2019 at 8:53 AM, haisagiviz said: Thank @Lee Mac I fixed it but it was not working. Sorry but could you please confirm the code again. Could you post the exact MText content that you are supplying to the function? 11 hours ago, BIGAL said: Hi Lee the version posted is different to what is now on your web site so trying to work out the rgx value. This Quick Unformat function isn't (yet) published on my site, but only on various forums (e.g.); the rgx argument should be supplied with an instance of the Regular Expressions object, which may be created using: (vlax-create-object "vbscript.regexp") Note that this object should also be released. 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.