Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

change TEXT lisp

1,903 views
Skip to first unread message

Scott Mc

unread,
Apr 2, 1998, 3:00:00 AM4/2/98
to

Forgive me if this has already been posted elsewhere.

I'm a real beginner at lisp, but I'm having a blast.

I'm looking for a SHORT routine that will allow me to select
a group of text, and change it to another defined style.

For example (for you civil guys, and gals)...
a few lines of text in L120 are too big (work with me here),
I want to change them to L100.

I'd like to be able to type in "CL100", select my text to change to
L100, (not one at a time, using a crossing window), and walla!

Text is now L100.

I can do this to say, change enitity colors to red, etc., or to change a
group of objects to a different layer, but I don't know how to get
something like this to change text styles...

If this is really easy, don't laugh at me; like I said, I'm a beginner!

Thanks for all your help.
Scott

Alex Lepeska

unread,
Apr 2, 1998, 3:00:00 AM4/2/98
to

On Thu, 02 Apr 1998 13:26:06 -0800, Scott Mc <WeSu...@aol.com>
wrote:

>I'm looking for a SHORT routine that will allow me to select
>a group of text, and change it to another defined style.
>

AutoCAD comes with a routine called CHTEXT.lsp in the bonus utilities.
Check there and see if it is. It will either be already on your drive
or it may be on the CD if the FULL install wasn't performed. It
would be nice to know which release this was for so I could be of
better assistance in a response.

Otherwise I'd suggest going to one of the CAD sharware websites and
searching there.


-
Alex

Scott Mc

unread,
Apr 2, 1998, 3:00:00 AM4/2/98
to

For r14...

I've used chtext, as well as many others; I'm actually just looking for
a short, quick one to use on the fly...

Thanks for you thoughts though.
I've checked a lot of other resources, CADSHACK, CADALOG, etc. and found
some nice routines,
but not exactly the one I want, you know how it goes.

this works great for me for changing colors; I'm looking for something
similar:

(defun c:cc1 (/ a)
(prompt "\nselect entity to change to color RED")
(setq a (ssget))
(command "chprop" a "" "c" "1" "")(prin1))

Thanks again
Scott

Clayton Harrison

unread,
Apr 2, 1998, 3:00:00 AM4/2/98
to

Here's a couple you might try.

Clayton

