明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2075|回复: 12

请大家帮我分析一段lisp程序,谢谢

  [复制链接]
发表于 2004-11-3 15:17:00 | 显示全部楼层 |阅读模式
(defun CLK( )
(inivar) ;初始化系统变量
(command "layer" "m" "rei" "c" "1" "" "s" "0" "")
(command "layer" "m" "pdim" "c" "green" "" "s" "0" "")
(command "layer" "s" "0" "")
(setq b (getreal "\n截面宽(mm):"))
(setq h (getreal "\n截面高(mm):"))
(setq bh (if
(setq temp (getreal "\n板厚(mm)<0>:"))
temp 0) ;if end
) ;setq end
(setq scale (getvar "USERR1"))
(setq bl (if (= bh 0) 0 (* 10 scale)))
(princ "\n局部比例:<")
(princ scale)
(setq txt (getstring ">"))
(if (/= (ascii txt) 0)
(setq scale1 (atoi txt))
(setq scale1 scale)
) ;if end
(setq diml (getvar "DIMLFAC"))
(setvar "DIMLFAC" (/ scale1 scale))
(setq factor (/ scale scale1) ;计算放大比例
dx (* b factor)
dy (* h factor)
bh (* bh factor)
insl (+ dx (* 75 scale))
) ;setq end
(command "zoom" "a")
(princ "\n插入点:")
(command "insert" "border" "x" insl "y" insl "r" 0 pause)
(setq p1 (getvar "lastpoint")
zp1 p1
zp2 (polar zp1 0 insl)
zp2 (polar zp2 (* 0.5 pi) insl)
p1 (polar p1 0 (* 30 scale))
p1 (polar p1 (* 0.5 pi) (* 30 scale))
) ; setq end
(command "erase" "l" "")
(command "zoom" "w" zp1 zp2)
(setq x1 (nth 0 p1)
y1 (nth 1 p1)
x2 (+ x1 dx)
y2 y1
x3 x1
y3 (+ y1 dy)
x4 x2
y4 y3
) ;setq end
(setq dxy (* 1.5 scale)) 我只是截取一段程序,上面最让我疑惑的是scale,scale1的用法,请高手指点。
发表于 2004-11-3 15:23:00 | 显示全部楼层
你的border块是什么来的? 还有不太明白你程序的用途
 楼主| 发表于 2004-11-3 15:57:00 | 显示全部楼层
border是一个1×1的矩形,为了在插入块的时候避免与其他实体重迭,而进行的一个定位
发表于 2004-11-3 16:12:00 | 显示全部楼层
2楼的意思是要你传个图上来...没有你的图,就没有BORDER块,你的程序就无法调试......
 楼主| 发表于 2004-11-3 16:21:00 | 显示全部楼层
那我把整个程序和border图块打包传上来吧。


调试liang.lsp,请先加载initial.lsp。谢谢

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2004-11-3 16:52:00 | 显示全部楼层
不知道程序做什么用的,程序本身也有问题...也不知道你想问什么?


所以这样的帖子太难回答了...希望你问得明确点
 楼主| 发表于 2004-11-3 17:04:00 | 显示全部楼层
程序主要用来画一个梁的剖面图,而我主要是对程序里的scale,scale1等变量(用来设置比列)的用法不是很理解。
发表于 2004-11-3 17:21:00 | 显示全部楼层
比例就是scale1除以userr1里面存的数据,


在程序中将这个数据赋给了scale,这里是100,所以比例就是scale1/100,scale就是用户输入的TXT,
 楼主| 发表于 2004-11-3 17:29:00 | 显示全部楼层
userr1主要是存什么数据的?还有scale是用户输入的TXT的什么比例?cad中的比例比较多,那个局部比例是什么意思?
发表于 2004-11-3 17:36:00 | 显示全部楼层
userr1是存实数的


至于那个局部比例是什么意思,你最好去问作者,因为这个程序有问题,无法执行的......
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-30 08:41 , Processed in 0.171707 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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