Sweety Posted November 11, 2010 Author Share Posted November 11, 2010 A very great words . I would keep them in mind all the time while asking for any help from anyone . Thank you so much for your positive efforts with me. Greatly appreciated Mr. Alanjt Quote Link to comment Share on other sites More sharing options...
BlackBox Posted November 11, 2010 Share Posted November 11, 2010 A person is only as stupid as they allow themselves to be. To realize one's own stupidity, without the inherent luxury of seeing one's self through a prism of wisdom, is a daunting task at best. While I greatly value knowledge, it is wisdom that I seek. Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 11, 2010 Share Posted November 11, 2010 Are you saying stupid is as stupid does?Six in one' date=' half a dozen in the other, Forrest. A very great words . I would keep them in mind all the time while asking for any help from anyone . Thank you so much for your positive efforts with me. Greatly appreciated Mr. Alanjt Welcome. Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 11, 2010 Share Posted November 11, 2010 (edited) To realize one's own stupidity, without the inherent luxury of seeing one's self through a prism of wisdom, is a daunting task at best. While I greatly value knowledge, it is wisdom that I seek. Stupid is a relative term. Meaning, if a person doesn't put forth the effort, nothing will be accomplished. I understand that some just can't comprehend, but no one could if they didn't at least make an attempt.Sticking feathers up your butt doesn't make you a chicken = scraping bits of code together doesn't make you a programmer. Edited November 11, 2010 by alanjt TYPO Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 11, 2010 Share Posted November 11, 2010 BTW, I really like the repeat from the string length idea, Lee. Thanks Alan However, why'd you worry with converting the string to an ascii character when (eq s " ") would have sufficed? Because, I thought it'd be quicker than (substr s 1 1) Just taking advantage of the fact that: (ascii "abc") <==> (ascii (substr "abc" 1 1)) Looking back on it now, the quickest thing would probably be set a variable to (substr s 1 1), test it, then concatenate it to the end of output 'o'. Oh well, I'm happy. BTW thanks for making me look back at my sub, just realised I don't need the 'i' argument in the nospace sub - was going to go a different route when I wrote it. Code updated. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 11, 2010 Share Posted November 11, 2010 Sticking feathers up your butt doesn't make you a chicken = scraping bits of code together doesn't make your a programmer. that's one way to put it... Quote Link to comment Share on other sites More sharing options...
BlackBox Posted November 11, 2010 Share Posted November 11, 2010 Stupid is a relative term. Meaning, if a person doesn't put forth the effort, nothing will be accomplished. I understand that some just can't comprehend, but no one could if they didn't at least make an attempt.Sticking feathers up your butt doesn't make you a chicken = scraping bits of code together doesn't make your a programmer. Agreed... I was simply sharing what this stale fortune cookie on my desk said. I'm hungry. Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 11, 2010 Share Posted November 11, 2010 Thanks Alan Because, I thought it'd be quicker than (substr s 1 1) Just taking advantage of the fact that: (ascii "abc") <==> (ascii (substr "abc" 1 1)) Looking back on it now, the quickest thing would probably be set a variable to (substr s 1 1), test it, then concatenate it to the end of output 'o'. Oh well, I'm happy. BTW thanks for making me look back at my sub, just realised I don't need the 'i' argument in the nospace sub - was going to go a different route when I wrote it. Code updated. Interesting idea. However, I would have stored it as a variable. Any speed you gained from the ascii check (is faster), you lost when you used (substr s 1 1) to keep the string. BTW, did you see my recursive submission? Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 11, 2010 Share Posted November 11, 2010 Agreed... I was simply sharing what this stale fortune cookie on my desk said. I'm hungry. Me too and I ate my porkchop lunch on my way to work. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 11, 2010 Share Posted November 11, 2010 Interesting idea. However, I would have stored it as a variable. Any speed you gained from the ascii check (is faster), you lost when you used (substr s 1 1) to keep the string. Exactly BTW, did you see my recursive submission? Yeah, nice one - although I suppose with recursion you sacrifice speed for elegance Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 11, 2010 Share Posted November 11, 2010 Exactly Yeah, nice one - although I suppose with recursion you sacrifice speed for elegance Yeah, sadly, that's the case for this situation, but as you said, it was for the sake of a Vanilla challenge. I'm sticking with the vl-remove way - much faster. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted November 11, 2010 Share Posted November 11, 2010 way - much faster. I love it when something is 'way - much faster' ...! I also love taking other's quotes out of context! Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 11, 2010 Share Posted November 11, 2010 I love it when something is 'way - much faster' ...! I also love taking other's quotes out of context! Saved by the hyphen. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted November 11, 2010 Share Posted November 11, 2010 FYI Mat, if you are going to edit entities as vla-objects, it's faster to use vla-get-activeselectionset than to step through the selectionset and convert to vla-objects. Dually noted. For kicks, here's another option (does the same thing), using Alan's suggestion: (defun c:FOO (/ ss s) (vl-load-com) (vla-startundomark (cond (*activeDoc*) ((setq *activeDoc* (vla-get-activedocument (vlax-get-acad-object)))))) (if (setq ss (ssget '((0 . "TEXT,MTEXT")))) (progn (vlax-for x (setq ss (vla-get-activeselectionset *activeDoc*)) (setq s (vla-get-textstring x)) (while (vl-string-search " " s) (setq s (vl-string-subst "" " " s))) (vla-put-textstring x s)) (vla-delete ss))) (vla-endundomark *activeDoc*) (princ)) Quote Link to comment Share on other sites More sharing options...
pBe Posted November 12, 2010 Share Posted November 12, 2010 (defun c:rt (/ ds_txt str pst ) (setq ds_txt (entget (car (entsel "\nSeect Text: "))) str (cdr (assoc 1 ds_txt))) (while (setq pst (vl-string-search " " str)) (setq str (strcat (substr str 1 pst)(substr str (+ pst 2)))) ) (entmod (subst (cons 1 str)(assoc 1 ds_txt) ds_txt)) ) Mind if i join in... without looking at the previous posts this is how i code it.. i'm trying to create one without vl like Lee Mac.. i'm getting there.. .. making it short as possible.. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 12, 2010 Share Posted November 12, 2010 Look into vl-string-subst pBe I think if you are looking for both speed and concision, the vl-remove method is the way to go - also, this will work on Text, MText, Attributes, and MLeaders: (defun c:test ( / e ) (vl-load-com) (while (setq e (car (nentsel))) (if (vlax-property-available-p (setq o (vlax-ename->vla-object e)) 'TextString) (vla-put-TextString o (vl-list->string (vl-remove 32 (vl-string->list (vla-get-TextString o))))) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
pBe Posted November 13, 2010 Share Posted November 13, 2010 Look into vl-string-subst pBe I think if you are looking for both speed and concision, the vl-remove method is the way to go - also, this will work on Text, MText, Attributes, and MLeaders: I tried it, works like a charm.. its like 4 in1 function Thanks to you guys my programing skills have improved a lot Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 13, 2010 Share Posted November 13, 2010 I tried it, works like a charm.. its like 4 in1 function Thanks to you guys my programing skills have improved a lot You're very welcome - it was pretty much exactly the same for us guys - we mostly learnt what we know from these forums also... Quote Link to comment Share on other sites More sharing options...
Michaels Posted November 13, 2010 Share Posted November 13, 2010 Look into vl-string-subst pBe I think if you are looking for both speed and concision, the vl-remove method is the way to go - also, this will work on Text, MText, Attributes, and MLeaders: (defun c:test ( / e ) (vl-load-com) (while (setq e (car (nentsel))) (if (vlax-property-available-p (setq o (vlax-ename->vla-object e)) 'TextString) (vla-put-TextString o (vl-list->string ([b][color="red"]vl-remove 32[/color][/b] (vl-string->list (vla-get-TextString o))))) ) ) (princ) ) Hello Lee, What is the number 32 indicates to into your routine (is it the free space indication) ? Thanks Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 13, 2010 Share Posted November 13, 2010 What is the number 32 indicates to into your routine (is it the free space indication) ? Hi Michaels, Read the VLIDE Help Docs on the vl-string->list function, then you tell me Quote Link to comment Share on other sites More sharing options...
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.