|
全部内容
(defun c:mp (/ w lay sslay dcl_id do_what value pot1 pot2 sx sy sz ex ey ez
lenth layer clayer num a b no tem_list cood)
(setq cdat (atoi (rtos (getvar "cdate"))))
(if (> cdat 20000430)
(progn
(SETVAR "CMDECHO" 0)
(SETQ W (TBLNEXT "LAYER" T))
(WHILE (/= NIL W)
(SETQ LAY (CDR (ASSOC 2 W)))
(if (/= (STRCASE lay) "DEFPOINTS")
(SETQ SSLAY (append SSLAY (list LAY)))
)
(SETQ W (TBLNEXT "LAYER"))
)
(setq dcl_id (load_dialog "mp.dcl"))
(setq do_what 3)
(while (> do_what 1)
(if (not (new_dialog "mp" dcl_id)) (exit))
(mode_tile "lis" 2)
(if (null sx) (setq sx 0))
(if (null sy) (setq sy 0))
(if (null sz) (setq sz 0))
(if (null ex) (setq ex 0))
(if (null ey) (setq ey 0))
(if (null ez) (setq ez 0))
(set_tile "sx" (rtos sx))
(set_tile "sy" (rtos sy))
(set_tile "sz" (rtos sz))
(set_tile "ex" (rtos ex))
(set_tile "ey" (rtos ey))
(set_tile "ez" (rtos ez))
(start_list "lis" 2)
(mapcar 'add_list SSLAY)
(end_list)
(action_tile "sel" "(done_dialog 2)")
(action_tile "sx" "(setq sx (check $key))")
(action_tile "sy" "(setq sy (check $key))")
(action_tile "sz" "(setq sz (check $key))")
(action_tile "ex" "(setq ex (check $key))")
(action_tile "ey" "(setq ey (check $key))")
(action_tile "ez" "(setq ez (check $key))")
(action_tile "selall" "(selall)")
(action_tile "lis" "(setq value $value)")
(action_tile "accept" "(setq value (get_tile \"lis\"))(done_dialog 1)")
(setq do_what (start_dialog))
(if (= 2 do_what)
(progn
(setq pot1 (getpoint))
(setq pot2 (getcorner pot1))
(setq sx (car pot1)
sy (cadr pot1)
sz (caddr pot1)
ex (car pot2)
ey (cadr pot2)
ez (caddr pot2)
)
)
)
)
(unload_dialog dcl_id)
(if (= 1 do_what)
(progn
(str_no value)
(setq lenth -1)
(setq pot1 (list sx sy sz)
pot2 (list ex ey ez)
)
(repeat (length tem_list)
(setq lenth (1+ lenth)
layer (nth lenth tem_list)
clayer (nth layer sslay)
)
(COMMAND "_LAYER" "set" clayer "")
(fa)
(if (not (null (ssget "c" pot1 pot2)))
(command "plot" "" pot1 pot2 "")
)
)
)
)
(graphscr)
(princ)
)
)
)
;;;;;;;;;
(defun selall ()
(setq num (length sslay)
a 0
)
(while (< a num)
(if (null b)(setq b ""))
(setq b (strcat b (rtos a 2 0) " ") )
(setq a (1+ a))
)
(set_tile "lis" b)
)
(defun str_no (str)
(while (setq no (read str))
(setq tem_list (append tem_list (list no)))
(setq str (substr str (+ 2 (strlen (itoa no)))))
tem_list
)
)
;;;;;;;
(DEFUN FA (/ W LAY SSLAY LEN NO CLAY NAM )
(SETQ W (TBLNEXT "LAYER" T))
(WHILE (/= NIL W)
(SETQ LAY (CDR (ASSOC 2 W)))
(SETQ SSLAY (CONS LAY SSLAY))
(SETQ W (TBLNEXT "LAYER"))
)
(SETQ LEN (LENGTH SSLAY)
NO -1
clay (getvar "clayer")
)
(REPEAT LEN
(SETQ NO (1+ NO)
NAM (NTH NO SSLAY)
)
(IF (/= CLAY NAM)
(COMMAND "_LAYER" "OFF" NAM "")
)
)
)
;;;;;
(defun check (cood)
(set_tile "error" "")
(if (not (distof (get_tile cood)))
(progn
(mode_tile cood 2)
(mode_tile cood 3)
(set_tile "error" "Error value")
nil
)
(distof (get_tile cood))
)
) |
|