View Full Version : Dim Variable Help
clintr
2011-05-05, 07:20 PM
I need to change the text color for dimensions. The variable to control dimension text color is DIMCLRT. However, it applies an override to the dimension style and only changes the color for new dimensions. I need it to modify the color for the current style and to any dimensions already in the drawing. I would prefer not to have to go into the dimstyle dialog box for every drawing to change the color.
Is there a way to change the color of the dimension text for the current style without making an override? I need it to be on the command line, so I can record a macro or make a button.
Does my question make sense? Please help. We are currently using version 2010.
-Clint
BlackBox
2011-05-05, 07:49 PM
Try writing a custom LISP routine which steps through a Selection Set of dimensions, modifying the TextColor Property of each Dim* Object.
If you have difficulty, post your code, and I'll help you out.
cadtag
2011-05-05, 08:28 PM
Renderman -- that would apply a per-object over-ride to all dim text. If I'm understanding the OPs request, he needs to redefine the dimstyle, and then update all the dims to the corrected dimstyle.
Since he specified "Macro" - it's possible that he's running LT and can't access LISP
BlackBox
2011-05-05, 08:33 PM
Renderman -- that would apply a per-object over-ride to all dim text. If I'm understanding the OPs request, he needs to redefine the dimstyle, and then update all the dims to the corrected dimstyle.
Perhaps I've misunderstood the request.
As I understood it, the OP can/has changes the noted SysVar, which fails to update the Dims... that is where my suggestion *may* be of value.
Since he specified "Macro" - it's possible that he's running LT and can't access LISP
Without more information from the OP, we can only speculate.
If that is the case, then (OP) please disregard my earlier suggestion.
Cheers! :beer:
clintr
2011-05-05, 08:34 PM
Since he specified "Macro" - it's possible that he's running LT and can't access LISP
We are using AutoCAD Architecture. My knowledge of LISP is very limited. I've always been able to achieve what I need by creating macros.
BlackBox
2011-05-05, 08:37 PM
My thought, and I could be incorrect, was that if one changes the dimclrt system variable, the follows my earlier suggest action(s), being sure to specify (vla-put-textcolor oDim acByLayer) would effectively accomplish the OP's stated goal. No?
(^^ Untested ^^)
BlackBox
2011-05-05, 08:40 PM
We are using AutoCAD Architecture. My knowledge of LISP is very limited. I've always been able to achieve what I need by creating macros.
Don't let the word-play be confusing. I have several 'macros' (i.e., Toolbar/Ribbon buttons) which execute LISP routines.
I'll see if I can't test my theory first, then post the code if it works.
clintr
2011-05-05, 08:48 PM
My thought, and I could be incorrect, was that if one changes the dimclrt system variable, the follows my earlier suggest action(s), being sure to specify (vla-put-textcolor oDim acByLayer) would effectively accomplish the OP's stated goal. No?
(^^ Untested ^^)
When I use the dimclrt var it creates a dimension override for that style, thus not modifying any existing dimensions in the drawing. I do not need a override, just a quick easy way to modify the dimension style already in the drawing. I could acomplish this in the dimension style dialog box but it's a lot of clicks for a lot drawings that need to be converted.
I'm not "confused" I understand your "word-play".
Thanks for looking at this.
jaberwok
2011-05-05, 09:04 PM
I need to change the text color for dimensions. The variable to control dimension text color is DIMCLRT. However, it applies an override to the dimension style and only changes the color for new dimensions. I need it to modify the color for the current style and to any dimensions already in the drawing. I would prefer not to have to go into the dimstyle dialog box for every drawing to change the color.
Is there a way to change the color of the dimension text for the current style without making an override? I need it to be on the command line, so I can record a macro or make a button.
Does my question make sense? Please help. We are currently using version 2010.
-Clint
I think this should work -
-dimstyle
r
<dimension style name>
dimclrt
<colour number or name>
-dimstyle
s
<dimension style name>
y
dim
up
all
- as a script.
BlackBox
2011-05-05, 09:13 PM
Well OP, I was going to reply to your post, but you've deleted it. :roll:
Edit - Scratch that, pulled it from my Inbox:
Please clarify.
It does not work because style name is not the same as variable. I tried this earlier but cannot find a way to actually change any of the variables. It seems that this command is only for reviewing the variables and not actually changing them. Thanks.
(command "._-dimstyle" "_a")
For those that might not care about overrides:
(defun c:DTC () (c:DimTextColor))
(defun c:DimTextColor ( / ss color)
(princ "\rDIM TEXT COLOR ")
(vl-load-com)
(if (and (setq ss (ssget "_x" '((0 . "DIMENSION"))))
(not (initget 7))
(setq color (getint "\nEnter color for DIM text (between 1 & 256): "))
(< 0 color)
(>= 256 color))
(progn
(vla-startundomark
(cond (*activeDoc*)
((setq *activeDoc*
(vla-get-activedocument
(vlax-get-acad-object))))))
(if (/= color (getvar 'dimclrt))
(setvar 'dimclrt color))
(vlax-for oDim (setq ss (vla-get-activeselectionset *activeDoc*))
(vla-put-textcolor oDim color))
(vla-endundomark *activeDoc*)
(vla-delete ss))
(cond (ss (prompt "\n** Invalid color entered ** "))
(T (prompt "\n** Nothing selected ** "))))
(princ))
clintr
2011-05-05, 09:14 PM
I think this should work -
-dimstyle
r
<dimension style name>
dimclrt
<colour number or name>
-dimstyle
s
<dimension style name>
y
- as a script.
Yes, it appears that it does work. I'll have to study this for a minute. I tried using -dimstyle earlier today but did not understand what it was trying to do. I thought it would let me change the variables but I think I understand what it is doing now...thanks!
BlackBox
2011-05-05, 09:18 PM
Yes, it appears that it does work. I'll have to study this for a minute. I tried using -dimstyle earlier today but did not understand what it was trying to do. I thought it would let me change the variables but I think I understand what it is doing now...thanks!
This may help... start the -dimstyle command then hit F1, and click the link for 'options are displayed at the command prompt' in the bottom right corner.
clintr
2011-05-05, 09:40 PM
This may help... start the -dimstyle command then hit F1, and click the link for 'options are displayed at the command prompt' in the bottom right corner.
Yes, but that is boring and no fun.
Thanks again for everyone's help.
BlackBox
2011-05-05, 09:50 PM
Yes, but that is boring and no fun.
Always happy to not help. ;)
Let me know how that works out for you, dude. :banghead: :screwy:
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.