Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Pass vba selection set to lisp or command line?

  1. #1
    100 Club KevinBarnett's Avatar
    Join Date
    2001-10
    Location
    Pretoria, South Africa
    Posts
    119
    Login to Give a bone
    0

    Question Pass vba selection set to lisp or command line?

    Hi Gang,

    Does anybody know how to pass a named VBA selection set to lisp or the command line?

    For example. There appears to be no VBA method equal to the BOUNDARY command. You would need this to specify a selection to represent a specific boundary set whilst executing the boundary command.

    At the moment I am using this:

    SelStBnd.Clear
    SelStBnd.Select acSelectionSetAll, , , FilterType, FilterData
    ThisDrawing.SendCommand _
    "(setq ss (ssget " & Chr(34) & "x" & Chr(34) & " (list (cons 8 " & _
    Chr(34) & FilterData(0) & Chr(34) & " ))))" & vbCr

    where SelStBnd is named selection set and FilterData(0) is layer names

    After using this ss is available for re-use at the command prompt as a selection set. But surely there is a "vla" subr to transfer the VBA selection set to a lisp/command prompt selection set, which would be quicker than selecting twice.

    Thanks,

    Kevin.
    Acad 2007, Autodesk Map 3D 2007, 3D, VBA, Lisp, C#.Net, Windows XP Pro (been using AutoCAD since 1989)

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    5,640
    Login to Give a bone
    0

    Default Re: Pass vba selection set to lisp or command line?

    I wrote a function to do that but, I'm not at work, so I can't give you the code directly. Here is a link to an adesk ng thread where I've posted it before.
    C:> ED WORKING....

  3. #3
    100 Club KevinBarnett's Avatar
    Join Date
    2001-10
    Location
    Pretoria, South Africa
    Posts
    119
    Login to Give a bone
    0

    Red face Re: Pass vba selection set to lisp or command line?

    Thanks Ed, but ... I'm still not clear.

    The link jumped to http://discussion.autodesk.com/threa...sageID=2140242 which resolves sendcommand reference to a single entity by using its handle.

    I'm looking at referring to a selection set (previously named and populated in VBA) with sendcommand. Or did I miss something? Thanks for your patience.

    Cheers,

    Kevin.
    Acad 2007, Autodesk Map 3D 2007, 3D, VBA, Lisp, C#.Net, Windows XP Pro (been using AutoCAD since 1989)

  4. #4
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    5,640
    Login to Give a bone
    0

    Default Re: Pass vba selection set to lisp or command line?

    You pass the entity to the function. A selection set is an object. Both have handles and will work with the (handent) function. You just need to modify the signature of the function to accept objects instead of entities. I would create a new function from this one.
    C:> ED WORKING....

  5. #5
    100 Club KevinBarnett's Avatar
    Join Date
    2001-10
    Location
    Pretoria, South Africa
    Posts
    119
    Login to Give a bone
    0

    Cool Re: Pass vba selection set to lisp or command line?

    How do you get the handle of the selection set in VBA?

    I tried this:

    Sub try()
    Dim ss As AcadSelectionSet
    Dim ao As AcadObject
    Set ss = ThisDrawing.SelectionSets.Add("Temp1")
    ss.Clear
    ss.SelectOnScreen

    MsgBox ss.Handle '''' This causes error 438, object doesnt support this property or method

    Set ao = ss ''' This causes error: Type mismatch
    MsgBox ao.Handle
    End Sub

    Isnt there a "vla" that can get the activex named selection set and place it in a command/lisp type selection set - maybe something like (vla-get *selectionsets* "name")?

    I'm really hoping you wont get frustrated with my simple questions. Thanks for your help.

    Kevin.
    Acad 2007, Autodesk Map 3D 2007, 3D, VBA, Lisp, C#.Net, Windows XP Pro (been using AutoCAD since 1989)

  6. #6
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    5,640
    Login to Give a bone
    0

    Default Re: Pass vba selection set to lisp or command line?

    No, that's ok. I'm just out of town now and can't really help too much. If no one else can help, I hope you can wait till Monday when I get back.
    C:> ED WORKING....

  7. #7
    I could stop if I wanted to
    Join Date
    2002-02
    Location
    Kansas
    Posts
    487
    Login to Give a bone
    0

    Default Re: Pass vba selection set to lisp or command line?

    If you run the ss.SelectOnScreen just be for the do the command

    you can us (setq ss (ssget "P")) as your comand

  8. #8
    100 Club KevinBarnett's Avatar
    Join Date
    2001-10
    Location
    Pretoria, South Africa
    Posts
    119
    Login to Give a bone
    0

    Red face Re: Pass vba selection set to lisp or command line?

    Not a on-screen selection. Check the very first post. Used:

    SelStBnd.Clear
    SelStBnd.Select acSelectionSetAll, , , FilterType, FilterData

    in VBA to build the selection. In the program I am writing, the selection set is going to be referred to many times with SendCommand as a specific boundary selection set in the Boundary command (as boundary is not available in VBA). So far I have used (ssget "x" ... ) to re-select the selection set at the command prompt and store it in a lisp selection set. Then I simply use !ss (ss being the name of the variable containing the selection set) to re-use it.

    The only part of the process I want to improve is the re-selecting - original named selection set in VBA then make the same selection set in lisp (in SendCommand). Hence the original posting of the question. Ed has indicated that it's possible to use the handle of the VBA selection set - that's the missing bit.

    Cheers,

    Kevin.
    Acad 2007, Autodesk Map 3D 2007, 3D, VBA, Lisp, C#.Net, Windows XP Pro (been using AutoCAD since 1989)

  9. #9
    I could stop if I wanted to
    Join Date
    2002-02
    Location
    Kansas
    Posts
    487
    Login to Give a bone
    0

    Default Re: Pass vba selection set to lisp or command line?

    add this vlisp code to your system
    It will get a VBA Selectionset by name and
    return a Vlisp Selectionset

    Code:
     
    ;(Vbass "SelectionsetNmae")
    ;This function will return the VBA Selectionset
    ; name = Selectionsetname
    ;By John W Anstaett 11/01/04
    (defun Vbass(SSname / acadObject acadDocument myss myas myc vlss)
    (setq acadObject (vlax-get-acad-object))
    (setq acadDocument (vla-get-ActiveDocument acadObject))
    (setq myss (VLA-GET-SELECTIONSETS acadDocument))
    		(setq myas (VLA-ITEM myss SSname))
    		(setq myc (vla-get-count myas))
    		(setq vlss (ssadd))
    		(setq myi 0)
    (repeat myc
    (progn
    	 (setq myvb (vla-item myas myi))
    	 (setq vlss (ssadd (vlax-vla-object->ename myvb) vlss))
    	 (setq myi (+ myi 1))
    	 )
    )
    (setq vlss vlss)
    )
    Last edited by jwanstaett; 2004-11-01 at 03:27 PM.

  10. #10
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    5,640
    Login to Give a bone
    0

    Default Re: Pass vba selection set to lisp or command line?

    Kevin,
    It looks like vba doesn't expose the handle or the ObjectID of the ss obj. You will have to go with a workaround like John's.
    C:> ED WORKING....

Page 1 of 2 12 LastLast

Similar Threads

  1. Multiple Selection Sets To One Line Lisp
    By mbrandt5 in forum AutoLISP
    Replies: 5
    Last Post: 2015-07-16, 02:22 PM
  2. Replies: 3
    Last Post: 2009-10-22, 10:19 PM
  3. How do I pass a selection on to LISP?
    By dfuehrer in forum AutoLISP
    Replies: 3
    Last Post: 2007-09-18, 04:53 PM
  4. Pass a selection set to a program
    By ccowgill in forum AutoLISP
    Replies: 4
    Last Post: 2007-05-18, 01:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •