CAD运行AutoLISP代码错误,求解哪里错了
已知数表,用AutoLISP画三角带,但是程序总是说代码有缺陷。代码如下(Defunc:sjd()(Setqi(Getreal"\nInputxinghao:"))(Se...
已知数表,用AutoLISP画三角带,但是程序总是说代码有缺陷。
代码如下
(Defun c:sjd()
(Setq i (Getreal "\nInputxinghao:"))
(Setq f (Open "c:\\sjd.txt" "r"))
(Setq sb (Read (Strcat "(" (Read-line f) ")")))
(Setq a (Nth 1 sb) h (Nth 2 sb) a0 (Nth 3 sb) y0 (Nth 4 sb))
(While(/= a 999)
(if(and (> i 0) (<= i 6))
(Setq aj a hj h a0j a0 y0j y0)
)
(Setq sb (Read (Strcat "(" (Read-line f) ")")))
(Setqa (Nth 1 sb) h (Nth2 sb) a0 (Nth 3 sb) y0 (Nth 4 sb))
)
(princ aj)
(princ hj)
(princ a0j)
(princ y0j)
(close f)
(Setq pt (Getpoint "\nInsert point:")
px (Car pt) py (Cadr pt))
(setq x1 (- px (/ (- a a0)(*2 y0))(- px(/ a 2))5.0)
x2 (-px (/(- a a0)(*2 y0))(- px(/ a 2)))
x3 (+px (/(- a a0)(*2 y0))(- px(/ a 2)))
x4 (+px(px(/(-a a0)(* 2 y0))(- px(/ a2))5.0)
x5 (+ px (/ a0 2))
x6 (+ px (/ a 2))
x7 (- px (/ a 2))
x8 (- px (/ a0 2))
y1 (+ py (-hj y0j))
y2(+ py hj)
y3(- py 5.0)
y4(+ py hj 5.0)
)
(Command "ltscale" "0.5")
(Command "cmdecho" "0")
(Command "-layer""s" "center" "")
(command "line" (list x1 py) (list x4 py) "")
(command "line" (list px y3) (list px y4) "")
(command "pline" (list x2 p3) (list x3 py) (list x5 y1) (list x6 y2)
(list x7 y2) (list x8 y1) (list x2 py)
(Command "-layer" "s" "hatch" "")
(command "hatch" "ansi37" "1" "90" "l" "")
(command "hatch" "ansi37" "1" "0" "l" "")
) 展开
代码如下
(Defun c:sjd()
(Setq i (Getreal "\nInputxinghao:"))
(Setq f (Open "c:\\sjd.txt" "r"))
(Setq sb (Read (Strcat "(" (Read-line f) ")")))
(Setq a (Nth 1 sb) h (Nth 2 sb) a0 (Nth 3 sb) y0 (Nth 4 sb))
(While(/= a 999)
(if(and (> i 0) (<= i 6))
(Setq aj a hj h a0j a0 y0j y0)
)
(Setq sb (Read (Strcat "(" (Read-line f) ")")))
(Setqa (Nth 1 sb) h (Nth2 sb) a0 (Nth 3 sb) y0 (Nth 4 sb))
)
(princ aj)
(princ hj)
(princ a0j)
(princ y0j)
(close f)
(Setq pt (Getpoint "\nInsert point:")
px (Car pt) py (Cadr pt))
(setq x1 (- px (/ (- a a0)(*2 y0))(- px(/ a 2))5.0)
x2 (-px (/(- a a0)(*2 y0))(- px(/ a 2)))
x3 (+px (/(- a a0)(*2 y0))(- px(/ a 2)))
x4 (+px(px(/(-a a0)(* 2 y0))(- px(/ a2))5.0)
x5 (+ px (/ a0 2))
x6 (+ px (/ a 2))
x7 (- px (/ a 2))
x8 (- px (/ a0 2))
y1 (+ py (-hj y0j))
y2(+ py hj)
y3(- py 5.0)
y4(+ py hj 5.0)
)
(Command "ltscale" "0.5")
(Command "cmdecho" "0")
(Command "-layer""s" "center" "")
(command "line" (list x1 py) (list x4 py) "")
(command "line" (list px y3) (list px y4) "")
(command "pline" (list x2 p3) (list x3 py) (list x5 y1) (list x6 y2)
(list x7 y2) (list x8 y1) (list x2 py)
(Command "-layer" "s" "hatch" "")
(command "hatch" "ansi37" "1" "90" "l" "")
(command "hatch" "ansi37" "1" "0" "l" "")
) 展开
2个回答
展开全部
(Defun c:sjd()
(Setq i (Getreal "\nInputxinghao:"))
(Setq f (Open "c:\\sjd.txt" "r"))
(Setq sb (Read (Strcat "(" (Read-line f) ")")))
(Setq a (Nth 1 sb) h (Nth 2 sb) a0 (Nth 3 sb) y0 (Nth 4 sb))
(While(/= a 999)
(if(and (> i 0) (<= i 6))
(Setq aj a hj h a0j a0 y0j y0)
)
(Setq sb (Read (Strcat "(" (Read-line f) ")")))
(Setqa (Nth 1 sb) h (Nth2 sb) a0 (Nth 3 sb) y0 (Nth 4 sb))
)
(princ aj)
(princ hj)
(princ a0j)
(princ y0j)
(close f)
(Setq pt (Getpoint "\nInsert point:")
px (Car pt) py (Cadr pt))
(setq x1 (- px (/ (- a a0)(*2 y0))(- px(/ a 2))5.0)
x2 (-px (/(- a a0)(*2 y0))(- px(/ a 2)));-------------
x3 (+px (/(- a a0)(*2 y0))(- px(/ a 2)));--------------
x4 (+px(px(/(-a a0)(* 2 y0))(- px(/ a2))5.0);----------
x5 (+ px (/ a0 2))
x6 (+ px (/ a 2))
x7 (- px (/ a 2))
x8 (- px (/ a0 2))
y1 (+ py (-hj y0j));-----------------
y2(+ py hj)
y3(- py 5.0)
y4(+ py hj 5.0)
)
(Command "ltscale" "0.5")
(Command "cmdecho" "0")
(Command "-layer""s" "center" "")
(command "line" (list x1 py) (list x4 py) "")
(command "line" (list px y3) (list px y4) "")
(command "pline" (list x2 p3) (list x3 py) (list x5 y1) (list x6 y2)
(list x7 y2) (list x8 y1) (list x2 py)
(Command "-layer" "s" "hatch" "")
(command "hatch" "ansi37" "1" "90" "l" "")
(command "hatch" "ansi37" "1" "0" "l" "")
)
给你标出了程序中的错误行,都是低级错误。
(Setq i (Getreal "\nInputxinghao:"))
(Setq f (Open "c:\\sjd.txt" "r"))
(Setq sb (Read (Strcat "(" (Read-line f) ")")))
(Setq a (Nth 1 sb) h (Nth 2 sb) a0 (Nth 3 sb) y0 (Nth 4 sb))
(While(/= a 999)
(if(and (> i 0) (<= i 6))
(Setq aj a hj h a0j a0 y0j y0)
)
(Setq sb (Read (Strcat "(" (Read-line f) ")")))
(Setqa (Nth 1 sb) h (Nth2 sb) a0 (Nth 3 sb) y0 (Nth 4 sb))
)
(princ aj)
(princ hj)
(princ a0j)
(princ y0j)
(close f)
(Setq pt (Getpoint "\nInsert point:")
px (Car pt) py (Cadr pt))
(setq x1 (- px (/ (- a a0)(*2 y0))(- px(/ a 2))5.0)
x2 (-px (/(- a a0)(*2 y0))(- px(/ a 2)));-------------
x3 (+px (/(- a a0)(*2 y0))(- px(/ a 2)));--------------
x4 (+px(px(/(-a a0)(* 2 y0))(- px(/ a2))5.0);----------
x5 (+ px (/ a0 2))
x6 (+ px (/ a 2))
x7 (- px (/ a 2))
x8 (- px (/ a0 2))
y1 (+ py (-hj y0j));-----------------
y2(+ py hj)
y3(- py 5.0)
y4(+ py hj 5.0)
)
(Command "ltscale" "0.5")
(Command "cmdecho" "0")
(Command "-layer""s" "center" "")
(command "line" (list x1 py) (list x4 py) "")
(command "line" (list px y3) (list px y4) "")
(command "pline" (list x2 p3) (list x3 py) (list x5 y1) (list x6 y2)
(list x7 y2) (list x8 y1) (list x2 py)
(Command "-layer" "s" "hatch" "")
(command "hatch" "ansi37" "1" "90" "l" "")
(command "hatch" "ansi37" "1" "0" "l" "")
)
给你标出了程序中的错误行,都是低级错误。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询