TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: mhcadman on April 02, 2008, 08:10:07 PM

Title: Manipulate existing text
Post by: mhcadman on April 02, 2008, 08:10:07 PM
PLEASE HELP!!!!
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 then right-click to accept.

After the right-click, 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" would 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.

(bribes will be considered  :-) )

Sincerely,
Mike
Title: Re: Manipulate existing text
Post by: kdub_nz on April 02, 2008, 10:27:41 PM

How many do you need to change ?

just to put things in perspective, it will take about 6 seconds to change those with the Properties dialog/palette.


and about 10 seconds to remember the name and load the special program to do it automagically.
Title: Re: Manipulate existing text
Post by: CAB on April 02, 2008, 11:54:20 PM
Welcome to the Swamp Mike.

Creating STYLES & Layer's is easy in lisp via the command.
Also there are several subroutines found in these threads to do just that.

If you are selecting the text why do you need a Right Click to confirm?
Why would you select the text if you are not wanting to change it?

Do you know some lisp programing?

Do you want to select each text to change one at a time?

We can get you going but we need a little more information.
Title: Re: Manipulate existing text
Post by: daron on April 03, 2008, 12:56:05 AM
One question that comes to mind right off the bat is: is this plain text or is there the possibility of Mtext? It does make a difference.
Title: Re: Manipulate existing text
Post by: mhcadman on April 03, 2008, 10:54:55 AM
Thank you for your replies!

The lsp will be placed in a toolbar button so the 10 seconds argument is out.

I was using the "6 second change text via propties box" which gets old after about a hundred times and clicking the "text contents box" getting to the beginning of the text and entering %%u, more clicking finding the correct "style", more clicking and entering the "height" and more clicking to enter the "layer".

Mostly it's PLAIN text, seldom MTEXT.

I would not purposely select text i did not want to change.

Isolating the text layer then selecting them all at once then changing them with this new lsp would be great!

It doesn't have to have a right click to accept, in fact, if i pick the text and the lsp changes it instantly without any further intervention on my part, perfect.

I am still learning acad lsp, obviously.
Give me Microstation UCM or BAS any time.
Title: Re: Manipulate existing text
Post by: CAB on April 03, 2008, 11:24:39 AM
So first things first. You need pseudo code.

Here is my pseudo code. Please correct any miss understandings.



Answer these What IF questions:
Layer of text is locked?
Layer "CY1" exist & is locked?
Characters "PLAN" is missing?
Do you need to match the identifying Text objects characters exactly?
Do you need to match Character Case exactly? Upper/lower