小唐剛進公司時候發現公司的圖層與inventor轉換成線條圖的圖層大不相同
當時萬分困擾,所以花了幾個小時寫出了這個簡單的變更程式,相信很多autocad
使用者應該也有類似的困擾吧! 希望這程式可以幫助到大家!
將以下原始碼存成 CHCT.LSP 置入AUTOCAD目錄 SUPPORT 即可使用
(defun c:chct(/ a b)
(command "clayer" "0")
(if (= (tblsearch "layer" "標註線") nil)
(command "-layer" "n" "標註線" "c" "13" "標註線" ""))
(if (= (tblsearch "layer" "正折") nil)
(command "-layer" "n" "正折" "c" "6" "正折" ""))
(if (= (tblsearch "layer" "畫線") nil)
(command "-layer" "n" "畫線" "c" "2" "畫線" ""))
(if (= (tblsearch "layer" "打點") nil)
(command "-layer" "n" "打點" "c" "4" "打點" ""))
(if (= (tblsearch "layer" "文字") nil)
(command "-layer" "n" "文字" "c" "5" "文字" ""))
(if (= (tblsearch "layer" "虛線") nil)
(command "-layer" "n" "虛線" "c" "3" "虛線" "L" "DASHED" "虛線" ""))
(if (= (tblsearch "layer" "中心線") nil)
(command "-layer" "n" "中心線" "c" "1" "中心線" "L" "CENTER" "中心線" ""))
(if (= (tblsearch "layer" "圖框線") nil)
(command "-layer" "n" "圖框線" "c" "8" "圖框線" ""))
(if (= (tblsearch "layer" "圖框") nil)
(command "-layer" "n" "圖框" "c" "8" "圖框" ""))
(if (= (tblsearch "layer" "反折") nil)
(command "-layer" "n" "反折" "c" "3" "反折" "L" "DASHED" "反折" ""))
(setq
a (ssget
'((0 . "DIMENSION,TEXT,REGION,CIRCLE,ELLIPSE,LINE,*POLYLINE,SPLINE,ARC"))
)
)
(setq n(sslength a))
(setq index 0)
(repeat n
(setq b1(entget (ssname a index)))
(setq index (1+ index))
(setq b(assoc 8 b1)) ;取出圖層變數
;(if (= (cdr b) "ACAD_ISO02W100") ;判斷b是否為"虛線",如為"虛線"就改為0
(if (= (cdr b) "隱藏邊線(GFong)") ;判斷b是否為"虛線",如為"虛線"就改為0
(progn
(setq c (assoc 8 b1))
(setq d (cons (car c) "虛線"))
;cons基本串列構建函數
(setq b2 (subst d c b1))
(entmod b2)
))
(if (= (cdr b) "可見邊線(GFong)") ;判斷b是否為"虛線",如為"虛線"就改為0
(progn
(setq c (assoc 8 b1))
(setq d (cons (car c) "0"))
;cons基本串列構建函數
(setq b2 (subst d c b1))
(entmod b2)
))
(if (= (cdr b) "螺紋(GFong)") ;判斷b是否為"虛線",如為"虛線"就改為0
(progn
(setq c (assoc 8 b1))
(setq d (cons (car c) "0"))
;cons基本串列構建函數
(setq b2 (subst d c b1))
(entmod b2)
))
(if (= (cdr b) "可見相切邊(GFong)") ;判斷b是否為"虛線",如為"虛線"就改為0
(progn
(setq c (assoc 8 b1))
(setq d (cons (car c) "0"))
;cons基本串列構建函數
(setq b2 (subst d c b1))
(entmod b2)
))
(if (= (cdr b) "填充線") ;判斷b是否為"虛線",如為"虛線"就改為0
(progn
(setq c (assoc 8 b1))
(setq d (cons (car c) "畫線"))
;cons基本串列構建函數
(setq b2 (subst d c b1))
(entmod b2)
))
)
)
沒有留言:
張貼留言