Ssget在窗口上分割对象
我选择了对象函数ssget。(setq s ssget)
我有一个角窗列表(图纸上的白色正方形)。
'((x y) (x y) (x y) (x y) (x y))
如何在窗口内的对象上划分对象。
我需要每个窗口中的对象列表实体。
'((<Entity name: 7ffff931b40> <Entity name: 7ffff931b40> ...)
(...) (...) (...) (...))
有没有办法在系统变量ssget(ssget“_W”)上使用过滤器窗口
图纸中的示例。
像这样的
(defun c:test ( / SS i ent lst x SelN n Nlst Tlst )
(if
(and
(princ "\nSelect the closed(white) plines: ")
(setq SS (ssget '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1))))
);and
(progn
(repeat (setq i (sslength SS)) ; repeat for each closed polyline
(setq ent (ssname SS (setq i (1- i))))
(setq lst (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= 10 (car x))) (entget ent))))
(if
(and
(setq SelN (ssget "_WP" lst))
(or (not (ssmemb ent SelN)) (ssdel ent SelN))
(< 0 (sslength SelN))
)
(progn
(repeat (setq n (sslength SelN)) ; repeat for each entity inside the polyline
(setq Nlst (cons (ssname SelN (setq n (1- n))) Nlst)) ; create list for the SS
)
(setq Tlst (cons (reverse Nlst) Tlst)) ; store the SS list into the global list
(setq Nlst nil) ; reset the SS list
)
); if
); repeat
(princ "\n") (print Tlst) ; print the global list
);progn
); if/while
(princ)
)
这是经过大量修改的代码,原始代码来自Lee Mac(MatchCenInsPoly)-根据我的旧请求。 另一种可能更复杂的方法是只选取一个窗口,但检查对象的最小/最大Y值,使其仅成为一个窗口组的一部分。另请看边界框方法。你可以改变窗户的大小。 它必须简单快捷。
我使用了一种解决方案,首先选择窗口的坐标,然后选择ssget(窗口)。
(setq lst '(((x y) (x y)) ((x y) (x y))((x y) (x y)) ...))
(mapcar '(lambda (%) (ssget "_W" (car %) (cadr %))) lst)
对不起我的英语。 请小心在lisp中使用奇怪的字符,例如%,你可能想知道为什么有些东西不起作用。 谢谢你的建议。我会注意代码中的奇怪字符。
页:
[1]