- (defun C:ft (/ ANSWER EN FLAG FLAG1 INITDIR NewName SS originaldwg)
- (if (setq Initdir (getvar "dwgprefix"))
- nil
- (progn (princ "\n 文件未保存,不能分图") (exit))
- )
- (setq originaldwg (getvar "DWGNAME" ))
- (setq flag1 T)
- (while (and flag1
- (progn
- (initget "S C ZS T Z J 1 Y G M ")
- (setq en (getkword "\n >输入需加的前缀按对应字码即可;\n (S)说明书\n (C)CNC\n (ZS)分流板(外发中丝)\n (T)铜套发热圈\n (Z)阀针\n (J)结构\n (1)手动输入\n (Y)运水套\n (G)隔热板\n (M)模组\n "))
- (IF en
- (COND
- ((= en "S")(setq en "说明书"))
- ((= en "C")(setq en "CNC"))
- ((= en "ZS")(setq en "分流板(外发中丝)"))
- ((= en "T")(setq en "铜套发热圈"))
- ((= en "Z")(setq en "阀针"))
- ((= en "J")(setq en "结构"))
- ((= en "1")(setq en (getstring "\n 输入需加的前缀") ))
- ((= en "Y")(setq en "运水套"))
- ((= en "G")(setq en "隔热板"))
- ((= en "M")(setq en "模组"))
- )
- )
- )
- (setq NewName (strcat en "-" originaldwg))
- )
- (if (findfile (strcat Initdir NewName ))
- (setq flag T)
- )
- (while flag
- (alert (strcat "\n 该文件名已经存在.\n请在" Initdir"路径下\n把<"NewName">删除," "\n或重输入文件名.") )
- (exit)
- )
- (princ "\n >>选择保存对象")
- (setvar "NOMUTT" 1)
- (setq ss (ssget))
- (setvar "NOMUTT" 0)
- (command "_.WBLOCK"
- (strcat Initdir NewName)
- ""
- "0,0"
- ss
- ""
- )
- (command "oops" "")
- (princ (strcat "\n >>>文件<<<< " NewName ">>>成功保存!!!\n"))
- (if (ssget "X")
- (progn
- (initget "Yes No")
- (setq answer (GETKWORD "[停止(N)/继续(Y)]" ))
- (if (equal answer "No")
- (setq flag1 nil)
- )
- )
- (setq flag1 nil)
- )
- )
- (princ)
- )
|