别担心;我们都从某个地方开始。
我鼓励你尽可能地阅读任何东西。您将从开发人员文档、CAD论坛等常见资源以及其他通过网站上的教程分享智慧的人那里学到很多。我发现有一本书很容易阅读和理解,那就是David M.Stein的《Visual LISP Developer's Bible》,2011版,目前售价6.99美元(图片链接):
至于一些解释,希望这能有所帮助:
- (defun c:FOO (/ ss)
- [color=seagreen]
- ;; Both test expressions within the AND function must
- ;; return a non-nil value.
- ;;
- ;; If the user makes a valid, single selection of a block,
- ;; and the block "Asbuilt.dwg" can be found for insert...[/color]
- (if (and (setq ss (ssget ":S:E" '((0 . "INSERT"))))
- (findfile "ASBUILT.dwg"))
- [color=seagreen] ;; ... Then, insert the "Asbuilt" block at the insertion
- ;; point of the earlier selected block[/color]
- (command "._-insert"
- "ASBUILT"
- (cdr (assoc 10 (entget (ssname ss 0))))
- 1.0
- 1.0
- 0.0)
- [color=seagreen];; ... Else, CONDitionally report to the user what
- ;; went wrong above, based on the first test expression
- ;; that returns a non-nil value.
- ;;
- ;; First condition:
- ;; If a valid, single selection was made, then
- ;; the "Asbuilt" block could not be found.
- ;;
- ;; Second condition:
- ;; A valid, single selection was NOT made.[/color]
- (cond (ss (prompt "\n** "ASBUILT.dwg" cannot be found ** "))
- ((prompt "\n** Nothing selected ** "))))
- (princ))
|