TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: mhcadman 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
-
That doesn't sound like it isnt that hard of a procedure/request.
-
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)
(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]
-
%%U doesnt work on mtext.
-
If you really want to pay for this, make a donation to theSwamp.
[ http://www.theswamp.org/donate.html ]
(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)
)
-
*blink-blink*
-
Nice thought, Tim. :)
-
*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.
-
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.
-
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. :-)
-
Will PAY $$ fpr lsp
...But, I guess $20 wouldn't have gotten me very much .........
:| I thought the offer was 2$ ( $$ ) :laugh:
-
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:
-
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.
-
You should add (vl-load-com) to the beginning of both of those lisp routines.
Just in case it wasn't loaded already.
-
See, look at this... This is typical of members of theSwamp.
Keep smilin' everyone. :)
-
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?
-
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 ;)
-
I think we all missed John's acceptance post for the contract. :lmao:
-
Oh sure, just keep picking on the fat kid.
Keith, when have i ever added `sarcasm tags' to any of my posts?
-
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. :)
-
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
-
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.
-
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"?
-
Ban me, No wait don't Ban me BAN HIM
-
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 :-(
-
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.
(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)
-
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.
-
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 :)
-
...a well placed smiley could help.
:-) :-) :-) :-D :-) :-) :-) :-D :-) :-) :-) :-D :-) :-) :-) :-D :-) :-) :-) :-D :-) :-) :-) :-D :-) :-) :-)
And a little something extra (http://www.hampsterdance.com/classinteractive.html).
-
LOL Thanks Matt..Better wait till I get home before I go for the "little something extra" Its bound to be blocked here!
-
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!! :-)
-
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 :)
-
:-) Feel Better
-
Yeah... I'm home now...
BTW thats a great smile :)
-
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!
-
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 :)
-
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.
-
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.
-
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: