gprspda 发表于 2011-10-15 09:42:20

求助帮忙检查这个程序

我用LISP写的程序,输入参数值以后,出来的图形,特别特别的大,需要缩小好多倍才能看见,请各位帮忙检查一下程序哪里出现了错误.
(defun c:flx(/ p p0 p1 p2 p3 p4 p5 p6 v c h w r1 r2 b1 b2 b3 α e t1)
(setq v (getint"\n输入指示空速"))
(setq c (getint"\n输入与ISA的差值"))
(setq h (getint"\n输入高度(米)"))
(setq w (getint"\n输入风速"))
(setq p (getpoint"\n确定起始点"))
(setq α(getangle"\n输入转弯坡度角"))
(setq t1 (/(* v 171233 (expt(-(+ 288 c) (* 0.006496 h))0.5)) (expt(- 288 (* 0.006496 h))2.628)));真空速
(setq r2 (/(* 3431 (/(sin(* (/ α 180) pi))(cos(/(/ α 180) pi)))) (* pi v)));;;sina后面的括弧要西文括弧
(if (> r2 3)(setq r2 3))
(setq r1 (/ v (* 20 pi r2)))
      (setq p0 (polar p 0 r1))
(setq e (/ w (* 40 r2)))
(setq p1 (polar p0 (/ pi 2) e))
(setq p2 (polar p0 0 e))
(setq p3 (polar p0 (/ (- pi) 2) e))
(setq b1 (expt(+(* r1 r1)(* e e)) 0.5))
(setq b2 (+ r1 e))
(setq b3 (+ r1 (* 2 e)))
(setq p4 (polar p1 (/ pi 2) b1))
(setq p5 (polar p2 0 b2))
(setq p6 (polar p3 (/ (- pi) 2) b3))
(command "_arc" "c" p0 p4 p)
(command "_arc" "c" p0 p5 p4)
(command "_arc" "c" p0 p6 p5)
(setq fn(open (getfiled "将文件保存为:" "gc.txt" "txt" 1) "w"))
(write-line (strcat "t=" (rtos t)) fn)
(write-line (strcat "r2=" (tros r2)) fn)
(write-line (strcat "r1=" (rtos r1)) fn)
(write-line (strcat "b1=" (rtos b1)) fn)
(write-line (strcat "b2=" (rtos b2)) fn)
(write-line (strcat "b3=" (rtos b3)) fn)
(close fn)
(princ)
      )

AMTONNY 发表于 2011-10-15 10:59:48

(defun c:flx(/ p p0 p1 p2 p3 p4 p5 p6 v c h w r1 r2 b1 b2 b3 α e t1)
(setq v (getint"\n输入指示空速"))
(setq c (getint"\n输入与ISA的差值"))
(setq h (getint"\n输入高度(米)"))
(setq w (getint"\n输入风速"))
(setq p (getpoint"\n确定起始点"))
(setq α(getangle"\n输入转弯坡度角"))
(setq t1 (/(* v 171233 (expt(-(+ 288 c) (* 0.006496 h))0.5)) (expt(- 288 (* 0.006496 h))2.628)));真空速
(setq r2 (/(* 3431 (/(sin(* (/ α 180) pi))(cos(/(/ α 180) pi)))) (* pi v)));;;sina后面的括弧要西文括弧
(if (> r2 3)(setq r2 3))
(setq r1 (/ v (* 20 pi r2)))
      (setq p0 (polar p 0 r1))
(setq e (/ w (* 40 r2)))
(setq p1 (polar p0 (/ pi 2) e))
(setq p2 (polar p0 0 e))
(setq p3 (polar p0 (/ (- pi) 2) e))
(setq b1 (expt(+(* r1 r1)(* e e)) 0.5))
(setq b2 (+ r1 e))
(setq b3 (+ r1 (* 2 e)))
(setq p4 (polar p1 (/ pi 2) b1))
(setq p5 (polar p2 0 b2))
(setq p6 (polar p3 (/ (- pi) 2) b3))
(command "_arc" "c" p0 p4 p)
(command "_arc" "c" p0 p5 p4)
(command "_arc" "c" p0 p6 p5)
(setq fn(open (getfiled "将文件保存为:" "gc.txt" "txt" 1) "w"))
(write-line (strcat "t=" (rtos t)) fn)
(write-line (strcat "r2=" (tros r2)) fn)
(write-line (strcat "r1=" (rtos r1)) fn)
(write-line (strcat "b1=" (rtos b1)) fn)
(write-line (strcat "b2=" (rtos b2)) fn)
(write-line (strcat "b3=" (rtos b3)) fn)
(close fn)
      (command "_zoom" "E");;我在这里加了这个,楼主看看这样行不??
(princ)
      )

gprspda 发表于 2011-10-21 20:56:53

AMTONNY 发表于 2011-10-15 10:59 static/image/common/back.gif
(defun c:flx(/ p p0 p1 p2 p3 p4 p5 p6 v c h w r1 r2 b1 b2 b3 α e t1)
(setq v (getint"\n输入指示空速 ...

加上这个之后,我原来的图形也都缩小了,要画的图形还是要自行缩小,这是什么原因

AMTONNY 发表于 2011-10-21 22:19:44

(command "_zoom" "E");;这个是自动在画图结束时进行了范围缩放

gprspda 发表于 2011-10-21 22:23:44

AMTONNY 发表于 2011-10-21 22:19 static/image/common/back.gif
(command "_zoom" "E");;这个是自动在画图结束时进行了范围缩放

有没有针对单个图形,进行缩放的?

AMTONNY 发表于 2011-10-21 22:31:13

      (command "_zoom" "0.5X") 你看这样行不?缩小0.5,或者依你的画图习惯缩一点《如 0.8.....》应该也行哦

gprspda 发表于 2011-10-21 22:55:18

AMTONNY 发表于 2011-10-21 22:31 static/image/common/back.gif
(command "_zoom" "0.5X") 你看这样行不?缩小0.5,或者依你的画图习惯缩一点《如 0.8.....》应该也 ...

好的,谢谢...还有另外一个问题,我这个程序想画的是,三段连续的弧线,但是现在,程序运行结束之后,出来的是三段分开的,你是否可以帮我解决一下这个问题?谢谢

cabinsummer 发表于 2011-10-21 23:10:49

gprspda 发表于 2011-10-21 22:23 static/image/common/back.gif
有没有针对单个图形,进行缩放的?

针对单个图形缩放是可以做到的,要先取出单个图形的边界值再进行窗口缩放

cabinsummer 发表于 2011-10-21 23:11:26

gprspda 发表于 2011-10-21 22:55 static/image/common/back.gif
好的,谢谢...还有另外一个问题,我这个程序想画的是,三段连续的弧线,但是现在,程序运行结束之后,出来 ...

可以用pedit命令解决

gprspda 发表于 2011-10-22 09:17:33

cabinsummer 发表于 2011-10-21 23:11 static/image/common/back.gif
可以用pedit命令解决

可以详细的解释一下吗?
页: [1] 2
查看完整版本: 求助帮忙检查这个程序