how to Change Dimension Text Color to True color

how to Change Dimension Text Color to True color

jyan2000
Advocate Advocate
897 Views
11 Replies
Message 1 of 12

how to Change Dimension Text Color to True color

jyan2000
Advocate
Advocate

Hello Forms

 

How do I change dimension text color to True Color like ( 255,0,0) ? I found a code (below) changes whole layers.

 

(setq col (vla-get-TrueColor lay))
(apply 'vla-SetRGB (cons col (mapcar '(lambda (n) (fix (* n 255))) (list (random nil) (random nil) (random nil)))))
(vla-put-TrueColor lay col))

 

I need specific Dimentionsyle's text color to be True color.  

 

Best Regards

Victor.

0 Likes
898 Views
11 Replies
Replies (11)
Message 2 of 12

pbejse
Mentor
Mentor

@jyan2000 wrote:

I need specific Dimentionsyle's text color to be True color.  


You are referring the the DimStyle text color and not to override dimension objects Text color ?

If its the former, I'm wondering why not do the task in Dimension Style Manager and the latter with Properties ( ctrl+1 ) for objects?

 

0 Likes
Message 3 of 12

jyan2000
Advocate
Advocate

Thanx for reply. I know that method changing DIMCLRT to true color in dimstyle manager . However I have a continuous  form of lisp must edit DIMCLRT to true color.. 

 


(defun c:ChangeDimTXTClr_LWeight ()

(Command "DIMCLRD" "256")
(Command "DIMCLRE" "256")
(Command "DIMCLRT" "256")
(Command "DIMSD1" "On")
(Command "DIMSD2" "On")
(Command "DIMSE1" "On")
(Command "DIMSE2" "On")
(Command "DIMSOXD" "On")
(Command "DIMTAD" "0")
(Command "DIMTXSTY" "ByZ")

(Command "DIMDEC" "0")
(Command "DIMTXT" "1.13")
(Command "DIMTIH" "Off")
(Command "DIMTOH" "Off")
(Command "DIMPOST" "0")
(Command "DIMTFILL" "1")

(setq SelectDim (ssget "_A" '((0 . "DIMENSION") (3 . "ByZ"))))
(command "._Chprop" SelectDim "" "c" "121" "LW" "0.09" "" "")
(princ))

0 Likes
Message 4 of 12

tanbqtb03
Contributor
Contributor

If you can, please help me a lisp to convert all objects (line, text, block.....) selected from true color <-> index color. Thanks a lot

0 Likes
Message 6 of 12

Kent1Cooper
Consultant
Consultant

The DIMCLRT System Variable for the drawing as a whole doesn't seem to like being given a value other than a 1-255 index number.  BUT I find this works to change the Dimension Text color setting of a Dimension Style [in this case, STANDARD], as an entity, to a TrueColor value [I picked a random value]:

 

(setpropertyvalue (tblobjname "dimstyle" "STANDARD") "dimclrt" "70,80,90")

 

It would not be hard to step through the Dimension Style Table and assign the same TrueColor value to each Dimension Style.

 

And likewise to any already-drawn Dimension objects, if desired, substituting their entity names for that (tblobjname) function.

Kent Cooper, AIA
Message 7 of 12

pbejse
Mentor
Mentor

@jyan2000 wrote:

Thanx for reply. I know that method changing DIMCLRT to true color in dimstyle manager . However I have a continuous  form of lisp must edit DIMCLRT to true color.. 


Correct me if I'm wrong, what you're doing there is overriding the dimension variables but NOT saving it at all.

 

pbejse_0-1680091309868.png

You can add this line at the end, then remove the ssget and Chprop bit 

 

(command "_.dimstyle" "_save" "ByZ" "_yes")

 

Are you only wanting to change the TEXT color as an Override?

Message 8 of 12

Sea-Haven
Mentor
Mentor

Pbejse thinking the same thing.

 

(cons 178 256); DIMCLRT color of text 256 is ByLayer. I am sure it can be a RGB also.

 

(vlax-put (vlax-ename->vla-object (car (nentsel "Pick dim text"))) 'Color 4)
(command "regen")

 

I think for true color need to edit the AcCm....

TrueColor = #<VLA-OBJECT IAcadAcCmColor 000000007ACC8768>

Message 9 of 12

komondormrex
Mentor
Mentor

since changing dim text color is sort of overriding some set value, it cannot be programmed directly and with ease, but surely it can be done. 

0 Likes
Message 10 of 12

Kent1Cooper
Consultant
Consultant

@jyan2000 wrote:

....

I need specific Dimentionsyle's text color to be True color.  

....


Message 6 does exactly that, but it also occurs to me....  Is there some reason not to have the Dimension Style's text color be ByLayer, and just set the True color value to the Layer on which you put those Dimensions?  You can assign other colors to the other parts, if you don't want them the same color as the text.

Kent Cooper, AIA
0 Likes
Message 11 of 12

komondormrex
Mentor
Mentor

i think the op wants to differentiate some dimensions within certain dimension style with rgb color, otherwise it has no sense, since you may create as many styles with different colored dimension text as you want. 

0 Likes
Message 12 of 12

Kent1Cooper
Consultant
Consultant

@komondormrex wrote:

i think the op wants to differentiate some dimensions within certain dimension style with rgb color, .... 


I don't think so, because of the wording in the part of Message 1 that I quoted in Message 10.

Kent Cooper, AIA
0 Likes