Author Topic: text style replacement  (Read 27887 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
text style replacement
« on: January 03, 2007, 11:02:30 AM »
Hi all,...

first, best wishes for 2007..   :-)

Is there any way to select all text and mtext in the entire drawing including in block, layout, and model space ?

I need to do this:
I have many diffrent text style and need to purge all them and keep only 1.
so I think i need to select all text by filtering them en change style.
But if you have any other idea....i'll keep it !

thanks.
Keep smile...

T.Willey

  • Needs a day job
  • Posts: 5251
Re: text style replacement
« Reply #1 on: January 03, 2007, 11:18:10 AM »
The best way (I think) is to search the block collection, filtering out xrefs, and the checking for text, mtext, attribute references, attribute definitions, constant attributes and tables.  Tables and Mtext you will have to search the string also, because they can have style overrides within the string.  This is how I would do it.
Tim

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

Please think about donating if this post helped you.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: text style replacement
« Reply #2 on: January 03, 2007, 12:36:07 PM »
thanks.... T.Willy..

I was hoping using somting like...

Code: [Select]
  (vlax-for style
    (vla-get-textstyles  (vla-get-activedocument (vlax-get-acad-object)))
            (vla-put-textstyle style "simplex.SHX")
  )
Keep smile...

T.Willey

  • Needs a day job
  • Posts: 5251
Re: text style replacement
« Reply #3 on: January 03, 2007, 12:44:59 PM »
That is not changing the text style of objects, that is changing the font of a text style.  If that is what you want to do, then you can step through the text style collection of a document, and change them from there.
Code: [Select]
(vlax-for Sty (vla-get-TextStyles (vla-get-ActiveDocument (vlax-get-Acad-Object)))
 (vla-put-fontFile Sty "simplex.shx")
)
Tim

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

Please think about donating if this post helped you.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: text style replacement
« Reply #4 on: January 03, 2007, 01:20:30 PM »
ok....thanks...

but how can I use
Code: [Select]
vla-put-textstyle ?
I can't see any exemple on the web..
Keep smile...

LE

  • Guest
Re: text style replacement
« Reply #5 on: January 03, 2007, 01:38:40 PM »
OK...

Convert the selection (of text and mtexts) to vla-objects, then use the below code to change the object to the desired textstyle.

(vla-put-stylename obj "style1")


HTH

Andrea

  • Water Moccasin
  • Posts: 2372
Re: text style replacement
« Reply #6 on: January 03, 2007, 03:49:02 PM »
thanks LE..

Code: [Select]
(setq ss1 (ssget "X" '((0 . "MTEXT,TEXT"))))
(setq sscount (sslength ss1))
(setq val1 (- sscount 1))
(repeat sscount
(setq ent (vlax-ename->vla-object (ssname ss1 val1)))
(vla-put-stylename ent "SIMPLEX")
(setq val1 (- val1 1))
)

Now all I need to do is to verify Attribute and text in existing block..
Keep smile...

T.Willey

  • Needs a day job
  • Posts: 5251
Re: text style replacement
« Reply #7 on: January 03, 2007, 03:57:47 PM »
Now all I need to do is to verify Attribute and text in existing block..
Look at my first response as to how to do this.  Once you do it the way I explained, then you won't need the other code you posted.
Tim

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

Please think about donating if this post helped you.

ronjonp

  • Needs a day job
  • Posts: 7528
Re: text style replacement
« Reply #8 on: January 03, 2007, 04:22:02 PM »
Here is a nice description.......hey it's by TWilley :)

http://www.theswamp.org/index.php?topic=12437.msg154308#msg154308

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

LE

  • Guest
Re: text style replacement
« Reply #9 on: January 03, 2007, 04:37:43 PM »
Now all I need to do is to verify Attribute and text in existing block..
Look at my first response as to how to do this.  Once you do it the way I explained, then you won't need the other code you posted.

Tim;

Maybe it is me, or something in my poor English translation.... but I understood something different... like he wants to select the text,mtext and the inserts.... or I am out of my mind now?, if I am, it will my last post about lisp here, I promissed -  :ugly:


T.Willey

  • Needs a day job
  • Posts: 5251
Re: text style replacement
« Reply #10 on: January 03, 2007, 04:50:37 PM »
Now all I need to do is to verify Attribute and text in existing block..
Look at my first response as to how to do this.  Once you do it the way I explained, then you won't need the other code you posted.

Tim;

Maybe it is me, or something in my poor English translation.... but I understood something different... like he wants to select the text,mtext and the inserts.... or I am out of my mind now?, if I am, it will my last post about lisp here, I promissed -  :ugly:


Luis,

This is the line that makes me think it is more that just selecting text and mtext
Quote from: Andrea
Is there any way to select all text and mtext in the entire drawing including in block, layout, and model space ?
And I hope you don't stop posting in the lisp section.  You are a tremendous help here.  Many people still don't know what you know about lisp.

Here is a nice description.......hey it's by TWilley :)

http://www.theswamp.org/index.php?topic=12437.msg154308#msg154308
Thanks Ron.  I forgot I did that.  :-D  This will help with the basic idea, but what Andrea is after is a little different, but this shows how to go through the block collections.
Tim

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

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: text style replacement
« Reply #11 on: January 03, 2007, 06:21:08 PM »
This is what Andrea said:
Quote
I need to do this:
I have many different text style and need to purge all them and keep only 1.
The way I read it is he wants all text styles deleted & only one left in the drawing.
This takes way more work. You need to change dimension styles & overrides, Fileds,
attributes, tables, text within blocks, plain text, and mtext. Did I miss anything?
Only the xrefs would be exempt from the process.
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.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: text style replacement
« Reply #12 on: January 03, 2007, 10:25:25 PM »
Sorry guys....

My english seem to be not better than 2006 !

In fact,...I need to keep all existing text, including text and/or attribute in block,
and change the style.

something like...
Code: [Select]
(vlax-PUT-ALLTEXTSTYLE "SIMPLEX")
Keep smile...

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: text style replacement
« Reply #13 on: January 03, 2007, 10:52:44 PM »
"SIMPLEX" is a FontName

Do you mean change the 'TextStyle' or change the 'FontName'

I dont think the problem is your English.
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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: text style replacement
« Reply #14 on: January 03, 2007, 10:57:00 PM »
You mentioned
Quote
purge all them and keep only 1

.. is this still the case ?


Here's a thought .. If you were to do this process by hand how would you do it .. exactly.
Then we will know what result you want .. exactly.
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.