(defun C:` (/ SS FLS ENT CL) ;复制层(`在esc键下方) <BR>(vl-load-com) <BR>(command "_.ucs" "")
(prompt "\Copy * Layer") <BR>(setq SS (ssget)) <BR>(setq FLS (LAYERR)) <BR>(setq CL (getvar "clayer")) <BR>(foreach ENT FLS <BR>(setq ENT (vl-princ-to-string ENT)) <BR>(if (not (tblsearch "layer" ENT)) <BR>(command "layer" "m" ENT "") <BR>) <BR>(command "copy" SS "" "0,0" "0,0") <BR>(command "change" SS "" "P" "la" ENT "") <BR>) <BR>(command "_.ucs" "p") <BR>(setvar "clayer" CL) <BR>(prin1) <BR>) <BR>(defun LAYERR (/ AJS FLS WORD LST1 N) <BR>(setq AJS (getstring "\n输入层名/(选择图层) :") <BR>LST1 "" <BR>N 1 <BR>) <BR>(if (= AJS "") <BR>(setq FLS (list (cdr (assoc 8 (entget (car (entsel))))))) <BR>(progn <BR>(repeat (strlen AJS) <BR>(setq WORD (substr AJS N 1)) <BR>(if (not (equal "," WORD)) <BR>(setq LST1 (strcat LST1 WORD)) <BR>(progn <BR>(setq FLS (append FLS (list LST1)) <BR>LST1 "" <BR>) <BR>) <BR>) <BR>(setq N (1+ N)) <BR>) <BR>(if (not (equal LST1 "")) <BR>(setq FLS (append FLS (list LST1))) <BR>FLS <BR>) <BR>) <BR>) <BR>) 能否不输图层名吗?哪能记得这么多!直接变成当前层多好,要不就做成对话框选图层! 我也来凑下热闹!!!
我用最简间的办法做.
(DEFUN C:CU() (setq pp (ssget))<BR> (setq LAY (getvar "CLAYER"))<BR> (COMMAND "COPY" pp "" "0,0" "0,0")<BR> (COMMAND "CHPROP" "P" "" "LA" lay "LT" "bylayer" "C" "bylayer" "")(princ)) <BR>(DEFUN C:OC() (vl-cmdf "_.undo" "_group")<BR> (mapcar 'princ (list "Current offset dist= " (getvar "OFFSETDIST")" "))<BR> (setq di (getstring "\nEnter Offset Dist:"))<BR> (setq o (ssget))<BR> (setq po (getpoint "\nSide to offset")) <BR> (setq LAY (getvar "CLAYER"))<BR> (if (/= di nil)<BR> (COMMAND "OFFSET" di o po "")<BR> (COMMAND "CHPROP" "L" "" "LA" lay "LT" "bylayer" "C" "bylayer" ""))<BR> (if (= di nil)<BR> (COMMAND "OFFSET" "" o po "")<BR> (COMMAND "CHPROP" "L" "" "LA" lay "LT" "bylayer" "C" "bylayer" ""))<BR> (vl-cmdf "_.undo" "_end")(princ)) andyding发表于2005-3-3 20:22:00static/image/common/back.gif我也来凑下热闹!!!
我用最简间的办法做.
(DEFUN C:CU() (setq pp (ssget)) (setq LAY (getvar \"CLAYER\")) (COMMAND \"C...
<BR>这两个程序好用,好好用,非常感谢 偏移到当前层命令:
(defun C:CLoffset (/ d dt e cl p cm nt)<BR> (setierr)<BR> (setq d (getvar "offsetdist")<BR> cl (getvar "clayer")<BR> )<BR> (if (> d 0) (setq ds (rtos d 2) dt nil)<BR> (setq ds "Through" dt t)<BR> )<BR> (initget 7 "Through ") <BR> (setq d1 (getdist (strcat "\nOffset distance" "<" ds "> :")))<BR> (if (= d1 "Through") (setq dt t)<BR> (if (= d1 "") (if dt () (setq d1 d)) (setq dt nil))<BR> ) <BR> (initget 7 " ") <BR> (setq e (entsel "\nSelect object to offset :"))<BR> (while (not e)<BR> (initget 7 " ")<BR> (setq e (entsel "\nSelect object to offset :"))<BR> )<BR> (if (= e "")<BR> (abcdefg)<BR> (redraw (car e) 3)<BR> )<BR> (setq p (getpoint "\nSide to offset?"))<BR> (if dt (command ".offset" "T" e p "") (command ".offset" d1 e p ""))<BR> (redraw (car e) 4)<BR> (command "_change" (entlast) "" "p" "La" cl "c" "Bylayer" "lt" "bylayer" "")<BR> (setq nt t)<BR> (while nt<BR> (initget 7 " ")<BR> (setq e (entsel "\nSelect object to offset :"))<BR> (while (not e)<BR> (initget 7 " ")<BR> (setq e (entsel "\nSelect object to offset :"))<BR> )<BR> (if (= e "") (setq nt nil)<BR> (progn<BR> (redraw (car e) 3)<BR> (setq p (getpoint "\nSide to offset?"))<BR> (if dt (command ".offset" "T" e p "") (command ".offset" d1 e p ""))<BR> (command "_change" (entlast) "" "p" "La" cl "c" "Bylayer" "lt" "bylayer" "")<BR> (redraw (car e) 4)<BR> )<BR> )<BR> )<BR> <BR> <BR> (reerr)<BR> (princ)<BR> )
(defun C:CLoffset (/ d dt e cl p cm nt)<BR> (setierr)<BR> (setq d (getvar "offsetdist")<BR> cl (getvar "clayer")<BR> )<BR> (if (> d 0) (setq ds (rtos d 2) dt nil)<BR> (setq ds "Through" dt t)<BR> )<BR> (initget 7 "Through ") <BR> (setq d1 (getdist (strcat "\nOffset distance" "<" ds "> :")))<BR> (if (= d1 "Through") (setq dt t)<BR> (if (= d1 "") (if dt () (setq d1 d)) (setq dt nil))<BR> ) <BR> (initget 7 " ") <BR> (setq e (entsel "\nSelect object to offset :"))<BR> (while (not e)<BR> (initget 7 " ")<BR> (setq e (entsel "\nSelect object to offset :"))<BR> )<BR> (if (= e "")<BR> (abcdefg)<BR> (redraw (car e) 3)<BR> )<BR> (setq p (getpoint "\nSide to offset?"))<BR> (if dt (command ".offset" "T" e p "") (command ".offset" d1 e p ""))<BR> (redraw (car e) 4)<BR> (command "_change" (entlast) "" "p" "La" cl "c" "Bylayer" "lt" "bylayer" "")<BR> (setq nt t)<BR> (while nt<BR> (initget 7 " ")<BR> (setq e (entsel "\nSelect object to offset :"))<BR> (while (not e)<BR> (initget 7 " ")<BR> (setq e (entsel "\nSelect object to offset :"))<BR> )<BR> (if (= e "") (setq nt nil)<BR> (progn<BR> (redraw (car e) 3)<BR> (setq p (getpoint "\nSide to offset?"))<BR> (if dt (command ".offset" "T" e p "") (command ".offset" d1 e p ""))<BR> (command "_change" (entlast) "" "p" "La" cl "c" "Bylayer" "lt" "bylayer" "")<BR> (redraw (car e) 4)<BR> )<BR> )<BR> )<BR> <BR> <BR> (reerr)<BR> (princ)<BR> )
页:
1
[2]