Message 1 of 5
SelectionSet VBA -> VLisp

Not applicable
12-13-2004
07:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear Friends,
This is not strictly VBA-related question. I have problems generating AcadSelectionSet via VBA and then passing it to VLisp. Recently Jeff Mishler posted a code to this NG solving the same problem, but his solution is not "standardized" enough... My VLISP programming knowledge is _poor_ and I just can't convert VLA-Object (resulting SelectionSet) to Ename. Please see an example below...
A VBA function code snippet (Class named MyClass):
'This function passes a SelectionSet to VLISP
'Result is of type Object to avoid eventual type-conflicts
Public Function SelSetToLisp() As Object
Dim FilterType(0) As Integer
Dim FilterData(0) As Varian
'CreateSelectionSet creates SelSet neverthless if it exists or not
Set SelSetToLisp = CreateSelectionSet("TMP_SELSET")
FilterType(0) = 1001: FilterData(0) = "MYAPP"
'Here it is - ready to go (to VLISP)...
SelSetToLisp.Select acSelectionSetAll, , , FilterType, FilterData
End Function
VLISP usage of MyClass.SelSetToLisp() function:
(defun C:TEST ()
(vl-load-com)
;;Create instance of a Class object
(setq clsMyClass (vlax-create-object "MYDLL.MyClass"))
;;Store resulting SelectionSet to variable named ResultVBA
(setq ResultVBA (vlax-invoke-method clsMyClass 'SelSetToLisp))
;;TRICKY PART - Convert resulting VLA-object to Ename typed one
;;This is the line where program fails...
(setq ResultLSP (vlax-vla-object->ename ResultVBA))
)
All I want to get is Ename SelectionSet, just like SSGET does. Is there any example of how to convert the VLA-based SelectionSet to Ename-based one? I want to avoid (ssget "P") and calling a named SelSet from VLisp as it's name may vary (Jeff's approach).
Thanks,
Maksim Sestic