본문 바로가기
revit

Export Layout 문제 해법: 1:1 LAYOUT 도면>스케일 자동 조정>치수 스타일 수정

by kmlab 2024. 5. 8.


;; init. 
(progn (setq _dimFont "돋움") ;; 치수 폰트 지정
(setq _cadDimstyle "DIMSTYLE_NAME") ; 치수스타일 지정
(setq _scale 1.0) 
(princ)
)

(defun KM:getscl ( / pt1 sclobj);; find scale factor 
(command "zoom" "e") 
;; (setq pt1 '(757.0 36.5)) ;;coordination(SAMOO titleblock) of the string "A1: 1 : 400" of scale of the drawing 
(setq pt1 '(770.0 64.0)) ;;coordination(SK titleblock) of the string "A1: 1 : 400" of scale of the drawing 
(command "explode" (ssget pt1))
(setq sclobj (entget (ssname (ssget pt1) 0) )) ;get entity zero from prop. 
(command "undo" 1)
(setq txtstr (assoc 1 sclobj)) ;get list containing string 
(cdr txtstr) ;extract string from prop. 
)

(defun KM:df0 ( dimfont );; set font-height to zero ; 
(progn 
(vl-load-com) 
(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object))) 
(setq StyList (vla-get-TextStyles ActDoc)) 
(setq StyObj (vla-Item StyList dimFont)) 
(vla-put-Height StyObj 0.0) 

(princ) 
)

(defun KM:set_DIMSTYLE ( dimFont cadDimstyle );;modifying dimstyle of the STANDARD_DIMSTYLE 
(progn
(command "-dimstyle" "r" cadDimstyle)
(setvar "DIMEXO" 3.0) ; Lines. Offset from origin 3.0
(setvar "DIMASZ" 1.0) ; Symbols and Arrows. Arrow size 1.0
(setvar "DIMBLK" "_DOTBLANK") ; Symbols and Arrows. Arrowhead
(setvar "DIMTXSTY" dimFont) ; Text. Text style
(setvar "DIMTXT" 2.9) ; Text. Text Height 2.9
(setvar "DIMTAD" 1) ; Text. Text placement Vertical Above(1)
(setvar "DIMGAP" 1.0) ; Text. Offset from dim line 1.0
(setvar "DIMTIH" 0) ; Text. Aligned with dimension line
(setvar "DIMTMOVE" 2) ; Fit. Text placement without leader
(setvar "DIMTIX" 1) ; Fit. Always keep text between ext lines
(setvar "DIMTOFL" 1) ; Fit. Draw dim line between ext lines
(setvar "DIMDEC" 0.0) ; Primary Units. Linear dimensions Precision 0.0
(setvar "DIMLUNIT" 6) ; Primary Units. Windows Desktop(6)
(command "-dimstyle" "s" cadDimstyle)
(command "_dimstyle" "a" "all" "")
(command "regen")
)
(princ)
)

(defun c:sdf( ) ;; main code set Scale>Dim>Fix
;
(progn
(setq _scale (atof (KM:getscl))) ;; get scale
(if (= _scale 0.0)
(setq _sclae 1.0)
()
)
(command "dimscale" _scale)
(command ".scale" "all" "" '(0 0) _scale) ;; set scale
(command "zoom" "e")
)
;
(command "CMDECHO" 0)
(KM:df0 _dimfont) ;; set font-height to zero
(KM:set_DIMSTYLE _dimfont _cadDimstyle) ;; set dimstyle
(command "CMDECHO" 1)
(princ)
)
;
;

반응형