Vla-Move a Group?

Discussion in 'AutoCAD' started by BillZ, Jan 26, 2005.

  1. BillZ

    BillZ Guest

    R2005:

    After searching the NG, I still cannot understand how to move a GROUP Object with VL functions.

    Command: (setq grpl (dictsearch (namedobjdict) "ACAD_GROUP"))
    ((-1 . <Entity name: 7ef6dc68>) (0 . "DICTIONARY") (5 . "D") (102 .
    "{ACAD_REACTORS") (330 . <Entity name: 7ef6dc60>) (102 . "}") (330 . <Entity
    name: 7ef6dc60>) (100 . "AcDbDictionary") (280 . 0) (281 . 1) (3 . "TEST") (350
    <Entity name: 7ef6b360>) (3 . "TESTCCC") (350 . <Entity name: 7ef6b3b0>))

    Command: (setq ngnm (dictsearch (cdr (assoc -1 grpl)) "TESTCCC"))
    ((-1 . <Entity name: 7ef6b3b0>) (0 . "GROUP") (5 . "21E") (102 .
    "{ACAD_REACTORS") (330 . <Entity name: 7ef6dc68>) (102 . "}") (330 . <Entity
    name: 7ef6dc68>) (100 . "AcDbGroup") (300 . "Part") (70 . 0) (71 . 1) (340 .
    <Entity name: 7ef6b3a0>) (340 . <Entity name: 7ef6b3a8>))

    Command: (setq GrpObj (vlax-ename->vla-object (cdr (assoc -1 ngnm))))
    #<VLA-OBJECT IAcadGroup 010a0be4>

    Command: (vla-move GrpObj (vlax-3d-point (getpoint))(vlax-3d-point (getpoint)))
    ; error: ActiveX Server returned the error: unknown name: Move

    TIA

    Bill
     
    BillZ, Jan 26, 2005
    #1
  2. BillZ

    Joe Burke Guest

    Hi Bill,

    Assuming you have a valid group name and from/to points.

    (defun MoveGroup (groupname p1 p2 / group *groups*)
    (setq *groups*
    (vla-get-Groups
    (vla-get-ActiveDocument
    (vlax-get-acad-object))))
    (setq group (vla-item *groups* groupname))
    (vlax-for x group
    (vlax-invoke x 'Move p1 p2)
    )
    (princ)
    ) ;end

    Joe Burke
     
    Joe Burke, Jan 26, 2005
    #2
  3. It appears that the MOVE method is not
    supported by group objects.

    From a dump on a group

    ; Methods supported:
    ; AppendItems (1)
    ; Delete ()
    ; GetExtensionDictionary ()
    ; GetXData (3)
    ; Highlight (1)
    ; Item (1)
    ; RemoveItems (1)
    ; SetXData (2)
    ; Update ()
    T

    Where did you read that this was possible?

    --
    Autodesk Discussion Group Facilitator



    Object with VL functions.
     
    Jason Piercey, Jan 26, 2005
    #3
  4. BillZ

    BillZ Guest

    Well I guess I didn't read it anywhere.

    But in the help files:

    Move Method

    Moves an object along a vector.

    See Also | Example

    Signature

    object.Move Point1, Point2

    Object

    All Drawing Objects,


    If I use the move command, I can use entlast after the group is created and that works to move it,
    but if I change the ename to a vla-object it doesn't.

    8^s

    Bill
     
    BillZ, Jan 26, 2005
    #4
  5. BillZ

    Jeff Mishler Guest

    Bill, a Group is merely a selection set that persists across drawing
    sessions. Also, the help is correct in saying "Moves an object along a
    vector." but a group is NOT an object, rather it is a collection of objects.
    That's why Joe's code will do what you want and the Move command also works
    since you are passing it a selection set (the group).

    HTH,
     
    Jeff Mishler, Jan 26, 2005
    #5
  6. BillZ

    BillZ Guest

    Thanks Joe,
    I understand it a little more now.

    I wondered if I wouldn't have to move each entity separately.

    Bill
     
    BillZ, Jan 26, 2005
    #6
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.