乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: jonathann3891

[编程交流] 带提示帮助的Lisp

[复制链接]

35

主题

140

帖子

108

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
177
发表于 2022-7-5 19:30:19 | 显示全部楼层
谢谢大家的帮助。
 
我想出来了。我在这一行代码中有太多“):
  1. (setq psize (getkword (strcat "\nSelect Plot [11x17/PDF/22x34]:"))))
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 19:33:36 | 显示全部楼层
免费赠品,带深度if等的检查支架
 
  1. (defun c:chkbrk (/ opf bkt chekdfile rdctl wkfile currentln wln ltr ncln)
  2. (setvar "cmdecho" 0)
  3. (prompt "\nlook at end of line")
  4. ;(setq chekdfile (getstring "enter name of file :"))
  5. (SETQ chekdfile (getfiled "Enter file name:" " " "LSP" 4))
  6. (setq opf (open chekdfile "r"))
  7. (setq bkt 0)
  8. (setq blkl 0)
  9. (setq rdctl 1)
  10. (setq wkfile (open "c:\temp\wow.lsp" "w"))
  11. (setq currentln "a")
  12. (while (/= blkl 6)
  13. (setq currentln (read-line opf))
  14. (if (= currentln nil)(setq currentln ""))
  15. (if (= currentln "")(setq blkl (+ 1 blkl))(setq blkl 1))
  16. (setq wln currentln)                                                        
  17. (while (/= wln "")
  18.        (setq ltr (substr wln 1 1))
  19.        (setq wln (substr wln 2))
  20.        (cond ((= (ascii ltr) 34) (if (= rdctl 0)(setq rdctl 1)(setq rdctl 0)))
  21.                ((and (= ltr "(")(= rdctl 1))(setq bkt (+ bkt 1)))
  22.                ((and (= ltr ")")(= rdctl 1))(setq bkt (- bkt 1)))
  23.                ((and (= ltr ";")(= rdctl 1))(setq wln ""))
  24.                ;(t (prompt ltr))
  25.        )
  26. )
  27. (setq ncln (strcat currentln ";" (itoa bkt)
  28. (if (= rdctl 0) "string open" "")))
  29. (if (/= currentln "")(write-line ncln wkfile))
  30. )
  31. (close wkfile)
  32. (close opf)
  33. (prompt (strcat "open brakets= " (itoa bkt) "."))
  34. )
  35. (setq ang1 nil
  36.      pt1 nil
  37.      pt2 nil
  38.      pt3 nil
  39.      pt4 nil
  40.      pt5 nil)
  41. (command "chkbrk")
  42. (princ)
回复

使用道具 举报

35

主题

140

帖子

108

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
177
发表于 2022-7-5 19:38:31 | 显示全部楼层
我不能让22x34去上班。我出错了;错误:无函数定义:22X34
 
但如果我把除了22x34的部分之外的所有内容都注释掉,它就可以了。
 
我肯定我错过了一些小东西。
 
  1. (defun c:iplot (/ psize)
  2.   (initget 1 "11x17 PDF 22x34") ; [1 = no enter allowed]
  3.   (setq psize (getkword (strcat "\nSelect Plot [11x17/PDF/22x34]:")))
  4.   (cond
  5.      ((= psize "11x17") (11x17))
  6.      ((= psize "PDF") (PDF))
  7.      ((= psize "22x34") (22x34))
  8.      (t (princ "\nPlot cancelled"))
  9.   )
  10. )
  11. (defun 11x17 ()
  12. (command "tilemode" "0")
  13. (command "-plot" "y" "" "DefaultPrinter.pc3" "11x17" "I"
  14. "L" "N" "W" "0,0" "34,22" "fit" "C" "Y" "CMS_b_black.ctb" "Y" "N" "N" "N"  "N" "N" "Y")
  15. )
  16. (defun PDF (/ fnm)
  17. (if (setq fnm (getfiled "Specify Save Location" "" "pdf" 1))
  18. (progn
  19. (command "tilemode" "0")
  20. (command "-plot" "y" "" "Dwg To PDF.pc3" "ANSI expand D (34.00 x 22.00 Inches)" "I"
  21. "L" "N" "E" "1:1" "C" "Y" "CMS_d_black.ctb" "Y" "N" "N" "N" fnm "N" "Y")
  22. )
  23. (defun 22x34 ()
  24. (command "tilemode" "0")
  25. (command "-plot" "y" "" "HP7100-A.pc3" "D (landscape)" "I"
  26. "L" "N" "E" "1:1" "C" "Y" "CMS_d_black.ctb" "Y" "N" "N" "N"  "N" "N" "Y")
  27. )
  28. )
  29. (princ)
  30. )
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 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;
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-12 13:39 , Processed in 0.515420 second(s), 58 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表