Group objects via lisp

Discussion in 'AutoCAD' started by Casey, Jun 22, 2004.

  1. Casey

    Casey Guest

    I have two entities stored in variables 'g1' and 'g2'.

    What is the best way to create an un-named group with these objects?

    so far:

    (command "-group" "create" "*" "" g1 g2 "")

    Is there a better way?

    Thanks,

    Casey
     
    Casey, Jun 22, 2004
    #1
  2. Casey

    Casey Guest

    Unfortunately, I am definately a rookie when it comes to VBA. I have some
    knowledge of lisp so "Use thier handles." just isn't quite enough for me to
    go on.

    Any further direction would be greatly appreciated.

    Thanks,
    Casey
     
    Casey, Jun 22, 2004
    #2
  3. Creating a selection set from the entities you
    want to group would be a "better" method, IMO.

    Not sure I see what handles have to do with this.
     
    Jason Piercey, Jun 22, 2004
    #3
  4. Casey

    Casey Guest

    Currently g1 is an entity name of an object selected by the user.
    g2 is an entity name of an object created using entmake.

    What benefit would creating a single selection set with two objects have
    instead of simply passing the two objects on to the 'group' command. Seems
    like one extra step to me.

    Is there a better way that perhaps doesn use the (command "-group"....
    method?

    Thanks,

    Casey
     
    Casey, Jun 22, 2004
    #4
  5. Casey

    Joe Burke Guest

    Casey,

    Here's one way.

    ;; argument: a list of vla-objects
    (defun MakeUnnamedGroup ( lst / groups newgrp )
    (setq groups (vla-get-groups
    (vla-get-activedocument
    (vlax-get-acad-object))))
    (setq newgrp (vlax-invoke groups 'Add "*"))
    (vlax-invoke newgrp 'AppendItems lst)
    )

    Joe Burke
     
    Joe Burke, Jun 22, 2004
    #5
  6. I wasn't sure how the objects where being
    assigned to g1 and g2. Now that I know,
    I don't see any advantage in creating a
    selection set.
     
    Jason Piercey, Jun 22, 2004
    #6
  7. Casey

    Casey Guest

    Okay,

    Thanks for all your input..

    Casey


     
    Casey, Jun 22, 2004
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.