变更PRO/E转出DWG图档的图层,但程式转换速度太慢,看大家有没有什么办法可以提高一下运算速度.我是在2007 环境下使用. ;;; p-e.lsp ;;;--- 变更PRO/E图层,不能对图块转换.<commnad: p-e> --- ;;;******************************************* (DEFUN new_lay (lay coL lt / chk_lay) (setq chk_lay (tblsearch "layer" lay)) (if (= chk_lay nil) (command "layer" "new" lay "c" coL lay "lt" lt lay "") ) ) ;;;******************************************* (DEFUN CH_LAY (ob lay) (command "Change" ob "" "p" "c" "bylayer" "LT" "bylayer" "la" lay "") ) ;;;******************************************* (DEFUN c:p-e(/ c_lay obj n en type0 type62 type6 hat p40 cen hid pha sec dim cl) ;(%%time) (setvar "cmdecho" 0) (setq c_lay (getvar "clayer")) ;;; ------------ 新建proe图层 ----------------------------- (setq hat "剖面线层") (setq p40 "proe-40") (setq cen "中心线层") (setq hid "短虚线层") (setq pha "proe-PHA") (setq SEC "proe-sec") (setq dim "尺寸线层") (setq cl "0") (new_lay hat 40 "Continuous") (new_lay p40 130 "phantom") (new_lay cen 1 "center") (new_lay hid 200 "hidden") (new_lay pha 140 "phantom") (new_lay SEC 150 "phantom") (new_lay dim 4 "Continuous") ;;;;**************************************** (prompt "\n 请指定转换PRO/E图层的范围") (setq obj (ssget)) (if (/= obj nil) (progn ;;; ------------- 循环判断并更改proe图层 ------------- (setq n 0) (prompt "\n正在转换PRO/E的图层,可能需要几秒到几分钟,在计算过程中请等待......\n") (repeat (sslength obj) (setq en (ssname obj n)) (setq type0 (cdr (assoc 0 (entget en)))) (setq type62 (cdr (assoc 62 (entget en)))) (setq type6 (cdr (assoc 6 (entget en)))) ;(setq type8 (cdr (assoc 8 (entget en)))) ;;; ------------ 判断并更改到 0 图层 ------------- (if (= type62 7) (CH_LAY en cl) ) ;;; ------------ 判断并更改到PROE-HAT图层 ------------- (if (and (and (= type0 "LINE") (= type62 2)) (= type6 "Continuous") ) (CH_LAY en hat) ) ;;;------------ 判断并更改到PROE-40图层 --------------- (if (= type62 40) (CH_LAY en p40) ) ;;;------------ 判断并更改到PROE-cen图层 -------------- (if (and (= type6 "CENTER") (= type62 2)) (CH_LAY en cen) ) ;;;------------ 判断并更改到短虚线层图层 -------------- (if (or (or (= type6 "HIDDEN") (= type62 8)) (and (= type6 "HIDDEN") (= type62 7)) ) (CH_LAY en hid) ) ;;;------------ 判断并更改到PROE-pha图层 ---------------- (if (= type6 "PHANTOM") (CH_LAY en pha) ) ;;;------------ 判断并更改到PROE-sec图层 -------------- (if (and (= type6 "CENTER") (= type62 9)) (CH_LAY en sec) ) ;;;------------ 判断并更改到PROE-dim图层 -------------- (if (= type0 "DIMENSION") (progn (CH_LAY en dim) (command "dimstyle" "apply" en "") ) ) ;;;------------ one end ------------------------------- (setq n (1+ n)) ) (print "恭喜你已完成改变PRO/E图层") (print) ) ) (setvar "clayer" c_lay) (princ) )
|