马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
Question
Is there a way to retrieve a selection set created in VB/A in VLISP?
有什么方法能在VLISP中检索由VB/A创建的选择集?
Answer
Here is a Visual LISP example that will access a selection set named "TEST1".
Note: For simplicity, there is no error checking. To use this example, it is
necessary that a selection set named "TEST1" exists (created with VB or some
other API). The number of items in the selection set is printed on the command
line, and then the entities in the selection set are erased.
VLISP存取名字为TEST1的选择集的例子
注意:为简单起见,例子没有错误检查。使用这个例子,确保名字为TEST1的选择集存在(由VB/A或其他API创建),先在命令行打印选择集的实体数量,然后删除选择集中的实体。
 - (defun c:erset (/ acApp acDoc selSets ss1)
- (vl-load-com)
- (setq acApp (vlax-get-acad-object))
- (setq acDoc (vla-get-activeDocument acApp))
- (setq selSets (vla-get-SelectionSets acDoc))
- (setq ss1 (vla-item selSets "TEST1"))
- (princ "Number of items in selection set TEST1 = ")
- (princ (vla-get-count ss1))
- (if (> (vla-get-count ss1) 0)
- (progn
- (alert "Erasing objects in selection set TEST1")
- (vla-erase ss1)
- ) ;progn
- ) ;if
- (princ)
- ) ;defun
|