Author Topic: Reactor? Change color of text if specific attribute tag edited.  (Read 1853 times)

0 Members and 1 Guest are viewing this topic.

jlogan02

  • Bull Frog
  • Posts: 327
Reactor? Change color of text if specific attribute tag edited.
« on: February 27, 2020, 12:48:21 PM »
The attached image shows text place holders in green and color 15. Color 15 represents "future condition".
The approval stamp is attributed with each initials line being a separate tag.

So...
If tag1, tag2 and tag5 are edited, change their color to green.

How do I get the color property of a specific tag in an attribute?

J.
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

jlogan02

  • Bull Frog
  • Posts: 327
Re: Reactor? Change color of text if specific attribute tag edited.
« Reply #1 on: February 27, 2020, 12:59:10 PM »
attached image
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

Dlanor

  • Bull Frog
  • Posts: 263
Re: Reactor? Change color of text if specific attribute tag edited.
« Reply #2 on: February 27, 2020, 01:17:32 PM »
Code - Auto/Visual Lisp: [Select]
  1. (if (vlax-method-applicable-p blk 'getattributes) (setq atts (vlax-invoke blk 'getattributes))) ;;blk is a block object
  2.  
  3. (if (= :vlax-true (vlax-get-property blk 'hasattributes)) (setq atts (vlax-invoke blk 'getattributes))) ;; this is probably better though, again blk is a block object
  4.  
  5. (foreach att atts
  6.   (princ (strcat (vlax-get att 'tagstring) " : " (itoa (vlax-get att 'color))))
  7. )
  8.  
« Last Edit: February 29, 2020, 01:31:20 AM by Dlanor »

rayakmal

  • Newt
  • Posts: 49
Re: Reactor? Change color of text if specific attribute tag edited.
« Reply #3 on: February 28, 2020, 08:43:12 PM »
Code - Auto/Visual Lisp: [Select]
  1. (if (vlax-method-applicable-p blk 'getattributes) (setq atts (vlax-invoke blk 'getattributes))) ;;blk is a block object
  2.  
  3. (if (= :vlax-true (vlax-get-property blk 'hasattributes)) (setq atts (vlax-invoke blk 'getattributes))) ;; this is probably better though, again blk is a block object
  4.  
  5. (foreach att atts
  6.   (princ (strcat (vlax-get att 'tagstring) " : " (atoi (vlax-get att 'color))))
  7. )
  8.  

I think (atoi (vlax-get att 'color)) should become (itoa (vlax-get att 'color))

Dlanor

  • Bull Frog
  • Posts: 263
Re: Reactor? Change color of text if specific attribute tag edited.
« Reply #4 on: February 29, 2020, 01:30:55 AM »
Quote
I think (atoi (vlax-get att 'color)) should become (itoa (vlax-get att 'color))

You're right.  :uglystupid2:  Corrected above