Author Topic: Text Sytle  (Read 1751 times)

0 Members and 1 Guest are viewing this topic.

Fabricio28

  • Swamp Rat
  • Posts: 670
Text Sytle
« on: May 29, 2013, 02:57:01 PM »
Hi guys,
I'm trying to find if there are texts in my drawing that belong Standard Style, ROMAN and so on.
Is it possible find out a specific textstyle that exist in my drawing using lisp?

Let me explain better my task. In my drawing i created a linetype in standard style, but now i have to modify this linetype put 0 (zero) height.
I'd like to know if there are any text in my drawing that belong standard style before I change the height to 0 (zero).

Thank in advance
« Last Edit: May 29, 2013, 03:03:50 PM by FABRICIO28 »

alanjt

  • Needs a day job
  • Posts: 5353
  • Standby for witty remark...
Re: Text Sytle
« Reply #1 on: May 29, 2013, 03:14:10 PM »
?

Code: [Select]
(defun _usedTextStyles (blocks / style lst)
  (vlax-for block blocks
    (vlax-for x block
      (if
        (and (setq style (cond
                           ((vlax-property-available-p x 'StyleName) (vla-get-stylename x))
                           ((vlax-property-available-p x 'TextStyleName) (vla-get-textstylename x))
                         )
             )
             (not (member style lst))
        )
         (setq lst (cons style lst))
      )
    )
  )
  (vl-sort lst '<)
)

eg.
Code: [Select]
(_usedTextStyles (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))))
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Text Sytle
« Reply #2 on: May 29, 2013, 03:26:08 PM »
If you can delete the text style it is not in use.
Otherwise you may need to step through the database looking for that text style.
Another option is to ssget all TEXT & MTEXT and step through that selection set if blocks, fields & attributes are not to be considered.

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.

Fabricio28

  • Swamp Rat
  • Posts: 670
Re: Text Sytle
« Reply #3 on: May 29, 2013, 05:02:52 PM »
Thank you Alan,

Can I selected just the texts belong textstyle Standard my drawing?

Because your code is great, I know that exist standard. But I don't know which one is standard to delete or not.

Regards

alanjt

  • Needs a day job
  • Posts: 5353
  • Standby for witty remark...
Re: Text Sytle
« Reply #4 on: May 29, 2013, 05:05:01 PM »
Thank you Alan,

Can I selected just the texts belong textstyle Standard my drawing?

Because your code is great, I know that exist standard. But I don't know which one is standard to delete or not.

Regards
Well, mine works in a sense that it checks the entire drawing database, so it will also check anything existing within blocks. Are you just interested in what can readily be selected in the drawing itself, not what's in the database?
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Fabricio28

  • Swamp Rat
  • Posts: 670
Re: Text Sytle
« Reply #5 on: May 29, 2013, 05:12:32 PM »
Yes Alan,
I'm not interested what's in the database.

I'd like select just the textstyle in my drawing.

Lee Mac

  • Seagull
  • Posts: 12934
  • London, England
Re: Text Sytle
« Reply #6 on: May 29, 2013, 05:29:36 PM »
For non-nested Text/MText only:

Code - Auto/Visual Lisp: [Select]
  1. (sssetfirst nil (ssget "_X" '((0 . "TEXT,MTEXT") (7 . "Standard"))))

Fabricio28

  • Swamp Rat
  • Posts: 670
Re: Text Sytle
« Reply #7 on: May 29, 2013, 05:38:45 PM »
Thanks Mr. Lee

It's exactly I was looking for.

@ CAB and Alanjt

Thank very much, too.

Best Regards
 :-D