(defun c:sfs(/ 3DFace vlax-list->3D-point ent ptLst)
(defun 3DFace (p1 p2 p3 p4)
(entmakex (list (cons 0 "3DFACE")
(cons 8 "Temp")
(cons 10 p1)
(cons 11 p2)
(cons 12 p3)
(cons 13 p4)
(cons 70 15))))
(defun vlax-list->3D-point (lst)
(if lst
(cons (list (car lst) (cadr lst) (caddr lst))
(vlax-list->3D-point (cdddr lst)))))
(if (and *pt1 *pt2 *art
(not (initget "Yes No"))
(eq "No" (cond ((getkword "\nWould you like to reset this macro? <No>)")) ("No"))))
(command "_.3DPoly" *pt1 *pt2 pause pause "_C")
(progn
(initget 1 "Rectangular Circular")
(setq *art (getkword "\nWhat type of Array? : "))
(command "_.3DPoly" pause pause pause pause "_C")))
(if (eq "POLYLINE" (cdr (assoc 0 (entget (setq ent (entlast))))))
(progn
(apply '3DFace (setq ptLst (vlax-list->3D-point
(vlax-get
(vlax-ename->vla-object ent) 'Coordinates))))
(entdel ent)
(cond ((eq *art "Rectangular")
(setq *pt1 (nth 3 ptLst) *pt2 (nth 2 ptLst)))
((eq *art "Circular")
(setq *pt1 (nth 0 ptLst) *pt2 (nth 3 ptLst))))))
(princ))
没想到会这么容易。。。工作得很好。。。如果你不介意的话,你会如何循环它,这样一旦你选择了一个矩形或圆形阵列,你就可以继续制作多段线/面? “没想到会这么容易。”。。。我使用Visual LISP实现了这一点,并使用递归函数将点列表转换为三维点列表-我不会说这是一个“简单”的转换。
使用While函数循环程序。 嘿,李。。。
我只是稍微改变了一下,现在我有问题了。。。我为*art添加了一个默认值,这样当提示输入数组类型时,用户可以点击enter键,使用默认值(如果这是第一次运行),或者使用最后一个使用的条目:
(defun c:sfs(/ 3DFace vlax-list->3D-point ent ptLst)
(setq *art (if (not *art) "Rectangular" *art)
old_art *art)
(defun 3DFace (p1 p2 p3 p4)
(entmakex (list (cons 0 "3DFACE")
(cons 8 "Temp")
(cons 10 p1)
(cons 11 p2)
(cons 12 p3)
(cons 13 p4)
(cons 70 15))))
(defun vlax-list->3D-point (lst)
(if lst
(cons (list (car lst) (cadr lst) (caddr lst))
(vlax-list->3D-point (cdddr lst)))))
(if (and *pt1 *pt2 *art
(not (initget "Yes No"))
(eq "No" (cond ((getkword "\nWould you like to reset this macro? <No>)")) ("No"))))
(command "_.3DPoly" *pt1 *pt2 pause pause "_C")
(progn
(initget "Rectangular Circular")
(setq art_r (if (= *art "Rectangular") "<Rectangular>" "Rectangular")
art_c (if (= *art "Circular") "<Circular>" "Circular")
art_pmt (strcat "\nWhat type of Array? [" art_r "/" art_c "]: ")
*art (getkword art_pmt)
*art (if (= *art "")
old_art
*art))
(command "_.3DPoly" pause pause pause pause "_C")))
(if (eq "POLYLINE" (cdr (assoc 0 (entget (setq ent (entlast))))))
(progn
(apply '3DFace (setq ptLst (vlax-list->3D-point
(vlax-get
(vlax-ename->vla-object ent) 'Coordinates))))
(entdel ent)
(cond ((eq *art "Rectangular")
(setq *pt1 (nth 3 ptLst) *pt2 (nth 2 ptLst)))
((eq *art "Circular")
(setq *pt1 (nth 0 ptLst) *pt2 (nth 3 ptLst))))))
(princ))
但现在在我运行一次后,它不会问我是否要重置宏或使用以前使用的点。
有什么想法吗? 好的,所以只有当我尝试做一个矩形阵列时它才会这样做????到底发生了什么? 成功了,但不知道为什么。。。。我去掉了在第一行声明局部变量,现在它可以工作了,但我不知道这会有什么影响。
页:
1
[2]