;; OE (Order Entities)-Lee Mac
(defun LEEoe ( ent / cntenx new sbx sub )
(setq cnt 1)
;(while
(progn
(setvar 'errno 0)
;(setq ent (car (entsel (strcat "\nSelect object " (itoa cnt) " <done>: "))))
(cond
( (= 7 (getvar 'errno))
(princ "\nMissed, try again.")
)
( (null ent)
nil
)
( (= 4 (logand 4 (cdr (assoc 70 (tblsearch "layer" (cdr (assoc 8 (setq enx (entget ent)))))))))
(princ "\nSelected object is on a locked layer.")
)
( (and
(setq new (entmakex enx))
(or (/= 1 (cdr (assoc 66 enx)))
(progn
(setq sub (entnext ent)
sbx (entgetsub)
)
(while (/= "SEQEND" (cdr (assoc 0 sbx)))
(entmake sbx)
(setq sub (entnext sub)
sbx (entgetsub)
)
)
(entmake sbx)
)
)
)
(entdel ent)
(redraw new 3)
(setq cnt (1+ cnt))
)
( (princ "\nUnable to reorder selected object."))
)
)
; ) ; while
(princ)
)
; pline co-ords example
; By Alan H
(defun getcoords (ent)
(vlax-safearray->list
(vlax-variant-value
(vlax-get-property
(vlax-ename->vla-object ent)
"Coordinates"
)
)
)
)
(defun co-ords2xy ()
; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z
(setq len (length co-ords))
(setq numb (/ len 2)) ; even and odd check required
(setq I 0)
(repeat numb
(setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))
; odd (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords)(nth (+ I 2) co-ords) ))
(setq co-ordsxy (cons xy co-ordsxy))
(setq I (+ I 2))
)
)
; program starts here
(defun c:OE( / ss x)
(command "_pline")
(while (= (getvar "cmdactive") 1 ) (command pause)
)
(setq co-ords (getcoords (entlast)))
(co-ords2xy) ; list of 2d points making pline
(entdel (entlast))
(setq ss (ssget "F" co-ordsxy))
(setq x (sslength ss))
(repeat (sslength ss)
(setq ent (ssname ss (setq x ( - x 1))))
(if (= (vla-get-ObjectName (setq obj (vlax-ename->vla-object ent))) "AcDbCircle")
(progn
(setq pt (vlax-safearray->list (vlax-variant-value (vla-get-center obj))) )
(setq ts (cdr (assoc 40 (tblsearch "STYLE" (getvar "TEXTSTYLE")))))
(if (zerop ts)
(command "TEXT" pt "3.5" "0" (rtos x 2 0))
(command "TEXT" pt "0" (rtos x 2 0))
)
) ; progn
) ; if
(LEEoe ent)
(princ "\n")
)
(command "_.regen")
)
嗨,比格尔,
你安排的Lisp程序不能正常工作。请看图片。
每次你使用Lisp时,数字都会写出来。如果他们写一次,第二次使用Lisp时,他们会再次写:如果你擅长AutoCAD,这不是什么大问题
最大的问题是选择选项:我需要正常的选择,否则很难使用Lisp。
在最后一张图中,您可以看到每次使用Lisp时生成的项目编号,同一实体的值不同。
有时Lisp不能正常工作(无消息)。
希望我的回复会有帮助!
非常感谢。
D
你能贴几张样品图纸吗,外面不是一条连续的线吗? 早上好
见图纸。
再见,
D
OE(订单实体)r0的NMRT。图纸 我不确定你想要什么,画一些随机的物体,然后用一些简单的方法来选择它们,有点像选择激光的路径,代码只在一天结束时把数字放在圆圈上,我们免费做这件事。如果不重置cnt,它将继续编号。您应该能够多次运行它,因为您可能无法只选择一条路径。如果你想要相反的顺序,那可以做到。
页:
1
[2]