jesset 发表于 2022-7-5 16:40:57

过滤ssget中的对象

嘿,伙计们!
 
因此,我试图构建一个lisp,它将提示用户选择一些对象,过滤出哪些是多段线,并调整多段线的宽度。
 
我可以让它遍历选择,但我很难让它过滤出多段线。
 
感谢您的任何帮助!
 
(我有;;;我试图自己解决)
 
(defun c:test (/)

(setq a (ssget))

(setq counter 0)

;;;(setq b (ssname a counter))

(while (< counter (sslength a))

   ;;;add of object is not a polyline, skip

;;;(setq blist (entget b))

;;;(setq bname (cdr(assoc 0 (ssname b counter))))

;;;(if (= (cdr(assoc 0 (b))) "POLYLINE")

   ;;;(progn

(command "pedit" (ssname a counter) "width" 1 "")

(setq counter (+ counter 1))

   ;;;;end progn
   
   ;;;(setq counter (+ counter 1))
   ;;;;end if

);;end while

);;end defun

jesset 发表于 2022-7-5 17:06:46

我还没有错误检查我的代码或在开始时完成变量列表,我一直在保存它,直到我找到了这段代码。

Lee Mac 发表于 2022-7-5 17:19:26

我建议在ssget提示符处进行过滤,以便用户知道程序将处理哪些对象。
 
以下是一些帮助您的资源:
 
http://lee-mac.com/ssget.html
http://www.afralisp.net/autolisp/tutorials/selection-sets.php
http://www.afralisp.net/autolisp/tutorials/selection-set-filters.php

1958 发表于 2022-7-5 17:39:39

尝试此版本的程序
测验LSP

BIGAL 发表于 2022-7-5 17:49:00

直接更改pline宽度而不使用pedit的示例。
 

(setq obj (vlax-ename->vla-object (car (entsel "\nPick Pline"))))
(val-put-constantwidth obj val) ; val is the width of the pline
页: [1]
查看完整版本: 过滤ssget中的对象