Mindaugas123 发表于 2022-7-6 08:30:36

需要一点帮助

所以我在autolisp上遇到了一个问题,我需要制作一个程序来绘制一个简单的表单。我写的程序,但它说,有一个错误的地方,我不能找到它。我来自立陶宛,所以一些文本你不会理解,但它并不重要,所以这里是程序,我附上了文件。
 

; -------------------------------------------------------
; profa.lsp
; Profilio braižymas
; DB0/3 gr. stud. G., Sveikataitė
; D. Kalisinskas
; KTU, Inžinerinės grafikos katedra.
; --DTR funkcijos įvedimas į programą-----
(defun dtr (alfa)
       (* pi (/ alfa 180.0))
   )
;Duomenų įvedimas: p0, L, L1, H, c, b, R1, W, Fi
   (defun duom ()
       (setq p0 (getpoint "\nPazymekite bazini taska p0:"))
       (setq L (getdist "\nProfilio plotis L <30>:"))
       (if (null L) (setq b0 30))
       (setq L1 (getdist "\nprofilio plotis L1 <9>:"))
       (if (null L1) (setq L1 9))
       (setq H (getdist "\nprofilio aukstis H <30>:"))
       (if (null H) (setq h0 30))
       (setq c (getdist "\nprofilio aukstis c <3>:"))
       (if (null c) (setq c 3))
       (setq b (getdist "\nprofilio aukstis b <6>:"))
       (if (null b) (setq b 6))
       (setq R1 (getdist "\nuzapvalinimo spindulys R1 <10.5>:"))
       (if (null R1) (setq R1 10.5))
       (setq w (getdist "\npolilinijos plotis <0.5>:"))
       (if (null w) (setq w 0.5))
       (setq Fi (getdist "\nprofilio pasukimo kampas Fi <0.0>:"))
       (if (null Fi) (setq Fi 0.0))
      )
;--Taškų Koordinačių paskaičiavimas-----
(defun piont ()
       (setq p1 (polar p0 (dtr 90) H))
       (setq p2 (polar p1 0 L1))
       (setq p3 (list (car p2) (- (cadr p2) c)))
       (setq p4 (polar p3 (dtr 315)(* R1(sqrt 2)))
(setq p5 (polar p4 (dtr -315)(* R1(sqrt 2)))      
       (setq p6 (polar p5 (dtr -90) b0))
)
;--Profilio braizymas--
(defun braiz ()
       (command "PLINE" p0 "w" w "" p1 p2 p3 "ARC" "ANGLE" "-90" p4 "ARC" "ANGLE" "90" p5 "b0" p6 p0 "")
       (setq PL1 (entlast))
       (command "ROTATE" PL1 "" p0 Fi)
       (steq PL2 (entnext PL1))
       (command "hatch" "ansi31" 1 0 PL1 "")
      )
;--Pagrindine programa-------------------------------------------
--Pagrindine programa--
(defun C:PROF1 ()
      (dtr)
      (duom)
      (braiz)

误差从这一行开始(setq p4(极性p3(dtr 315)(*R1(sqrt 2)))直到底部
Autolisp2.zip

SLW210 发表于 2022-7-6 08:55:37

请阅读代码发布指南。

fixo 发表于 2022-7-6 09:24:47

欢迎加入
我在你的代码中发现了一些不平衡的括号
尝试编辑lisp:

; -------------------------------------------------------
; profa.lsp
; Profilio braizymas
; DB0/3 gr. stud. G., Sveikataite
; D. Kalisinskas
; KTU, Inzinerines grafikos katedra.
; --DTR funkcijos ivedimas i programa-----
(defun dtr (alfa)
(* pi (/ alfa 180.0))
)
;Duomenu ivedimas: p0, L, L1, H, c, b, R1, W, Fi
(defun duom ()
(setq p0 (getpoint "\nPazymekite bazini taska p0:"))
(setq L (getdist "\nProfilio plotis L <30>:"))
(if (null L) (setq b0 30))
(setq L1 (getdist "\nprofilio plotis L1 <9>:"))
(if (null L1) (setq L1 9))
(setq H (getdist "\nprofilio aukstis H <30>:"))
(if (null H) (setq H 30));was ho
(setq c (getdist "\nprofilio aukstis c <3>:"))
(if (null c) (setq c 3))
(setq b (getdist "\nprofilio aukstis b <6>:"))
(if (null b) (setq b 6))
(setq R1 (getdist "\nuzapvalinimo spindulys R1 <10.5>:"))
(if (null R1) (setq R1 10.5))
(setq w (getdist "\npolilinijos plotis <0.5>:"))
(if (null w) (setq w 0.5))
(setq Fi (getdist "\nprofilio pasukimo kampas Fi <0.0>:"))
(if (null Fi) (setq Fi 0.0))
)
;--Tasku Koordinaciu paskaiciavimas-----
(defun piont ()
(setq p1 (polar p0 (dtr 90) H))
(setq p2 (polar p1 0 L1))
(setq p3 (list (car p2) (- (cadr p2) c)))
(setq p4 (polar p3 (dtr 315)(* R1(sqrt 2))))
(setq p5 (polar p4 (dtr -315)(* R1(sqrt 2))))
(setq p6 (polar p5 (dtr -90) b0))
)
;--Profilio braizymas--
(defun braiz ()
(command "PLINE" "_non" p0 "w" w "" "_non" p1 "_non" p2 "_non" p3 "ARC" "ANGLE" "-90" "_non" p4 "ARC" "ANGLE" "90" "_non" p5 "L" "_non" p6 "_non" p0 "")
(setq PL1 (entlast))
(command "ROTATE" PL1 "" p0 Fi)
(setq PL2 (entnext PL1))
(command "hatch" "ansi31" 1 0 PL1 "")
)
;--Pagrindine programa-------------------------------------------
(defun C:ROF1 ()
(duom)
(piont)
(braiz)
(princ)
)
(C:ROF1);<-- autorun for debug

BIGAL 发表于 2022-7-6 09:33:06

页: [1]
查看完整版本: 需要一点帮助