I would be inclined to use the power of Regular Expressions for this task:
(defun c:FindStacked ;; Find Stacked-Lee Mac 2011-www.lee-mac.com ( / *error* _prompt _replace _dissect _textstring ent inc new old rgx sel str ) (defun *error* ( msg ) (if (and rgx (not (vlax-object-released-p rgx))) (vlax-release-object rgx)) (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")) (princ (strcat "\nError: " msg)) ) (princ) ) (defun _prompt ( msg / var ) (while (not (vl-string-position 47 (setq var (getstring msg)))) (princ "\nPlease Enter a Fractional String.") ) (if (vla-object ent) str) ) ) (vlax-release-object rgx) ) ) (princ))I have retained simplicity in the above code for clarity and consequently it is by no means bullet-proof. For a full application, I would include code to account for literal occurrences of "\\S" in the MText string, and occurrences of "/" amongst other characters in the numerator and denominator of the fraction; but above all, the code demonstrates the method I would follow. Regular Expressions..
I never did get around exploring that method... yeah why not.
BTW: with codes utilizing VBScript and also ActiveX, would it still work for Autocad MAC versions?
EDIT: wrong Expression (pun) Definitely no. There won't be any ActiveX over there so the vlax-get-or-create-object would already fail. Never mind that there also isn't anything like VBScript.RegExp to play with.
Edit: Painful ain't it? Another reason I'd like to see a Common Lisp interpreter inside AutoCAD: http://www.cliki.net/regular%20expression
Eye-roll?
Oh... i meant
I never did once use RegEx, even though i'm aware of it for sometime now
Humble apoligies Lee
EDIT: POST updated
Will it be the same case for NET? Well, "at present" yes.
If you glance at the video tutorial for making stuff in OSX: http://wikihelp.autodesk.com/AutoCAD_for_Mac/enu/2011/Help/Developer_Documentation/Migrating_Windows_Applications/ObjectARX_-_Mac_OS_X_Migration_Guide/Required_Development_Tools
You'll note they "glance over" the fact that none of DotNet works anywhere else than in Windows! Though they mention something about "AutoDesk is working on resolving this". I just wonder how long they've been "working" on it? And if there's any sort of progress. I know the biggest reason behind most programs not running in Linux through WINE is due to DotNet requirements, and WINE has been going at it for some years already. So I'm not holding my breath on the DotNet in OSX score!
lol, no worries dude, just couldn't work out the tone of your original response was all
For tasks like these, Regular Expressions are well worth studying though - string substitution becomes a lot easier.
Thanks for the info Irneb.
I'll start reading on RegEx this week.
Thanks my friend
You're very welcome
To get you started, here is the MSDN reference for the RegExp object itself:
http://msdn.microsoft.com/en-us/library/yab2dx62%28VS.85%29.aspx
And here is one of the very best RegEx tutorials I've seen:
http://www.theswamp.org/index.php?topic=37030.msg420224#msg420224
页:
1
[2]