KewlToyZ 发表于 2009-1-2 14:16:49

dimstyle误差减少

我四处寻找解决方案,以解决客户的一些奇怪物品。
有没有见过一个客户创建超过30个不同的dimstyles,这些dimstyles都完全相同,但在不同的层上?
无论如何,我希望减少或选择它们都设置为一种样式,以便我可以清除垃圾。
你们有没有人在事后找到解决这个问题的方法?
这是一个指向反应堆的链接,以帮助先发制人地执行某些标准
http://autocadder.blogspot.com/2008_12_01_archive.html。
**** Hidden Message *****

MattHar 发表于 2010-2-21 01:34:25

你有没有弄清楚这个?

KewlToyZ 发表于 2010-3-17 14:08:40

到目前为止,卡布和特里向我指出了几个:
; 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
; http://forums.augi.com/showthread.php?p=967708#post967708
(defun c:DCBL (/ DimStyles@ StyleName$)
(princ "\nDimstyles color bylayer")
;===========================================================================Turn off command line responses
(command "CMDECHO" 0)        ;DO NOT CHANGE THIS LINE
;===========================================================================
        (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

(princ)
;===========================================================================Turn off command line responses
(command "CMDECHO" 1)        ;DO NOT CHANGE THIS LINE
;===========================================================================
)                        ;defun
;;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
)
(princ)
)
页: [1]
查看完整版本: dimstyle误差减少