jonathann3891 发表于 2022-7-5 19:30:19

谢谢大家的帮助。
 
我想出来了。我在这一行代码中有太多“):
(setq psize (getkword (strcat "\nSelect Plot :"))))

BIGAL 发表于 2022-7-5 19:33:36

免费赠品,带深度if等的检查支架
 

(defun c:chkbrk (/ opf bkt chekdfile rdctl wkfile currentln wln ltr ncln)

(setvar "cmdecho" 0)

(prompt "\nlook at end of line")
;(setq chekdfile (getstring "enter name of file :"))
(SETQ chekdfile (getfiled "Enter file name:" " " "LSP" 4))
(setq opf (open chekdfile "r"))
(setq bkt 0)
(setq blkl 0)
(setq rdctl 1)
(setq wkfile (open "c:\temp\wow.lsp" "w"))
(setq currentln "a")
(while (/= blkl 6)
(setq currentln (read-line opf))
(if (= currentln nil)(setq currentln ""))
(if (= currentln "")(setq blkl (+ 1 blkl))(setq blkl 1))
(setq wln currentln)                                                      
(while (/= wln "")
       (setq ltr (substr wln 1 1))
       (setq wln (substr wln 2))
       (cond ((= (ascii ltr) 34) (if (= rdctl 0)(setq rdctl 1)(setq rdctl 0)))
               ((and (= ltr "(")(= rdctl 1))(setq bkt (+ bkt 1)))
               ((and (= ltr ")")(= rdctl 1))(setq bkt (- bkt 1)))
               ((and (= ltr ";")(= rdctl 1))(setq wln ""))
               ;(t (prompt ltr))
       )
)
(setq ncln (strcat currentln ";" (itoa bkt)
(if (= rdctl 0) "string open" "")))
(if (/= currentln "")(write-line ncln wkfile))
)
(close wkfile)
(close opf)
(prompt (strcat "open brakets= " (itoa bkt) "."))
)
(setq ang1 nil
   pt1 nil
   pt2 nil
   pt3 nil
   pt4 nil
   pt5 nil)

(command "chkbrk")
(princ)

jonathann3891 发表于 2022-7-5 19:38:31

我不能让22x34去上班。我出错了;错误:无函数定义:22X34
 
但如果我把除了22x34的部分之外的所有内容都注释掉,它就可以了。
 
我肯定我错过了一些小东西。
 
(defun c:iplot (/ psize)
(initget 1 "11x17 PDF 22x34") ;
(setq psize (getkword (strcat "\nSelect Plot :")))
(cond
   ((= psize "11x17") (11x17))
   ((= psize "PDF") (PDF))
   ((= psize "22x34") (22x34))
   (t (princ "\nPlot cancelled"))
)
)

(defun 11x17 ()

(command "tilemode" "0")
(command "-plot" "y" "" "DefaultPrinter.pc3" "11x17" "I"
"L" "N" "W" "0,0" "34,22" "fit" "C" "Y" "CMS_b_black.ctb" "Y" "N" "N" "N""N" "N" "Y")
)

(defun PDF (/ fnm)

(if (setq fnm (getfiled "Specify Save Location" "" "pdf" 1))
(progn

(command "tilemode" "0")
(command "-plot" "y" "" "Dwg To PDF.pc3" "ANSI expand D (34.00 x 22.00 Inches)" "I"
"L" "N" "E" "1:1" "C" "Y" "CMS_d_black.ctb" "Y" "N" "N" "N" fnm "N" "Y")
)

(defun 22x34 ()

(command "tilemode" "0")
(command "-plot" "y" "" "HP7100-A.pc3" "D (landscape)" "I"
"L" "N" "E" "1:1" "C" "Y" "CMS_d_black.ctb" "Y" "N" "N" "N""N" "N" "Y")
)
)
(princ)
)

BIGAL 发表于 2022-7-5 19:42:25

数一数括号,它很粗糙,但你少了2个
 
看一下线
1(defun PDF(/fnm);11
1.11
2(if(setq fnm(getfield“指定保存位置”“”“pdf”1));22
3(程序;33
33(命令“tilemode”“0”);33
4(命令“-plot”“y”“Dwg To PDF.pc3”“ANSI expand D(34.00 x 22.00英寸)”“I”;44
3“L”“N”“E”“1:1”“C”“Y”“CMS\U d_黑色。ctb”“Y”“N”“N”fnm“N”“Y”);33
2);22
22222;
页: 1 [2]
查看完整版本: 带提示帮助的Lisp