Author Topic: Will PAY $$ fpr lsp - MODIFY TEXT  (Read 10143 times)

0 Members and 1 Guest are viewing this topic.

mhcadman

  • Guest
Will PAY $$ fpr lsp - MODIFY TEXT
« on: May 02, 2008, 05:54:25 PM »

 :)

PLEASE HELP!!!!

MODIFYING EXISTING TEXT

1st- the text can be mtext, mostly the text will be plain text.

2nd - the command will be placed in a toolbar button, for example: (load "chgtxt");chtxt

3rd - yes I know how to perform theses tasks one at a time.. it gets old after hours and hours of repetitious attribute editing.

4th - please respond only if you can write the program..  criticism isn't going to solve anything...  this is the program I want, period.  Maybe  in return, I can help you with something in Microstation.

humble cad man,,,,, mike....

-------------------------------------------------------------------------------
I've tried searching the web and using ACAD help but I can't make this lsp happen.

I need a lsp program that will change existing text.......

Existing test is:   PLAN EL.180'-0"

I want to select existing text to change.
 
Once selected, I want the selected text to be "UNDERLINED (adding %%u to the beginning- %%uEL.180'-0" )", the "STYLE" to change to "STD35E", the
"HEIGHT" to change to 3", the "LAYER" to change to "CY1".

An additional "help" (but not required) would be to have the lsp read a "data file" to import the "STYLE, HEIGHT, and LAYER". (Underlining will always be required.)
Different "data files" for multiple requirements.

Sincerely,
Mike

JohnK

  • Administrator
  • Seagull
  • Posts: 10646
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #1 on: May 02, 2008, 06:08:15 PM »
That doesn't sound like it isnt that hard of a procedure/request.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

mkweaver

  • Bull Frog
  • Posts: 352
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #2 on: May 02, 2008, 06:20:35 PM »
Here's something to get you up and running.  Note that the layer and the text style must already exist or the routine will fail.
Zero error checking here (and zero testing)


Code: [Select]
(defun chgtxt( / obj oldstring newstring)
  (setq
    obj (vlax-ename->vla-object (car (entsel)))
    OldString (vla-get-textstring obj)
    NewString (vla-put-textstring obj (strcat "%%U" oldstring))
    )
  (vla-put-stylename obj "STD35E")
  (vla-put-height obj 3)
  (vla-put-layer obj "CY1")
  )code]

JohnK

  • Administrator
  • Seagull
  • Posts: 10646
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #3 on: May 02, 2008, 06:31:59 PM »
%%U doesnt work on mtext.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #4 on: May 02, 2008, 07:09:37 PM »
If you really want to pay for this, make a donation to theSwamp.

