日升月恒 发表于 2005-11-27 12:33:00
收到liushaobo 发表于 2006-2-12 21:33:00
烦请各位高手帮小弟完成此序程孔径列表liushaobo 发表于 2006-2-12 21:42:00
(defun C:DM()<BR> (setq ooo (list 0.0 0.0 0.0))<BR> (setvar "cmdecho" 0)<BR> (command "layer" "s" "dim" "")<BR> (setq pnd (ssget "X" (list(cons 8 "dim"))))<BR> (command "erase" pnd "")<BR> (setq pnd (ssget "X" (list(cons 8 "center")(cons 40 2.00))))<BR> (command "erase" pnd "")<BR> (command "redraw")<BR> (princ "\n尺寸标注" )<BR> (princ "\n第一端点<<左>>:" )<BR> (setvar "OSMODE" 1)<BR> (setq p0 (getpoint))<BR> (princ "\n第二端点<<右>>:" )<BR> (setq p1 (getpoint))<BR> (setvar "OSMODE" 0)<BR>;(command "dim" "horizontal" p0 p1 pause "" "exit")<BR> (princ "\n尺寸标注" )<BR> (princ "\n第一端点<<上>>:" )<BR> (setvar "OSMODE" 1)<BR> (setq p2 (getpoint))<BR> (princ "\n第二端点<<下>>:" )<BR> (setq p3 (getpoint))<BR> (setvar "OSMODE" 0)<BR>;(command "dim" "vertical" p2 p3 pause "" "exit")<BR> (setq x0 (car p0)) (setq y0 (cadr p0))<BR> (setq x1 (car p1)) (setq y1 (cadr p1))<BR> (setq x2 (car p2)) (setq y2 (cadr p2))<BR> (setq x3 (car p3)) (setq y3 (cadr p3))<BR> (if (> x0 x1)(setq x x0))<BR> (if (< x0 x1)(setq x x1))<BR> (if (> y2 y3)(setq y y2))<BR> (if (< y2 y3)(setq y y3))<BR> (setq dxx (/ (+ x0 x1) 2))<BR> (setq dyy (/ (+ y2 y3) 2))<BR> (setq dx (abs (- x0 x1)))(setq dy (abs (- y2 y3)))<BR> (setq x (+ x 15))<BR> (setq y (+ y 5))<BR> (setq pcx (list dxx dyy 0.0))<BR> (setq px (list x0 y 0.0))<BR> (setq py (list x y1 0.0))<BR> (command "dim" "horizontal" p0 p1 px "" "exit")<BR> (command "dim" "vertical" p2 p3 py "" "exit")<BR> (command "move" "all" "0,0" "" pcx "0,0" "" aa)<BR> (setq pn (ssget "X" (list(cons 0 "CIRCLE")(cons 8 "pin")(CONS 40 2) )))<BR> (setq k0 (ssname pn 0))<BR> (setq o1 (cdr (assoc 10 (entget k0))))<BR> (setq k1 (ssname pn 1))<BR> (setq o2 (cdr (assoc 10 (entget k1))))<BR> (setq o1x (car o1)) (setq o1y (cadr o1))<BR> (setq o2x (car o2)) (setq o2y (cadr o2))<BR> (setq po1 (list o1x (- fyo (/ dy 2))))<BR> (command "dim" "ordinate" o1 po1 "")<BR> (setq po2 (list o2x (- fyo (/ dy 2))))<BR> (command "dim" "ordinate" o2 po2 "")<BR> (if (> o1x o2x)(progn<BR> (setq po3 (list (+ (- -5 (/ dx 2)) fxo) o2y)) (setq po o2)(setq poa o1)<BR> (command "dim" "ordinate" o2 po3 "")))<BR> (if (> o2x o1x)(progn<BR> (setq po3 (list (+ (- -5 (/ dx 2)) fxo) o1y)) (setq po o1)(setq poa o2)<BR> (command "dim" "ordinate" o1 po3 "")))<BR>(setq xx (list fxo (+ (- -15 (/ dy 2)) fyo) 0.0))<BR> (setq yy (list (+ (- -15 (/ dx 2)) fxo) fyo))<BR> (command "dim" "ordinate" oo xx "")<BR> (command "dim" "ordinate" oo yy "")<BR> (if(/= oo ooo)(progn<BR>(setq xx (list 0.0 (+ (- -15 (/ dy 2)) fyo) 0.0))<BR> (setq yy (list (+ (- -15 (/ dx 2)) fxo) 0.0 0.0))<BR> (command "dim" "ordinate" ooo xx "")<BR> (command "dim" "ordinate" ooo yy "")<BR> ))<BR> (command "exit")<BR> (initget 128 "0 1 2 " )<BR> (setq bh (getkword "\n请选择 <0>一次冲 <1>第一次冲 <2>第二次冲"))<BR> (if (= bh nil) (setq bh ""))<BR> (if (= bh "0") (setq bh ""))<BR> (setq f "c:\\dwg\\")<BR> (setq fn (getvar "dwgname"));(setq df (strlen (getvar "dwgprefix")))<BR> ;(setq df (+ df 1))<BR> (setq nam (substr fn 1 4))<BR> (setq f (strcat f nam))(setq f (strcat f bh))<BR> (setq f (strcat f "pin"))<BR> (setq ap (open f "w"))(princ dx ap)(princ " " ap)(princ dy ap)(princ "\n" ap)<BR> (princ (car po) ap)(princ " " ap)(princ (cadr po) ap)(princ "\n" ap)(close ap)<BR> (setq f1 "c:\\dwg\\")(setq f1 (strcat f1 nam))(setq f1 (strcat f1 bh)) (setq f1 (strcat f1 "pin"))<BR> (setq bp (open f1 "w"))(princ dx bp)(princ " " bp)(princ dy bp)(princ "\n" bp)<BR> (princ (car po) bp)(princ " " bp)(princ (cadr po) bp)(princ "\n" bp)<BR> (princ (car poa) bp)(princ " " bp)(princ (cadr poa) bp)(princ "\n" bp)<BR>;(setq py1 (fix (/ dy 2)))<BR> (setq py1 dyy)<BR> (setq cx (/ dx 2))<BR> (setq fx (* 10 (fix (/ (+ dx 19.99999) 10))))<BR>;(setq px1 (+ (* 10 (fix (/ (+ dx 6) 10))) 5))<BR>;(setq dv (- px1 dx))(if (< dv 5)(setq px1 (+ px1 10)))<BR>;(princ (/ (+ x0 x1) 2) bp)(princ "\n" bp)(princ (/ (+ y2 y3) 2) bp)<BR>;(princ "-5.0" bp)(princ py1 bp)(princ "\n" bp)(princ px1 bp)(princ " " bp)(princ py1 bp)<BR> (close bp)<BR> (setq do1 (list (- (/ (+ x0 x1) 2) (/ fx 2)) py1 0.0))<BR>;(setq do2 (list px1 py1 0.0))<BR> (setq do2 (list (+ (/ (+ x0 x1) 2) (/ fx 2)) py1 0.0))<BR> (command "layer" "s" "center" "")<BR> (command "circle" do1 "2" )<BR> (command "circle" do2 "2" )<BR> (setq pns (ssget "X" (list(cons 0 "CIRCLE")(cons 8 "center")(CONS 40 2) )))<BR> (command "move" pns "" pcx oo)<BR> (if (/= o1y o2y)(progn<BR> (setq pnd (ssget "X" (list(cons 8 "dim"))))<BR> (command "erase" pnd "")(command "redraw")<BR> (setq pnd (ssget "X" (list(cons 8 "center"))))<BR> (command "erase" pnd "")(command "redraw")<BR> (command "layer" "s" "pin" "")<BR> (princ "\n固定柱未在同一线上,请重新设置")<BR> ))<BR> (setvar "cmdecho" 1)<BR>)<BR>轩辕凝决 发表于 2006-2-13 10:35:00
时髦的玩意baohui668 发表于 2006-4-7 15:02:00
<P>QQ:13757306</P><P>ARX开发群,另有少数VBA,人数不多了:)</P>
psufngah 发表于 2006-5-18 22:48:00
<P>22584977</P><P>CAD交流二次开发的都可以来加!</P>
kbssavor 发表于 2006-12-23 11:47:00
<p>想去聊天室,却遇闭门羹。</p><p>对不起,程序所在目录不是虚拟目录,或设置有错误,Global.asa 没有被执行。本程序需要虚拟目录的支持!</p><p>是怎么一回事呀?</p>mccad 发表于 2006-12-23 13:03:00
网站程序这段时间升级,一些频道并未完成。smok 发表于 2007-1-17 09:38:00
<p>既然都满了!那就不加了!</p>1dpf520 发表于 2007-2-23 16:48:00
<p>[这么多群啊!!!</p><p>这里也有个聊天室,大家有空也可进这里面聊聊啊!!~~~~~~~~~~</p><p>有兴趣交流的可以Q我:279710796说明是"明经"就可以了~V~</p><p></p>