Author Topic: dimstyle error reduction  (Read 4774 times)

0 Members and 1 Guest are viewing this topic.


  • Guest
dimstyle error reduction
« on: January 02, 2009, 02:16:49 PM »
I was looking around for a solution to some bizarre items from clients.
Ever seen a client create over 30 different dimstyles all exactly the same but on different layers?
Any way I was hoping to reduce or select them all to be set to one style so I could purge the garbage.
Have any of you found a work around to fix this after the fact?

This is a link to a reactor to help enforce some standards pre-emptively. :ugly:


  • Guest
Re: dimstyle error reduction
« Reply #1 on: February 21, 2010, 01:34:25 AM »
Have you got this one figured out yet?


  • Guest
Re: dimstyle error reduction
« Reply #2 on: March 17, 2010, 02:08:40 PM »
So far CAB and Terry pointed me toward a few:

Code: [Select]
; create a list of current dimstyles in the drawing
; get total count/ give each one a number
; if count is greater than zero While (> count 0) ; continue with next DimStyle.
; set the dimstyle current
; change the necessary variables
; save the variables to the current dimstyle
; count down by one after saving that dimstyle
; DimStyle Update Complete.

;(defun SaveDimStyleChanges (style /)
;  (vla-copyfrom
;    (vlax-ename->vla-object (tblobjname "DIMSTYLE" style))
;    (vla-get-activedocument (vlax-get-acad-object))
;  )

; Posted by Terry CADD on AUGI Forums 2008-4-23

(defun c:DCBL (/ DimStyles@ StyleName$)

(princ "\nDimstyles color bylayer")
;===========================================================================Turn off command line responses
(setq StyleName$ (cdr (assoc 2 (tblnext "DIMSTYLE" t))))
(setq DimStyles@ (list StyleName$))
(setq Count 0)

(while (setq StyleName$ (cdr (assoc 2 (tblnext "DIMSTYLE"))))
(setq DimStyles@ (append DimStyles@ (list StyleName$)))
) ;end while

(foreach StyleName$ DimStyles@
(command "DIMSTYLE" "R" StyleName$)
(setvar "DIMCLRD" 256) ;Dimension line and leader color
(setvar "DIMCLRE" 256) ;Extension line color
(setvar "DIMCLRT" 256) ;Dimension text color
(command "DIMSTYLE" "S" StyleName$ "Y")
(setq Count (+ 1 Count))
(princ "\n Count = [ ")
(princ Count)
(princ " ] picking next DimStyle.....")
) ;foreach
;===========================================================================Turn off command line responses
) ;defun

Code: [Select]
;;  Another way without the Command.
;;  DimStyle to By Layer
;;  CAB 04/28/09
(defun c:DS2BL (/ acdoc dsobj obj)
  (setq acdoc (vla-get-activedocument (vlax-get-acad-object)))
  (setq dsobj (vla-get-dimstyles acdoc))
  (vlax-for obj dsobj
    (vla-put-activedimstyle acdoc (vla-item dsobj (vla-get-name obj))) ;set dimstyle current
    (vlax-invoke acdoc 'setvariable "DimCLRD" 256) ;Dimension line and leader color
    (vlax-invoke acdoc 'setvariable "DimCLRE" 256) ;Extension line color
    (vlax-invoke acdoc 'setvariable "DimCLRT" 256) ;Dimension text color
    (vla-copyfrom obj acdoc) ; update the Dim Style