Group Question

Discussion in 'AutoCAD' started by BillZ, Sep 27, 2004.

  1. BillZ

    BillZ Guest

    R2005:

    Whe I use the group command dialog box to list all groups, it lists 13 unnamed groups.
    When I use (setq grp (dictsearch (namedobjdict) "ACAD_GROUP"))
    and list the names from this list, I get 28 groups names.
    If I try to entget some of the enames, It says Bad entity name!
    Entdel does not seem to get rid of them either.
    What can I do to remove these phantom groups?

    TIA

    Bill
     
    BillZ, Sep 27, 2004
    #1
  2. BillZ

    Joe Burke Guest

    Hi Bill,

    I'm not sure what you are trying to do. Do you want to delete empty groups (a group
    name which contains no objects) or delete groups which are unnamed, such as "*A1"? Or
    maybe both types?

    Joe Burke
     
    Joe Burke, Sep 28, 2004
    #2
  3. BillZ

    BillZ Guest

    Hi Joe,
    I have a program that finds groups that are "empty" and deletes them with entdel.
    This is what I use to get a list of all groups in the drawing:
    Command:(setq grp (dictsearch (namedobjdict) "ACAD_GROUP"))
    ((-1 . <Entity name: 7ef52c68>) (0 . "DICTIONARY") (5 . "D") (102 .
    "{ACAD_REACTORS") (330 . <Entity name: 7ef52c60>) (102 . "}") (330 . <Entity
    name: 7ef52c60>) (100 . "AcDbDictionary") (280 . 0) (281 . 1) (3 . "*A1") (350
    <Entity name: 7ef57638>) (3 . "*A10") (350 . <Entity name: 7ef61a58>) (3 .
    "*A11") (350 . <Entity name: 7ef61a60>) (3 . "*A12") (350 . <Entity name:
    7ef57680>) (3 . "*A13") (350 . <Entity name: 7ef61a70>) (3 . "*A14") (350 .
    <Entity name: 7ef57648>) (3 . "*A15") (350 . <Entity name: 7ef61a78>) (3 .
    "*A16") (350 . <Entity name: 7ef57650>) (3 . "*A17") (350 . <Entity name:
    7ef57658>) (3 . "*A18") (350 . <Entity name: 7ef57660>) (3 . "*A19") (350 .
    <Entity name: 7ef57668>) (3 . "*A2") (350 . <Entity name: 7ef61a20>) (3 .
    "*A20") (350 . <Entity name: 7ef57670>) (3 . "*A21") (350 . <Entity name:
    7ef57678>) (3 . "*A22") (350 . <Entity name: 7ef57688>) (3 . "*A23") (350 .
    <Entity name: 7ef57690>) (3 . "*A24") (350 . <Entity name: 7ef57698>) (3 .
    "*A25") (350 . <Entity name: 7ef576a0>) (3 . "*A26") (350 . <Entity name:
    7ef576a8>) (3 . "*A27") (350 . <Entity name: 7ef61a10>) (3 . "*A28") (350 .
    <Entity name: 7ef61a18>) (3 . "*A3") (350 . <Entity name: 7ef57640>) (3 .
    "*A4") (350 . <Entity name: 7ef61a28>) (3 . "*A5") (350 . <Entity name:
    7ef61a30>) (3 . "*A6") (350 . <Entity name: 7ef61a38>) (3 . "*A7") (350 .
    <Entity name: 7ef61a40>) (3 . "*A8") (350 . <Entity name: 7ef61a48>) (3 .
    "*A9") (350 . <Entity name: 7ef61a50>))
    Then:
    Command: (foreach n grp (if (= (car n) 350)(setq lst (cons (cdr n) lst))))
    (<Entity name: 7ef61a50> <Entity name: 7ef61a48> <Entity name: 7ef61a40>
    <Entity name: 7ef61a38> <Entity name: 7ef61a30> <Entity name: 7ef61a28> <Entity
    name: 7ef57640> <Entity name: 7ef61a18> <Entity name: 7ef61a10> <Entity name:
    7ef576a8> <Entity name: 7ef576a0> <Entity name: 7ef57698> <Entity name:
    7ef57690> <Entity name: 7ef57688> <Entity name: 7ef57678> <Entity name:
    7ef57670> <Entity name: 7ef61a20> <Entity name: 7ef57668> <Entity name:
    7ef57660> <Entity name: 7ef57658> <Entity name: 7ef57650> <Entity name:
    7ef61a78> <Entity name: 7ef57648> <Entity name: 7ef61a70> <Entity name:
    7ef57680> <Entity name: 7ef61a60> <Entity name: 7ef61a58> <Entity name:
    7ef57638>)

    Command: (length lst)
    28

    Now I use the group command to list all unnamed grous and it displays only 13 unnamed groups???

    Does the group command only display groups that have entities under them?

    At least it's letting me deletewhich ones I want today. Yesterday I kept getting an invalid ename error.

    Bill
     
    BillZ, Sep 28, 2004
    #3
  4. BillZ

    BillZ Guest

    Joe,
    I was mistaken.
    They are still coming up in my list even though I used entdel on them.
    This method worked in R14.
    Am I doing this right?
    How can I get rid of these empty groups?

    Bill
     
    BillZ, Sep 28, 2004
    #4
  5. BillZ

    Joe Burke Guest

    Bill,

    My thick head... I'm still not sure what your goal is.

    Here's a couple totally untested functions, which may shed some light.

    Joe Burke

    (defun c:DeleteUnnamedGroups ( / doc groups nm )
    (setq doc (vla-get-activedocument (vlax-get-acad-object)))
    (setq groups (vla-get-Groups doc))
    (vlax-for x groups
    (setq nm (vlax-get x 'Name))
    (if (vl-string-search "*" nm)
    (vla-delete (vla-item groups nm))
    )
    )
    (princ)
    ) ;end

    (defun c:DeleteEmptyGroups ( / doc groups nm )
    (setq doc (vla-get-activedocument (vlax-get-acad-object)))
    (setq groups (vla-get-Groups doc))
    (vlax-for x groups
    (setq nm (vlax-get x 'Name))
    (if (= 0 (vlax-get x 'Count))
    (vla-delete (vla-item groups nm))
    )
    )
    (princ)
    ) ;end
     
    Joe Burke, Sep 28, 2004
    #5
  6. BillZ

    BillZ Guest

    Thanks Joe,
    The reason you don't know what I'm doing is that I haven't got the problem figued out for myself.

    Let me reitterate.

    There appears to be groups in this drawing that do not show up in the group dialog box. But when I use autolisp code to list the groups, I get many more groups than the dialog box shows.

    I thought these extra groups that I'm getting were just empty groups so I tried to delete them using code that deleted empty goups.

    To my dismay I see that all of these 28 groups show a count value of 7 - 150 entries.

    I am having trouble understanding this. The dialog box only displays 13 of these groups.
    (all of these groups are unnamed "*A*" groups.)

    Bill
     
    BillZ, Sep 28, 2004
    #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.