852456 发表于 2018-10-3 13:39:06

命令嵌套深度不能超过四层

(defun c:1 ()
;;;(xlr-get-ptn对象)获取多段线坐标列表
(defun xlr-get-ptn (enmae / new_ls l2 l1)
;;;(setq enmae (car (entsel )))
(setq l1 (entget enmae))
(setq new_ls nil)
(foreach l2 l1
    (if        (= 10 (car l2))
      (setq new_ls (cons (cdr l2) new_ls))
    )
)
(reverse new_ls)
)
(SETQ P1 (GETPOINT"\n指定第一点"))
(setq p2 (getpoint"\n指定第二点"))
(setq p3 (getpoint"\n指定第三点"))
(command "DJF3" "0.2" p1 p2 "")
(setq en (entlast))
(command "offset" "4" en p3 "")
(setq en1 (entlast))
(setq en_zb (xlr-get-ptnen))
(setq en1_zb (xlr-get-ptnen1))
(setq jd_zb (inters (car en_zb) (cadr en1_zb) (cadr en_zb) (car en1_zb)))
(entmake (list '(0 . "TEXT") (cons 1 "道路") (cons 10 jd_zb) (cons 40 1.5) (cons 41 1) (cons 7 "细等线体") (cons 8 "TK")(cons 710) (cons 72 1) (cons 73 2) (cons 11 jd_zb))))
请问为啥这段代码 总是会出现 命令嵌套深度不能超过四层的问题呢? 哪里有嵌套?





xyp1964 发表于 2018-11-9 20:30:41

(defun c:tt ()
(while (and (setq p1 (getpoint "\n指定第一点: "))
              (setq p2 (getpoint p1 "\n指定第二点: "))
              (setq p3 (getpoint p2 "\n指定第三点: "))
       )
    (command "pline" p1 "w" "0.2" "" p2 "")
    (command "offset" "4" (entlast) p3 "")
    (setq s1 (entlast)
          p3 (vlax-curve-getEndPoint s1)
          p4 (vlax-curve-getStartPoint s1)
          pt (inters p1 p3 p2 p4)
    )
    (entmake (list '(0 . "TEXT")
                   (cons 1 "道路")
                   (cons 10 pt)
                   (cons 40 1.5)
                   (cons 41 1)
                   (cons 7 "HZDX")
                   (cons 8 "TK")
                   (cons 71 0)
                   (cons 72 1)
                   (cons 73 2)
                   (cons 11 pt)
             )
    )
)
(princ)
)

xinxirong 发表于 2018-10-5 11:55:02


(defun c:1 ()
;;;(xlr-get-ptn对象)获取多段线坐标列表
(defun xlr-get-ptn (enmae / new_ls l2 l1)
    (setq l1 (entget enmae))
    (setq new_ls nil)
    (foreach l2 l1
      (if      (= 10 (car l2))
        (setq new_ls (cons (cdr l2) new_ls))
        )
      )
    (reverse new_ls)
    )
(SETQ P1 (GETPOINT"\n指定第一点"))
(setq p2 (getpoint"\n指定第二点"))
(setq p3 (getpoint"\n指定第三点"))
(command "pline" "0.2" p1 p2 "")
(setq en (entlast))
(command "offset" "4" en p3 "")
(setq en1 (entlast))
(setq en_zb (xlr-get-ptnen))
(setq en1_zb (xlr-get-ptnen1))
(setq jd_zb (inters (car en_zb) (cadr en1_zb) (cadr en_zb) (car en1_zb)))
(entmake
    (list
      '(0 . "TEXT")
      (cons 1 "道路")
      (cons 10 jd_zb)
      (cons 40 1.5)
      (cons 41 1)
      (cons 7 "细等线体")
      (cons 8 "TK")
      (cons 710)
      (cons 72 1)
      (cons 73 2)
      (cons 11 jd_zb)
      )
    )
)

852456 发表于 2018-10-3 21:57:54

xiaotao 发表于 2018-10-3 21:08
2009及以上版本的CAD就不会有这种情况了。

因为我用的是cass7.0所以只能用04 到06版本的 有什么办法解决这个问题吗|?

xiaotao 发表于 2018-10-3 21:08:50

2009及以上版本的CAD就不会有这种情况了。

萧●﹏●明 发表于 2018-10-4 14:01:42

换CAD2008与Cass9.1

852456 发表于 2018-10-4 16:00:18

萧●﹏●明 发表于 2018-10-4 14:01
换CAD2008与Cass9.1

谢谢我没有9.1的狗

萧●﹏●明 发表于 2018-10-4 16:24:33

852456 发表于 2018-10-4 16:00
谢谢我没有9.1的狗

现在有破解版

pengfei2010 发表于 2018-10-4 20:04:17

没有这种说法吧,理论上只要不死循环就没问题的

lifuq1979 发表于 2018-10-6 22:20:36

我2006运行没问题

852456 发表于 2018-10-6 22:41:13

lifuq1979 发表于 2018-10-6 22:20
我2006运行没问题

多运行几次就会有问题了好像是超过四次就会出来这个问题
页: [1] 2
查看完整版本: 命令嵌套深度不能超过四层