幸运之星正在降临...
点击领取今天的签到奖励!
恭喜!您今天获得了{{mission.data.mission.credit}}积分
我的优惠劵
-
¥优惠劵使用时效:无法使用使用时效:
之前
使用时效:永久有效优惠劵ID:×
没有优惠劵可用!
(Defun Ty-Wx (Ent /) (Vla-Getboundingbox (Vlax-Ename->Vla-Object Ent) 'Minpoint 'Maxpoint) (Setq Pmax (Trans (Vlax-Safearray->List Maxpoint) 0 1) Pmin (Trans (Vlax-Safearray->List Minpoint) 0 1)) ) (Defun C:WX (/ Osmode Yesno Frame N Ent Number Rev Pmin Pmax Directory Filename Pmin1 Pmax2) (Setvar "Cmdecho" 0) (Princ "n 执行本命令前请先执行MOI命令!") (Vl-Cmdf ".Undo" "Be" "-Vports" "D" "Wx" "-Vports" "S" "Wx") (Vl-Cmdf "Ucs" "W") (Setq Osmode (Getvar "Osmode")) (Setq $orr *error* *error* MyErr) (Setq Directory (Strcase "F:")) ;输出文件夹名称 (Initget "Yes No") (Setq Yesno (getkword "n 输入的图档名称带版次(Y)或不带版次(N)?:")) (Setvar "Osmode" 0) (Setq Frame (Ssget(List '(-4 . ""))) N 0 M 0);选择含有"A3"及"A4"块名图框 (Repeat (Sslength Frame) (Ty-Wx (Ssname Frame N)) (Setq Pmin1 (List (- (Car Pmin) 0.1) (- (Cadr Pmin) 0.1)) Pmax2 (List (+ (Car Pmax) 0.1) (+ (Cadr Pmax) 0.1)) ) ;当前图框四周加大0.1 (IF (= (Ssget "_C" Pmin1 Pmax2 (List '(-4 . ""))) NIL) ;排除被选中图框块名含有"B4" (Progn (Setq Ent (Entget (Ssname Frame N))) (If (/= "SEQEND" (Cdr (Assoc 0 Ent))) (Progn (While (= (Cdr (Assoc 0 (Setq ENT (Entget (Entnext (Cdr (Assoc -1 ENT))))))) "ATTRIB") ;以下取得图框中件号及版次 (Cond ((= (Cdr (Assoc 2 ENT)) "REV") (Setq Rev (Cdr (Assoc 1 ENT)))) ((= (Cdr (Assoc 2 ENT)) "NUMBER") (Setq Number (Cdr (Assoc 1 ENT)))) ) ;Cond End );Whiel End (If (= Yesno "Yes") (Setq Filename (Strcase (Strcat Directory Number "-Rev-" Rev ".dwg"))) ;Y->输出文件名带版次 (Setq Filename (Strcase (Strcat Directory Number ".dwg"))));;N->输出文件名不带版次 (Vl-Cmdf "-Wblock" Filename "" Pmin (Ssget "_W" Pmin Pmax) "") ) ) ) );If End (Setq N (1+ N)) );Repeat End (Setvar "Osmode" Osmode) (Vl-Cmdf "Undo" "E") (Setq *error* $orr) (Setvar "Cmdecho" 1) (Princ) ) 测试用的图档我不知道怎么上传。图档中需要写出图框块名为A4, 带有属性文字 ("NUMBER"), 写出块名就取自这个 NUMBER
怎么发给您?