[ http://www.theswamp.org/donate.html ]

Code: [Select]
(defun c:MyTest (/ ActDoc)
   
    (setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
    (vla-EndUndoMark ActDoc)
    (vla-StartUndoMark ActDoc)
    (vla-Add (vla-get-Layers ActDoc) "CY1")
    (vla-Add (vla-get-TextStyles ActDoc) "STD35E")
    (if (ssget'((0 . "*TEXT")))
        (vlax-for obj (vla-get-ActiveSelectionSet ActDoc)
            (if (= (vla-get-ObjectName obj) "AcDbText")
                (vla-put-TextString obj (strcat "%%U" (vla-get-TextString obj)))
                (vla-put-TextString obj (strcat "{\\L" (vla-get-TextString obj) "}"))
            )
            (vla-put-StyleName obj "STD35E")
            (vla-put-Layer obj "CY1")
            (vla-put-Height obj 3)
        )
    )
    (vla-EndUndoMark ActDoc)
    (princ)
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

JohnK

  • Administrator
  • Seagull
  • Posts: 10646
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #5 on: May 02, 2008, 07:25:24 PM »
*blink-blink*
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

M-dub

  • Guest
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #6 on: May 02, 2008, 07:31:20 PM »
Nice thought, Tim.  :)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #7 on: May 02, 2008, 07:33:24 PM »
*blink-blink*
Hope I didn't step on your toes, or anyone else's.  Or did I not do what the OP wanted?

Nice thought, Tim.  :)
Thanks.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

JohnK

  • Administrator
  • Seagull
  • Posts: 10646
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #8 on: May 02, 2008, 07:37:04 PM »
Hope I didn't step on your toes, or anyone else's.  Or did I not do what the OP wanted?

I'm broke!! ...But, I guess $20 wouldn't have gotten me very much so no harm i guess. 
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #9 on: May 02, 2008, 07:38:41 PM »
Hope I didn't step on your toes, or anyone else's.  Or did I not do what the OP wanted?

I'm broke!! ...But, I guess $20 wouldn't have gotten me very much so no harm i guess. 
I don't think the OP saw it yet, so I can take it away.   :evil:

Just for you.   :-)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #10 on: May 02, 2008, 07:42:55 PM »
Quote from: OP Title
Will PAY $$ fpr lsp


...But, I guess $20 wouldn't have gotten me very much .........


 :|  I thought the offer was 2$ ( $$ )    :laugh:


kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #11 on: May 02, 2008, 07:44:52 PM »
Quote from: OP Title
Will PAY $$ fpr lsp


...But, I guess $20 wouldn't have gotten me very much .........


 :|  I thought the offer was 2$ ( $$ )    :laugh:



If he's broke, 2$ is at least something to get him started.   :lmao:
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

JohnK

  • Administrator
  • Seagull
  • Posts: 10646
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #12 on: May 02, 2008, 08:28:14 PM »
Ok, im going to do some slight modifications to my version and you two are going to test it. But i need to know what bank you guys use and your favorite 4 digits first. 
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #13 on: May 02, 2008, 09:29:13 PM »
You should add (vl-load-com) to the beginning of both of those lisp routines.
Just in case it wasn't loaded already.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

M-dub

  • Guest
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #14 on: May 03, 2008, 12:23:02 AM »
See, look at this...  This is typical of members of theSwamp.

Keep smilin' everyone.  :)

JohnK

  • Administrator
  • Seagull
  • Posts: 10646
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #15 on: May 03, 2008, 02:14:55 AM »
What is typical? Someone cheating someone else out of something? or Two bullies picking on a helpless, innocent, good person who only wanted to spread joy to others?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #16 on: May 03, 2008, 02:22:48 AM »
What is typical?

You missed it on both accounts ...

Typical is how you misunderstood M-dub's comments.

Seriously though ... it is typical in the way that the members of theswamp have pitched in to help someone in need .. of course I could be wrong, because I didn't see the sarcasm tags on your post ;)
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #17 on: May 03, 2008, 02:37:46 AM »

I think we all missed John's acceptance post for the contract.    :lmao:
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

JohnK

  • Administrator
  • Seagull
  • Posts: 10646
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #18 on: May 03, 2008, 02:55:28 AM »
Oh sure, just keep picking on the fat kid.

Keith, when have i ever added `sarcasm tags' to any of my posts?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

M-dub

  • Guest
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #19 on: May 03, 2008, 09:59:10 AM »
Oh sure, just keep picking on the fat kid.

It's alright John... I'm used to it by now and just let it roll right off my back.  :)

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #20 on: May 03, 2008, 10:02:02 AM »
Oh sure, just keep picking on the fat kid.

Keith, when have i ever added `sarcasm tags' to any of my posts?
Well there ya go
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

ELOQUINTET

  • Guest
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #21 on: May 05, 2008, 03:48:57 PM »
Uh am I the only one who found this funny? I love defensive people. I didn't even have to look at his post count, I could tell he was new here as most people will bend over backwards to help you and for the most part only give constructive criticism or are joking around. Did he not come back and say thank you either, BAN HIM!!!

4th - please respond only if you can write the program..  criticism isn't going to solve anything...  this is the program I want, period.

Maverick®

  • Seagull
  • Posts: 14778
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #22 on: May 05, 2008, 03:59:40 PM »
Interesting.  "Last active" on his profile is 30 seconds BEFORE the original post.  How does that work?  If someone signs in but doesn't do anything (yes, I'm aware of how I am setting myself up with that  :-D).... does it show as "active"?

ELOQUINTET

  • Guest
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #23 on: May 05, 2008, 05:33:53 PM »
Ban me, No wait don't Ban me BAN HIM

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #24 on: May 06, 2008, 02:59:35 AM »
Uh am I the only one who found this funny? I love defensive people. I didn't even have to look at his post count, I could tell he was new here as most people will bend over backwards to help you and for the most part only give constructive criticism or are joking around. Did he not come back and say thank you either, BAN HIM!!!

4th - please respond only if you can write the program..  criticism isn't going to solve anything...  this is the program I want, period.
You may be joking about your comments, however, a new member may not feel that you are. :-)
Most members here have benefited from the abilities of others here, some more than others, I know...I have probably had more than my fair share of help  :-)... thats the great thing about this place, theres always someone willing to help.
Yes, its nice to get a thanks when you help someone, but it doesn't always happen... people too busy with rushed deadlines, too much work, not enough time etc...
Sorry... I'll stop now  :-(
Thanks for explaining the word "many" to me, it means a lot.

Guest

  • Guest
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #25 on: May 06, 2008, 08:45:14 AM »
It ain't the prettiest thing, but it works.  Keep in mind there is no error checking and that the program assumes the layer/text style already exist in the drawing.

