Author Topic: SetVariable curdoc "dimclrd" 1 ???  (Read 877 times)

0 Members and 1 Guest are viewing this topic.

jlogan02

  • Bull Frog
  • Posts: 327
SetVariable curdoc "dimclrd" 1 ???
« on: May 25, 2021, 05:31:05 PM »
I'm trying to write a companion routine to change the red dimensions back to their original overriden colors.

Code - Auto/Visual Lisp: [Select]
  1.  
  2. (defun c:OrdDim ( / curdimstyle curdoc)
  3.  
  4.    ;; Get the current dimstyle
  5.  
  6. (if (/= (getvar "dimstyle") Ordinate)
  7. (command "-dimstyle" "s" Ordinate)
  8. )
  9.  
  10.    (setq acadApp (vlax-get-acad-object)
  11.          curDoc  (vla-get-ActiveDocument acadApp)
  12.          curDimStyle (vla-get-ActiveDimstyle curDoc)
  13.  
  14.    ) ;setq
  15.  
  16.    ;; Modify the current dimstyle.
  17.    ;; This is done by changing the current dimvars
  18.    ;; and by saving the dimvars in the dimstyle.
  19.    ;; Change a dimvar.
  20.  
  21.    (vla-SetVariable curDoc "DIMCLRE" 1)
  22.    (vla-SetVariable curDoc "DIMCLRT" 1)
  23.    (vla-SetVariable curDoc "DIMCLRD" 1)
  24.  
  25.    ;; Save the current dim vars in the current dim style.
  26.  
  27.    (vla-CopyFrom curDimStyle curDoc)
  28.  
  29.    (command-S "layer" "make" "DIMEN" "COLOR" "GREEN" "DIMEN" "")
  30.    (command-S "DimOrdinate" pause pause pause);;draw the RED dimension
  31.    
  32.    (vla-SetVariable curDoc "DIMCLRE" 2)
  33.    (vla-SetVariable curDoc "DIMCLRT" 3)
  34.    (vla-SetVariable curDoc "DIMCLRD" 2)
  35.  
  36.    (vla-CopyFrom curDimStyle curDoc)
  37.  
  38.    (princ)
  39.  
  40. )

Let's say I've drawn the dimensions in RED, then at a later date I want all red dimensions to be set back to the original overriden colors indicated below.

Code - Auto/Visual Lisp: [Select]
  1. "DIMCLRE" 2
  2. "DIMCLRD" 2
  3. "DIMCLRT" 3

I can ssget dimensions and the their dimension styles all day long. Can't seem to ssget any dimensions that are overriden to  red.

Might be easier to create a temporary Red dimensions style and then change the DimStyle back to the Standard DimStyle.
J. Logan
ACAD 2018

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

framednlv

  • Newt
  • Posts: 64
Re: SetVariable curdoc "dimclrd" 1 ???
« Reply #1 on: May 25, 2021, 06:08:07 PM »
This is what I use to set to bylayer:
Code: [Select]
(if (setq ss (ssget "x" '((0 . "*DIMENSION"))))(command "_.dimoverride" "dimclrd" 256 "dimclre" 256 "" ss ""))
(if (setq ss (ssget "x" '((0 . "LEADER"))))(command "_.dimoverride" "dimclrd" 256 "dimclre" 256 "" ss ""))