你们好,可爱的人。
我理解,在例程末尾添加(princ)应该可以阻止autocad尝试将返回的nil作为命令运行,但是无论我在哪里插入(princ),我似乎都无法实现这一点。谁能帮我摆脱痛苦,告诉我它应该去哪里。
n、 b.我知道程序不太好,使用if-where-cond应该在哪里等,但现在请忽略这一点。
- (defun c:NLPTEST ( / ssloc rowno floorcur wallsh roomsh windowsh windowscillh balcsh flooraod ssfloor sswalls ssrooms sswindosw sswindowscill ssbalcs setlaywall setlayroom setlaywindow setlaywindowcill setlaybalc sswallssolids sswindowssolids ssroomssolids ssrestsolids)
- (Setq ssloc (strcat (getvar 'dwgprefix) "Macro template.xlsx"))
- (setq rowno 5)
- (repeat 10
- (if (= (getCellsFunction ssloc "NLP Heights" (strcat "B" (itoa rowno))) nil)
- (setq rowno (+ rowno 1))
- (
- (setq floorcur (getCellsFunction ssloc "NLP Heights" (strcat "Y" (itoa rowno))))
- (setq wallsh (getCellsFunction ssloc "NLP Heights" (strcat "B" (itoa rowno))))
- (setq roomsh (getCellsFunction ssloc "NLP Heights" (strcat "C" (itoa rowno))))
- (setq windowsh (getCellsFunction ssloc "NLP Heights" (strcat "D" (itoa rowno))))
- (setq windowscillh (getCellsFunction ssloc "NLP Heights" (strcat "E" (itoa rowno))))
- (setq balcsh (getCellsFunction ssloc "NLP Heights" (strcat "I" (itoa rowno))))
- (setq flooraod (getCellsFunction ssloc "NLP Heights" (strcat "F" (itoa rowno))))
- (setq setlaywall (getCellsFunction ssloc "NLP Heights" (strcat "M" (itoa rowno))))
- (setq setlayroom (getCellsFunction ssloc "NLP Heights" (strcat "O" (itoa rowno))))
- (setq setlaywindow (getCellsFunction ssloc "NLP Heights" (strcat "Q" (itoa rowno))))
- (setq setlaywindowcill (getCellsFunction ssloc "NLP Heights" (strcat "S" (itoa rowno))))
- (setq setlaybalc (getCellsFunction ssloc "NLP Heights" (strcat "U" (itoa rowno))))
- (setq ssfloor (ssget "x" (list (cons 8 (vl-princ-to-string floorcur)))))
- (setq sswalls (ssget "x" (list (cons 8 (vl-princ-to-string setlaywall)))))
- (setq ssrooms (ssget "x" (list (cons 8 (vl-princ-to-string setlayroom)))))
- (setq sswindows (ssget "x" (list (cons 8 (vl-princ-to-string setlaywindow)))))
- (setq sswindowscill (ssget "x" (list (cons 8 (vl-princ-to-string setlaywindowcill)))))
- (setq ssbalcs (ssget "x" (list (cons 8 (vl-princ-to-string setlaybalc)))))
- (command "move" ssfloor "0,0,0" (strcat "0,0," (rtos flooraod)))
- (command "-layer" "s" setlaywall "")
- (command "extrude" sswalls "" wallsh)
- (command "-layer" "s" setlayroom "")
- (if (/= ssrooms nil)
- (
- (command "extrude" ssrooms "" roomsh)
- ))
- (command "-layer" "s" setlaywindow "")
- (if (/= sswindows nil)
- (
- (command "extrude" sswindows "" windowsh)
- ))
- (command "-layer" "s" setlaywindowcill "")
- (if (/= sswindowscill nil)
- (
- (command "extrude" sswindowscill "" windowscillh)
- ))
- (command "-layer" "s" setlaybalc "")
- (if (/= ssbalcs nil)
- (
- (command "extrude" ssbalcs "" balcsh)
- ))
- (setq sswallssolids(ssget "x" (list (cons 8 (vl-princ-to-string setlaywall)))))
- (setq ssrestsolids(ssget "x" (list (cons 8 (vl-princ-to-string setlayroom)))))
- (command "-layer" "s" setlaywall "")
- (if (= ssrestsolids nil)
- (setq rowno (+ rowno 1))
- ((command "subtract" sswallssolids ssrestsolids)
- (setq rowno (+ rowno 1)))
- )
- )
- )
- )
- )
我认为,正是这一行接近尾声时,将有问题的nil返回到命令行:
(
(命令“extrude”ssbalcs“”balcsh)
))
谢谢
史蒂夫 |