明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1518|回复: 4

求助!

[复制链接]
发表于 2004-4-4 07:26:00 | 显示全部楼层 |阅读模式
这是一个法兰盘的程序,可是不知那里有问题,请各位大侠前辈指正!谢谢!
 楼主| 发表于 2004-4-4 07:29:00 | 显示全部楼层
fldlg:dialog{
label="法兰盘参数化绘图";
:column{
:boxed_column{
}
:row{
:boxed_column{
label="请输入插入点:";
:edit_box{
label="坐标x:";
key="x";
edit_width=7;
}
:edit_box{
label="坐标y:";
key="y";
edit_width=7;
}
}
:boxed_column{
label="请输入法兰盘参数:";
:edit_box{
label="外径R1:";
key="R1";
edit_width=7;
}
:edit_box{
label="内径R2:";
key="R2";
edit_width=7;
}
:edit_box{
label="法兰孔半径R3:";
key="R3";
edit_width=7;
}
:edit_box{
label="法兰孔个数n:";
key="n";
edit_width=7;
}
}
}
}
ok_cancel;
}
 楼主| 发表于 2004-4-4 07:31:00 | 显示全部楼层
(defun falan ()
(new_dialog"fldlg"(load_dialog"falan"))
(ACTION_TILE "R1" "(setq s1 $value)")
(ACTION_TILE "R2" "(setq s2 $value)")
(ACTION_TILE "R3" "(setq s3 $value)")
(ACTION_TILE "n" "(setq n1 $value)")
(ACTION_TILE "x" "(setq x1 $value)")
(ACTION_TILE "y" "(setq y1 $value)")
(start_dialog)
(if (=0 (start_dialog))
(progn(setq r3 (atof s1)
r1 (atof s2)
r (atof s3)
n (atof n1)
x (atof x1)
y (atof y1)
)
(setq pt(list x y 0.0))
)
)
(setq r2(/(+r1 r3)2))
(setq pt1(polar pt(/pi 2.0)(+r3 3))
pt2(polar pt(-(/pi 2.0))(+r3 3))
pt3(polar pt pi (+r3 3))
pt4(polar pt 0.0 (+r3 3))
)
;绘图指令

(command"ltscale""10")
(command"layer""m""0""1""continuous""0""c""green""0""")
(command"circle"pt r1)
(command"circle"pt r3)
(command"circle"(polar pt 0 r2) r)
(command"array""l""p"pt n 360 "n")
(command"ltscale""30")
(command"layer""m""1""1""continuous""1""c""red""1""")
(command"circle"pt r2)
(command"line"pt1 pt2"")
(command"line"pt3 pt4"")
(command"redraw")
(setq area(*pi(-(*r3 r3)(*r1 r1)(*n r r))))
)
发表于 2004-4-4 08:28:00 | 显示全部楼层
; 现在可以画了,问题很多,你慢慢改进吧
(defun falan ()
(new_dialog"fldlg"(load_dialog"falan"))
(ACTION_TILE "R1" "(setq s1 $value)")
(ACTION_TILE "R2" "(setq s2 $value)")
(ACTION_TILE "R3" "(setq s3 $value)")
(ACTION_TILE "n" "(setq n1 $value)")
(ACTION_TILE "x" "(setq x1 $value)")
(ACTION_TILE "y" "(setq y1 $value)")
(if (= 1 (start_dialog))
(progn (setq r3 (atof s1)
r1 (atof s2)
r (atof s3)
n (ATOI n1)
x (atof x1)
y (atof y1)
)
(setq pt (list x y 0.0))
)
)
(setq r2 (/ (+ r1 r3) 2))
(setq pt1 (polar pt (/ pi 2.0) (+ r3 3))
pt2 (polar pt (- (/ pi 2.0)) (+ r3 3))
pt3 (polar pt pi (+ r3 3))
pt4 (polar pt 0.0 (+ r3 3))
)
;绘图指令

;;; (command "ltscale" "10")
;;; (command "layer" "m" "0" "1" "continuous" "0" "c" "green" "0" "")
(command "circle" pt r1)
(command "circle" pt r3)
(command "circle" (polar pt 0 r2) r)
(command "array" (ENTLAST) "" "p" pt n 360 "")
;;; (command "ltscale" "30")
;;; (command "layer" "m" "1" "1" "continuous" "1" "c" "red" "1" "")
(command "circle" pt r2)
(command "line" pt1 pt2 "")
(command "line" pt3 pt4 "")
(command "redraw")
(setq area (* pi (- (* r3 r3) (* r1 r1) (* n r r))))
(PRINC)
)
 楼主| 发表于 2004-4-4 12:15:00 | 显示全部楼层
感谢楼上回贴! 不过在在控制台输入 (falan)是说 _$ (falan)
; 错误: 参数类型错误: numberp: nil 不知是哪的错啊?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-28 00:44 , Processed in 0.183477 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表