Author Topic: text style replacement  (Read 27577 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: text style replacement
« Reply #45 on: January 07, 2007, 09:21:42 PM »
Wasn't trying to put you ( or anyone else ) onto a guilt trip Mike.

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.

M-dub

  • Guest
Re: text style replacement
« Reply #46 on: January 07, 2007, 09:36:23 PM »
I know...
I was jus' sayin'  :)

Joe Burke

  • Guest
Re: text style replacement
« Reply #47 on: January 08, 2007, 07:42:50 AM »
Quote
some client have standard.....
one of these want only SIMPLEX style in drawings..in 5 specific layers, all block created to layer "0" etc....
but we receive some drawing from architect and diffrent other discipline who work with there standard.
so when we receive these drawing we always need to clean all textstyle and fonts before returning the drawing to the client.

To obtain in the drawing this final result of textstyle:

Standard and SIMPLEX

I understand what you want to do and why. I'm just suggesting you don't need code because CAD Standards can do it. And it would do a better job than what Tim posted. As he said, "It won't change the text (style) for dim styles, or for formated mtext."

CAD Standards would get rid of any unwanted text styles contained in dimstyles. And it purges unwanted items, those which were replaced, in the process.

Regarding Tim's comment about formatted mtext, that is, or should be, a concern. If an mtext string looks like this, "{\\Fromans|c0;SEE ROOF PLAN}" it will display using ROMANS regardless of what the style name property is. To fix that there's John Uhden's Unformat function. It allows removal of font formatting in mtext without changing other formatting codes which you'd probably want to keep.

Tim,

If you read this, I trust you know it's not meant as criticism. Basically I'm just underlining what you said.
« Last Edit: January 08, 2007, 07:44:51 AM by Joe Burke »

Andrea

  • Water Moccasin
  • Posts: 2372
Re: text style replacement
« Reply #48 on: January 08, 2007, 09:31:08 AM »
just a little thing...
the code works perfectly since I got a new drawing from client...
the..
Code: [Select]
....     (if (not IsLo)
      (vla-put-Layer Obj "0")......
section seem to work.....but even with regenall or
Code: [Select]
(vla-Regen (vla-get-ActiveDocument (vlax-get-Acad-Object)) acActiveViewport)all blocks seem to not being refreshed...(<- is this a english word ?)  :|

What do you think Tims code should do to the blocks Andrea ?

Yes,..

Andrea,
Do you think you maybe misunderstood Kerry's question?  He's asking how the code should affect the blocks, not if it should affect the blocks.

just throwing a little hint out there ;)

By extracting each entity of it and change layer.
Keep smile...

T.Willey

  • Needs a day job
  • Posts: 5251
Re: text style replacement
« Reply #49 on: January 08, 2007, 11:24:52 AM »
Tim,

If you read this, I trust you know it's not meant as criticism. Basically I'm just underlining what you said.
No problem at all Joe.  I was going to show how a formatted string looked like, but couldn't seem to get one to work right.  One thing I did learn from this is that you can't have formatted strings in a Table object.  Don't know if it will ever be useful, but it is something I learned.

As for stripping out formats with mtext strings, here is one I wrote a little while ago (couple of years maybe).
Code: [Select]
(defun StripString (String / cstr1 cstr2 nString cnt1 tstr1)
; Strips out formation for color, font, height and width.

(setq cnt1 1)
(while (and (setq cstr1 (substr String 1 1)) (> (strlen String) 0))
 (if (= cstr1 "\\")
  (progn
   (setq cstr2 (substr String 2 1))
   (if (member (strcase cstr2) '("C" "F" "H" "W"))
    (progn
     (while (/= (substr String cnt1 1) ";")
      (setq cnt1 (1+ cnt1))
     ); while
     (setq String (substr String (1+ cnt1) (strlen String)))
     (setq cnt1 1)
    ); progn
    (progn
     (if nString
      (setq nString (strcat nString (substr String 1 1)))
      (setq nString (substr String 1 1))
     ); if
     (setq String (substr String 2 (strlen String)))
    ); progn
   ); if
  ); progn
  (progn
   (if nString
    (setq nString (strcat nString (substr String 1 1)))
    (setq nString (substr String 1 1))
   ); if
   (setq String (substr String 2 (strlen String)))
  ); progn
 ); if
); while
(setq tstr1 (vl-string->list nString))
(if (and (not (member 92 tstr1)) (member 123 tstr1))
 (setq tstr1 (vl-remove-if '(lambda (x) (or (= x 123) (= x 125))) tstr1))
); if
(vl-list->string tstr1)
)

By extracting each entity of it and change layer.
The code doesn't care about the objects within the blocks that are not text oriented.  If you want it to change all objects in the block, then you will have to add some stuff to the code.  It shouldn't be too hard, so I will leave it up to you to try.
Tim

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

Please think about donating if this post helped you.