Author Topic: Changing text color/layer in a Block, Multiple per drawing, multiple drawings  (Read 2676 times)

0 Members and 1 Guest are viewing this topic.

Beast Rabban

  • Mosquito
  • Posts: 2
Good morning all,

I have an attributed instrument block "PD7D" on our P&ID's that has three lines of text inside the bubble and the E&I guys want to change the text to red so it stands out/easier to find. The block appears multiple instances per drawing and on a ton of drawings and while I can easily change this in the EAE (Properties tab) then use BATTMAN to sync it across every block on the open drawing, I'm trying to avoid opening drawings one at a time across a minimum of 300 P&ID's.

My apologies in advance but I've been scouring the site here for two days and either my search terms suck or I'm just not recognizing the information I'm looking for and both of these are very possible. I will say along the way I've found some kickass .lsp's :)

Happy Thanksgiving to all!


  • Administrator
  • Seagull
  • Posts: 10675
Welcome. Yes this place has always been home to some extremely talented programmers (most programmed in multiple languages).

Not the most productive but a simple lisp (visual lisp) to select a block and change it's attributes color (just for a quick demonstration).

Obviously for a lot of drawings you'd want to script the process and we'd have to make a routine to change the colors using AutoLisp so you could use accoreconsole or something more automated. I just don't have time (and ability) to make a version that uses entmake.

Code - Auto/Visual Lisp: [Select]
  1. (defun c:chred ()
  2.  ( (lambda ()
  3.     (setq _block (vlax-ename->vla-object (car (entsel))))
  4.     (if (vlax-method-applicable-p _block 'getattributes)
  5.      (setq _attributes (vlax-invoke _block 'getattributes)))
  6.     (if (= :vlax-true (vlax-get-property _block 'hasattributes))
  7.      (setq _attributes (vlax-invoke _block 'getattributes)) )
  8.     (foreach _attribute _attributes (vla-put-Color _attribute 1))
  9.    )
  10.  )
  11. ) (serving the CAD community since 2003)
Member location map - Add yourself

Donate to

Beast Rabban

  • Mosquito
  • Posts: 2
Thank you John that works beautifully! They are letting us go early for the holiday so I'll fool with it more next week. Thanks again and be safe!