;;CTS.LSP R. CLAYTON HARRISON;
;;CHANGE TEXT STYLE
;;*************************************************************;
;;
(defun c:CTS (/ sset Tpick Tname count TextE)
(command "cmdecho" "0")
(setq sset (ssget '((0 . "text"))))
(while (null sset) (setq sset (ssget '((0 . "text")))))
(setq Tname (getstring "\nChange to what text style?: "))
(setq count 0)
(while (/= nil (setq TextE (ssname sset count)))
(command "change" TextE "" "" "" Tname "" "" "")
(setq count (1+ count))
)
(princ)
);;end CTS.lsp RCH 04-02-98

;MT.LSP R. CLAYTON HARRISON;
;MATCH TEXT STYLE BY PICK
;*************************************************************;
;
(defun c:MT (/ sset Tpick Tname count TextE)
(setq sset (ssget '((0 . "text"))))
(while (null sset)(setq sset (ssget '((0 . "text")))))
(setq Tpick (entsel "\nPick text style to match to: "))
(while (null Tpick)(setq Tpick (entsel)))
(setq Tname (cdr (assoc 7 (entget (car Tpick)))))
(princ Tname)(princ)
(setq count 0)
(while (/= nil (setq TextE (ssname sset count)))
(command "change" TextE "" "" "" Tname "" "" "")
(setq count (1+ count))
)
(princ)
);end MT.lsp RCH 07-24-94

Dave Jones

unread,
Apr 3, 1998, 3:00:00 AM4/3/98
to

Scott,
have you checked Henry Francis' site. He has lots of text editing
routines. Don't know the URL but there's a link on my site on the
Cadlinks page. Also might want to check out my Lisp/Text page while
you're there.

regards,
Dave
www.ddpburney.com

On Thu, 02 Apr 1998 16:47:56 -0800, Scott Mc <WeSu...@aol.com>

Terry W. Dotson

unread,
Apr 3, 1998, 3:00:00 AM4/3/98
to

Scott Mc wrote:

> I'm looking for a SHORT routine that will allow me to select
> a group of text, and change it to another defined style.
>

> For example (for you civil guys, and gals)...
> a few lines of text in L120 are too big (work with me here),
> I want to change them to L100.
>
> I'd like to be able to type in "CL100", select my text to change to
> L100, (not one at a time, using a crossing window), and walla!
>
> Text is now L100.

It has been three years since I ran Softdesk, and 15 years since I Leroyed,
but since you are changing the height:

Won't that create gaps between lines if the new height is smaller and
overlaps if the new height is larger?

The concept should work fine on randomly placed individual text though.

Terry

Scott Mc

unread,
Apr 3, 1998, 3:00:00 AM4/3/98
to

Dave Jones wrote:
>
> Scott,
> have you checked Henry Francis' site. He has lots of text editing
> routines. Don't know the URL but there's a link on my site on the
> Cadlinks page. Also might want to check out my Lisp/Text page while
> you're there.
>
> regards,
> Dave
> www.ddpburney.com
>
> On Thu, 02 Apr 1998 16:47:56 -0800, Scott Mc <WeSu...@aol.com>
> wrote:
>
> >Alex Lepeska wrote:
> >>
> >> On Thu, 02 Apr 1998 13:26:06 -0800, Scott Mc <WeSu...@aol.com>
> >> wrote:
> >>
> >> >I'm looking for a SHORT routine that will allow me to select
> >> >a group of text, and change it to another defined style.
> >> >
> >>
> >> AutoCAD comes with a routine called CHTEXT.lsp in the bonus utilities.
> >> Check there and see if it is. It will either be already on your drive
> >> or it may be on the CD if the FULL install wasn't performed. It
> >> would be nice to know which release this was for so I could be of
> >> better assistance in a response.
> >>
> >> Otherwise I'd suggest going to one of the CAD sharware websites and
> >> searching there.
> >>
> >> -
> >> Alex
> >
> >For r14...
> >
> >I've used chtext, as well as many others; I'm actually just looking for
> >a short, quick one to use on the fly...
> >
> >Thanks for you thoughts though.
> >I've checked a lot of other resources, CADSHACK, CADALOG, etc. and found
> >some nice routines,
> >but not exactly the one I want, you know how it goes.
> >
> >this works great for me for changing colors; I'm looking for something
> >similar:
> >
> >(defun c:cc1 (/ a)
> > (prompt "\nselect entity to change to color RED")
> > (setq a (ssget))
> > (command "chprop" a "" "c" "1" "")(prin1))
> >
> >Thanks again
> >Scott


Thanks, I'll see if I can't find it.
Scott

Scott Mc

unread,
Apr 3, 1998, 3:00:00 AM4/3/98
to


That's what I'm after, I appreciate your help!
Thank you much...
Scott

Scott Mc

unread,
Apr 3, 1998, 3:00:00 AM4/3/98
to

Terry W. Dotson wrote:

>
> Scott Mc wrote:
>
> > I'm looking for a SHORT routine that will allow me to select
> > a group of text, and change it to another defined style.
> >
> > For example (for you civil guys, and gals)...
> > a few lines of text in L120 are too big (work with me here),
> > I want to change them to L100.
> >
> > I'd like to be able to type in "CL100", select my text to change to
> > L100, (not one at a time, using a crossing window), and walla!
> >
> > Text is now L100.
>
> It has been three years since I ran Softdesk, and 15 years since I Leroyed,
> but since you are changing the height:
>
> Won't that create gaps between lines if the new height is smaller and
> overlaps if the new height is larger?
>
> The concept should work fine on randomly placed individual text though.
>
> Terry

I'm lookin' for random text, usually a note the boss put in the drawing
at L350 :-(

Jeff Foster

unread,
Apr 3, 1998, 3:00:00 AM4/3/98
to

Scott,

I am including the code below that should do exactly what you need, though a
little different format that what you want. The format is as follows:

Command: (chgstyle "stylename")

What you do is substitute the actual style name in place of stylename above.

You will then be prompted to select a group of entities. It will filter through
any entities and process only text entities. Clip the text below and save to
file name, CHGSTYLE.lsp

;Start here --------------------------------------------------------------------
;CHGSTYLE.lsp 04/03/98 Jeff Foster
;
;OBJECTIVE***
;The purpose of this routine is to allow the user to select a block of
;text and change it to another style by entering (CHGSTYLE "stylename")
;where "stylename" is the new style contained by quotes
;
;TO RUN***
;At the command line, type (load "c:/lispdir/chgstyle")
;where c:/ is the drive where CHGSTYLE.lsp is contained
;where lispdir/ is the directory where CHGSTYLE.lsp is contained
;
;
;If you find this routine to be helpful, please give consideration
;to making a cash contribution of $10.00 to:
; Jeff Foster
; PO Box 1936
; Garner, NC 27529
;

(Defun CHGSTYLE (styl)
(setq chk_quote (type styl))
(if (= chk_quote 'STR)
(setq is_styl (tblsearch "STYLE" styl))
)
(if (= chk_quote nil)
(progn
(setq styl "nil")
(setq is_styl (tblsearch "STYLE" (strcat "\"" styl "\"")))
)
)
(if (/= is_styl nil)
(PROCESS)
(progn
(prompt (strcat "\nStyle <" styl "> does not exist"))
(princ)
)
)
)

(Defun PROCESS ()
(prompt "\nSelect a block of text: ")
(setq ss (ssget))
(if (= ss nil)
(PROCESS)
(setq ss_nam (ssname ss 0))
)
(while (/= ss_nam nil)
(setq
e_inf (entget ss_nam)
e_type (cdr (assoc 0 e_inf))
)
(if (= e_type "TEXT")
(progn
(setq
e_styl (assoc 7 e_inf)
e_inf (subst (cons 7 styl) e_styl e_inf)
)
(entmod e_inf)
(ssdel ss_nam ss)
(setq ss_nam (ssname ss 0))
)
(progn
(ssdel ss_nam ss)
(setq ss_nam (ssname ss 0))
)
)
)
)

(prompt "\Enter \(CHGSTYLE \"stylename\"\) where stylename is the style to
switch to")
(princ)
;End here ---------------------------------------------------------------------

Hope this helps.

Jeff Foster
CAD Specialist, McKim & Creed
http://www.mckimcreed.com
Owner, The CAD Shack
http://www.cadshack.com


->
->For r14...
->
->I've used chtext, as well as many others; I'm actually just looking for
->a short, quick one to use on the fly...
->
->Thanks for you thoughts though.
->I've checked a lot of other resources, CADSHACK, CADALOG, etc. and found
->some nice routines,
->but not exactly the one I want, you know how it goes.
->
->this works great for me for changing colors; I'm looking for something
->similar:
->
->(defun c:cc1 (/ a)
-> (prompt "\nselect entity to change to color RED")
-> (setq a (ssget))
-> (command "chprop" a "" "c" "1" "")(prin1))
->
->Thanks again
->Scott


Scott Mc

unread,
Apr 3, 1998, 3:00:00 AM4/3/98
to


Thank you Jeff, appreciate your time!
Scott

0 new messages