Code: [Select]
(defun C:ChTxt ( / objEnt objDat)
   (while (setq objEnt (entsel "\nSelect TEXT to modify: "))
      (if objEnt
         (progn
            (setq objDat (entget (car objEnt)))
            (setq objDat (subst (cons 7 "STD35E") (assoc 7 objDat) objDat))
            (setq objDat (subst (cons 8 "CY1") (assoc 8 objDat) objDat))
            (setq objDat (subst (cons 40 3.0)  (assoc 40 objDat) objDat))
            (setq objDat (subst (cons 1 (strcat "%%U" (cdr (assoc '1 objDat)))) (assoc 1 objDat) objDat))
            (entmod objDat)
         )
      )
   )
   (princ)
)

(princ)

ELOQUINTET

  • Guest
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #26 on: May 06, 2008, 09:15:29 AM »
Jonesy you sound like you need a hug so here's a virtual hug. I know what you mean that was my attempt to inform that user that we are pretty easy going around here. I wasn't implying that we are offended when we don't receive a thank you everytime. I do not agree with the statement that criticism isn't going to solve anything. Constructive criticism can be very helpful.

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #27 on: May 06, 2008, 09:31:08 AM »
Thanks for the virtual hug :) First day back after a long weekend.
I agree that the vast majority of the time we are a pretty easy going bunch, sometimes its difficult to tell the "mood" of a post, so a newer member will not necessarily know that we are easy going,  so a well placed smiley could help.
Just a thought :)
Thanks for explaining the word "many" to me, it means a lot.

Guest

  • Guest
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #28 on: May 06, 2008, 09:35:04 AM »

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #29 on: May 06, 2008, 09:40:16 AM »
LOL Thanks Matt..Better wait till I get home before I go for the "little something extra" Its bound to be blocked here!
Thanks for explaining the word "many" to me, it means a lot.

Guest

  • Guest
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #30 on: May 06, 2008, 09:49:38 AM »
LOL Thanks Matt..Better wait till I get home before I go for the "little something extra" Its bound to be blocked here!

It's just the hampster dance web site!!   :-)

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #31 on: May 06, 2008, 09:53:51 AM »
I cant get to many sites here at work :( Many of them work related too, so I stand no chance in getting to a non-work site...
But thanks for making me laugh :)
Thanks for explaining the word "many" to me, it means a lot.

ELOQUINTET

  • Guest
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #32 on: May 06, 2008, 02:53:33 PM »
 :-) Feel Better

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #33 on: May 06, 2008, 03:12:44 PM »
Yeah... I'm home now...
BTW thats a great smile :)
Thanks for explaining the word "many" to me, it means a lot.

JohnK

  • Administrator
  • Seagull
  • Posts: 10646
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #34 on: May 06, 2008, 03:37:26 PM »
Sell flowers in `Lagniappe' this forum (`Code Red') is for hard core, down and dirty hacking/programing. We are a rough and tumble bunch. We are a motley crew of disbanded, hardened, evil dispensing, hackers set out to force AutoCAD to conform to our wills.

...here, allow me to demonstrate:
Kerry, you really hurt my feelings when you overlooked my code.
*waits*
See nothing?! Now watch this:
Kerry, that procedure you wrote for parsing a user entered string really sux; i mean my little brother could have done a better job with that char array.
*sits back to watch the flames*


Yipee!
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #35 on: May 06, 2008, 03:55:54 PM »
That it may be, but it still needs to cater for new to programming people, new to the forum people who may not know you(or us) or your/our ways.
Heck theres time when I'd wanted to show my itty-bit of code, but didnt just because it doesnt stack up to the great and the good here... And I'm a long time member who knows people here.

Right, I'm going back to the Lagniappe forum now to continue to sell my flowers :)
Thanks for explaining the word "many" to me, it means a lot.

Bob Wahr

  • Guest
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #36 on: May 06, 2008, 04:07:51 PM »
Sell flowers in `Lagniappe' this forum (`Code Red') is for hard core, down and dirty hacking/programing. We are a rough and tumble bunch. We are a motley crew of disbanded, hardened, evil dispensing, hackers set out to force AutoCAD to conform to our wills.

...here, allow me to demonstrate:
Kerry, you really hurt my feelings when you overlooked my code.
*waits*
See nothing?! Now watch this:
Kerry, that procedure you wrote for parsing a user entered string really sux; i mean my little brother could have done a better job with that char array.
*sits back to watch the posts disappear*


Yipee!
Fixed it for you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #37 on: May 06, 2008, 04:42:26 PM »
Looks like mhcadman got what he wanted and too much of what he didn't need.
This thread isn't going anywhere useful so I'll end it here.


« Last Edit: February 03, 2010, 12:16:43 AM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Will PAY $$ fpr lsp - MODIFY TEXT
« Reply #38 on: February 02, 2010, 11:23:25 PM »
Sell flowers in `Lagniappe'
this forum (`Code Red') is for hard core, down and dirty hacking/programing. We are a rough and tumble bunch. We are a motley crew of disbanded, hardened, evil dispensing, hackers set out to force AutoCAD to conform to our wills.
< .. >
See nothing?! Now watch this:
< .. >
*sits back to watch the flames*


Yipee!

Is there a Statute of limitations on flames   :wink:
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.