;;===================QSAVE XREF RELOAD BIND SAVE CLOSE=======================
;;
;; SAMOO Xref Bind 작업을 효과적으로 실행하기 위한 스크립트
;; 결합전 파일을 저장한 후 같은 폴더에 참조파일을 모두 결합한 BINDtstamp_dwg.dwg 생성
;;
;; Author: KM Lab, Copyright © 2021 - kmlab.tistory.com
;; Version 1.0 - 2021-10-26
;;
(defun KM:XrefBindClose( / ver filename tstmp path bind bindwg)
(setvar "cmdecho" 0)
(setvar "filedia" 0)
(setq ver "2013")
(setq filename (getvar "dwgname"))
(setq tstmp (rtos (getvar "cdate") 2 6)); TimeStamp YYYYMMDD.hhmmss
(setq path (getvar "dwgprefix"))
(setq bind (strcat path "BIND" tstmp "_"))
(setq bindwg (strcat bind filename))
(command "zoom" "e")
(command "qsave")
(command "-xref" "r" "*")
(command "-xref" "bind" "*")
(command "save" ver bindwg)
(setvar "cmdecho" 1)
(setvar "filedia" 1)
(prompt "...SUCCESS BIND DWG...\n")
(prompt "...SUCCESS BIND DWG...\n")
(prompt "...SUCCESS BIND DWG...\n")
(princ)
);defun
(defun c:XRX(); Xref Bind Close
(KM:XrefBindClose)
;(command "close")
);defun
(defun c:XRR(); Reload Xref
(command "-xref" "r" "*")
);defun
(defun c:REE(/ OLDLAYER NEWLAYER); Change LayerName Set ChangedLayerName
(setq OLDLAYER "REV-211022")
(setq NEWLAYER "REV-211025")
(command "rename" "la" OLDLAYER NEWLAYER)
(command "layer" "s" NEWLAYER "")
(command "qsave")
);defun
;;===================CREATE PDF by DWG to PDF.pc3=======================
;;
;; SAMOO PLOT 작업을 효과적으로 실행하기 위한 스크립트
;; Adobe PDF.pc3 대신 DWG to PDF.pc3 사용 (Adobe PDF는 SCRIPT 실행안됨)
;; 선행작업1: 용지크기 "ISO A3 (420.00 x 297.00 mm)" 선택
;; 선행작업2: Adobe PDF A3 여백으로 조정, 인쇄가능영역 여백값 3.1 3.1 3.2 3.1 인쇄가능영역=413.7x290.8 설정
;; 선행작업3: PDF Options에서 칼라 블랙 변경 안됨, 펜세팅 Gray=ON, Color10~255 선가중치=객체선가중치사용
;; 선행작업4: PDF Options에서 "모든 문자를 형상으로 변환" 선택, DWG to PDF 사용시 폰트 깨지는 문제 해결
;; 선행작업5: PDF Options에서 벡터품질 1200dpi, 레스터 품질: 800dpi 설정
;; DWG to PDF(A3).pc3, SAMOO-C(gray).ctb 저장
;; 도면번호 선택 > 도곽선택 > 같은 폴더에 PLOTtstamp_DwgNo.pdf 생성
;;
;; Author: KM Lab, Copyright © 2021 - kmlab.tistory.com
;; Version 1.0 - 2021-10-27
;;
(defun KM:PLOT (/ drawingno dn tstmp path plt pltname)
;;set Init
;(setq LAYEV (getvar "LAYEREVALCTL"))
(setvar "cmdecho" 0)
(setvar "filedia" 0)
(setvar "layerevalctl" 0)
;;get drwaing no.
(princ "\n***SELECT A DRAWING NO***:...\n")
(while (not (setq dn (ssget ":s" '((0 . "*TEXT"))))))
(setq drawingno (cdr (assoc 1 (entget (ssname dn 0)))))
(princ drawingno)
;;get plot area
(princ "\n\n***SELECT A DRAWING TITLEBLOCK***:...\n")
(while (not (setq drawingbox (ssget ":s" '((0 . "INSERT"))))))
(vla-GetBoundingBox (vlax-ename->vla-object (ssname drawingbox 0)) 'MinPt 'MaxPt)
(setq P1 (vlax-safearray->list MinPt)); Points of Lower Left of Selected Entity
(setq P2 (vlax-safearray->list MaxPt)); Points of Upper Right of Selected Entity
;set Landscape/Potrait. 용지 대각선 각도가 45도 이하면 가로, 45동 넘으면 세로로 설정.
(if (> 0.25 (/ (angle P1 P2) pi)) (setq ori "Landscape") (setq ori "Portrait"))
;set plot scale. 90 미만 비율은 12.3->12, 45.8->45 조정. 93.85->90, 245.2->240으로 자동조정.
(setq ratio (/ (distance P1 P2) 514.4))
(if (< 90 ratio)
(setq plot_ratio (atoi (rtos ratio 2 0)))
(setq plot_ratio (* 10 (atoi (rtos (/ ratio 10.0) 2 0))))
);if
(setq p_scale (strcat "1=" (itoa plot_ratio)))
;;plot setting
(setq DetailedPlotConfig "YES")
(setq LayoutName "")
(setq OutputDevice "DWG To PDF(A3).pc3"); Set PDF Options: Convert all text geometry
(setq PaperSize "ISO A3 (420.00 x 297.00 mm)"); Set A3 margin = 3.1 3.1 3.2 3.1
(setq PaperUnits "MILLIMETERS")
(setq Orientation ori)
(setq UpsideDown "NO")
(setq PlotArea "WINDOW")
(setq PlotScale p_scale)
(setq PlotOffset "CENTER")
(setq PlotStyle "YES")
(setq PlotTable "SAMOO-C(gray).ctb"); Set Gray=ON, Color 10~255 Lines Weights=USE OBJECTS
(setq LineWeights "YES")
(setq LineweightScale "NO")
(setq PaperspaceFirst "NO")
(setq HidePaperspaceObject "NO")
(setq PlotToFile "YES")
(setq ChangePagesetup "NO")
(setq ProceedPlot "YES")
;;set pltname
(setq tstmp (rtos (getvar "cdate") 2 6)); TimeStamp YYYYMMDD.hhmmss
(setq path (getvar "dwgprefix"))
(setq plt (strcat path "PLOT" tstmp "_"))
(setq pltname (strcat plt drawingno ".pdf"))
(setq PdfName pltname)
;;Plot Proceeding
;(command "zoom" p1 p2)
(command "-plot"
DetailedPlotConfig
LayoutName
OutputDevice
PaperSize
PaperUnits
Orientation
UpsideDown
PlotArea P1 P2
PlotScale
PlotOffset
PlotStyle
PlotTable
LineWeights
LineweightScale
PaperspaceFirst
HidePaperspaceObject
PdfName
ChangePagesetup
ProceedPlot
)
;; Reset
(setvar "cmdecho" 1)
(setvar "filedia" 1)
(setvar "layerevalctl" 1)
;;success plot
(prompt "\n...SUCCESS PLOT...\n")
(princ PdfName)
(princ)
);defun
(defun c:KP(); KM Plot Script
(KM:PLOT)
);defun
'autocad' 카테고리의 다른 글
| DWG to PDF(A3) Updates (0) | 2021.12.15 |
|---|---|
| Tag RoomName: AREA (0) | 2021.11.02 |
| XREF BIND, c:XRX, c:XRR, c:REE (0) | 2021.10.27 |
| 접두사 접미사 추가, c:psx (0) | 2021.10.07 |
| 중복된 블록을 제거하고 싶다면 (0) | 2021.09.30 |