我这也有一版
下面是lisp函数,放在窗体上的文本框里,VL类初始化时加载
- (defun VBASelectionSet2ALSelectionSet(VBA_SSName / obj ss sss AL_SS) ;命名选择集转换成aut
- (setq sss (vlax-get-property (vlax-get-property (vlax-get-acad-object) 'ActiveDocument) 'SelectionSets))
- (setq ss (vlax-invoke-method sss 'Item VBA_SSName))
- (setq AL_SS(ssadd))
- (vlax-for obj ss
- (ssadd (vlax-vla-object->ename obj) AL_SS)
- )
- )
加载代码如下
- '加载选择集转换函数
- strFileName = Environ("TEMP") & "\SelectionSet.lsp"
- Open strFileName For Output As #5
- Print #5, Form1.txtSelectionSet.Text
- Close #5
- VLFS.Item("Load").funcall strFileName
- Kill strFileName
复制代码
VBA实现函数如下
- '命名选择集显示夹点并选中
- Public Sub ShowPickPoints(ByVal selectionSet As Object, ByVal blnOpen As Boolean)
- If blnOpen = True Then
- vlax.SetLispSymbol "ShowPickPoints_sset", selectionSet.Name
-
- vlax.EvalLispExpression "(sssetfirst nil (VBASelectionSet2ALSelectionSet ShowPickPoints_sset))"
- vlax.NullifySymbol "ShowPickPoints_sset"
- Else
- vlax.EvalLispExpression "(sssetfirst nil)"
- End If
- End Sub
|