Group problem help

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

  1. Here is my original post:

    Da:Alessi Marc'Antonio ()
    Oggetto:Bug in Group entities
    Newsgroups:autodesk.autocad.r14general
    Data:1999/01/12

    Sorry for my bad English.

    I do not had any answer for my question:

    How can I purge many and many unreferenced Groups without explode referenced
    ones and
    Why AutoCAD do not delete they automatically or with the Purge command.
    (That is useful in particular for unnamed Groups)

    Italiano:
    Come posso eliminare i Gruppi che non sono legati a nessun oggetto senza
    usare il comando gruppo e senza esplodere quelli che hanno di legami.
    Perché AutoCAD non gli elimina automaticamente o con il comando Elimina
    (Purge).
    Questo è un grosso problema in particolare con l’uso di Gruppi anonimi e con
    l’inserimento di “blocchi esterni” (dwg) con Insert (Inser) in altri disegni
    con la conseguente moltiplicazione dei Gruppi.

    So I make this function:

    ;; Elimina i gruppi non referenziati
    ;
    (defun ALE_PURGROUPS (prmt_flag / main_ent tmp_list flag count list_names
    grp_ent grp_name)
    (setq
    tmp_list (dictsearch (namedobjdict) "ACAD_GROUP")
    main_ent (cdar tmp_list)
    flag T
    count 0
    list_names '()
    )
    (while (setq grp_ent (dictnext main_ent flag))
    (if flag
    (progn
    (setq flag nil)
    (princ "\nEliminazione Gruppi non referenziati, attendere... ")
    )
    )
    (if (assoc 340 grp_ent)
    nil
    (progn
    (setq list_names (append (list (cdr (assoc 3 tmp_list)))
    list_names))
    (setq count (1+ count))
    )
    )
    (setq tmp_list (cddr (member (assoc 3 tmp_list) tmp_list)))
    );while
    (foreach grp_name list_names (dictremove main_ent grp_name))
    (if (not (zerop count))
    (if (= 1 count)
    (if prmt_flag
    (ai_alert "Eliminato 1 gruppo non referenziato")
    (prompt "\nEliminato 1 gruppo non referenziato. ")
    )
    (if prmt_flag
    (ai_alert (strcat "Eliminati " (itoa count) " gruppi non
    referenziati"))
    (prompt (strcat "\nEliminati " (itoa count) " gruppi non
    referenziati. "))
    )
    )
    )
    (princ)
    );defun ALE_PURGROUPS



    --

    Marc'Antonio Alessi
    http://xoomer.virgilio.it/alessi
    (strcat "NOT a " (substr (ver) 8 4) " guru.")

    --
     
    Marc'Antonio Alessi, Oct 1, 2004
    #21
  2. Sorry Billz, now I realize (I hope):

    Example, I have a DWG with 2 groups:

    Command: (vl-load-com)
    Command: (or *AcadApp* (setq *AcadApp* (vlax-get-acad-object)))
    T
    Command: (or *ActvDwg* (setq *ActvDwg* (vla-get-ActiveDocument *AcadApp*)))
    T
    Command: (setq VlaObj (vla-get-groups *ActvDwg*))
    #<VLA-OBJECT IAcadGroups 02af0224>
    Command: (vlax-get-property vlaobj 'Count)
    2 <<< groups

    [Insert a DWG with 2 groups]

    Command: _INSERT ...
    ....
    Command: (setq VlaObj (vla-get-groups *ActvDwg*))
    #<VLA-OBJECT IAcadGroups 02af0224>
    Command: (vlax-get-property vlaobj 'Count)
    4 <<< groups

    Command: _explode _last...

    Command: (setq VlaObj (vla-get-groups *ActvDwg*))
    #<VLA-OBJECT IAcadGroups 02af0224>
    Command: (vlax-get-property vlaobj 'Count)
    6 <<< groups

    [When you explode the block generated by INSERT you get
    2 new null groups and you can NOT purge thoose groups.
    Save and reopen the drawing and now you CAN purge
    thoose null groups.]

    ....save ...reopen

    Command: (vl-load-com)
    Command: (or *AcadApp* (setq *AcadApp* (vlax-get-acad-object)))
    T
    Command: (or *ActvDwg* (setq *ActvDwg* (vla-get-ActiveDocument *AcadApp*)))
    T
    Command: (setq VlaObj (vla-get-groups *ActvDwg*))
    #<VLA-OBJECT IAcadGroups 02af0224>
    Command: (vlax-get-property vlaobj 'Count)
    6 <<< groups

    Command: (ALE_PurgeGroups)

    Command: (setq VlaObj (vla-get-groups *ActvDwg*))
    #<VLA-OBJECT IAcadGroups 02af0224>
    Command: (vlax-get-property vlaobj 'Count)
    4 <<< groups

    HTH


    --

    Marc'Antonio Alessi
    http://xoomer.virgilio.it/alessi
    (strcat "NOT a " (substr (ver) 8 4) " guru.")

    --
     
    Marc'Antonio Alessi, Oct 1, 2004
    #22
  3. BillZ

    Joe Burke Guest

    Tony,

    Obviously that's a concern. I didn't mention it because I don't know enough about the
    state of Bill's drawings or his intensions.

    Maybe he would prefer to have groups of the same name replaced in the target file. Or
    maybe target file contains no groups. Or the other possibility... well, you know.

    Joe Burke
     
    Joe Burke, Oct 1, 2004
    #23
  4. BillZ

    Joe Burke Guest

    Bill and Marco,

    I've done some more testing in light of Marco's suggestion save/close/reopen the
    drawing has an effect on the names of unnamed groups. Clearly that's the case. But
    I'm totally at a loss trying to understand what ACAD is trying to do with the
    mechanism involved.

    Example: I have a drawing which appears to contain no groups according to the group
    dialog. The "Include Unnamed" option is checked. I run SuperPurge by Owen. It shows
    three unnamed groups which can be purged. To me this says you can't trust what the
    group dialog displays.

    IMO, Autodesk has created a rat's nest of problems by failing to understand the
    difference between blocks and groups. In all other programs I've used, there is no
    option to name a group. That seems to be where the problem lies. Of course, I might
    be wrong.

    I also think Mark made a good point when he said, "a group is not an entity..." A
    group is just a saved selection set as I understand it. In that sense, deleting all
    the objects in a drawing has no effect on the groups contained in that drawing.

    Forgive me if I'm stating what's obvious to ya'll.

    Joe Burke
     
    Joe Burke, Oct 1, 2004
    #24
  5. BillZ

    BillZ Guest

    Mark,
    That's my whole point.
    These unwanted groups shaow that they have entites under them and entget DOES return a valid entity list.

    I will try what Marco has suggested about saving/re-open and purging.

    Thanks.

    Bill
     
    BillZ, Oct 1, 2004
    #25
  6. BillZ

    BillZ Guest

    Marc'Antonio Alessi,

    I tried saving and reopening a drawing that has these unwanted groups and then using the purge null group program to no avail.
    These unwanted groups, have entity information attached to them are not purged with null groups.
    In fact, I can create a new CNC part with the entitiy information associated with these unwanted groups.
    i.e.
    After I insert a drawing with groups into a new drawing with no grooups and do not explode the block.

    Command: (setq grp (dictsearch (namedobjdict) "ACAD_GROUP"))
    ((-1 . <Entity name: 7ef91c68>) (0 . "DICTIONARY") (5 . "D") (102 .
    "{ACAD_REACTORS") (330 . <Entity name: 7ef91c60>) (102 . "}") (330 . <Entity
    name: 7ef91c60>) (100 . "AcDbDictionary") (280 . 0) (281 . 1) (3 . "*A1") (350
    <Entity name: 7ec66000>) (3 . "*A10") (350 . <Entity name: 7ec66048>) (3 .
    "*A11") (350 . <Entity name: 7ec66050>) (3 . "*A12") (350 . <Entity name:
    7ec66058>) (3 . "*A13") (350 . <Entity name: 7ec66060>) (3 . "*A14") (350 .
    <Entity name: 7ec66068>) (3 . "*A15") (350 . <Entity name: 7ec66070>) (3 .
    "*A16") (350 . <Entity name: 7ec66078>) (3 . "*A17") (350 . <Entity name:
    7ec66080>) (3 . "*A18") (350 . <Entity name: 7ec66088>) (3 . "*A19") (350 .
    <Entity name: 7ec66090>) (3 . "*A2") (350 . <Entity name: 7ec66008>) (3 .
    "*A20") (350 . <Entity name: 7ec66098>) (3 . "*A21") (350 . <Entity name:
    7ec660a0>) (3 . "*A22") (350 . <Entity name: 7ec660a8>) (3 . "*A23") (350 .
    <Entity name: 7ec660b0>) (3 . "*A24") (350 . <Entity name: 7ec660b8>) (3 .
    "*A25") (350 . <Entity name: 7ec660c0>) (3 . "*A26") (350 . <Entity name:
    7ec660c8>) (3 . "*A27") (350 . <Entity name: 7ec660d0>) (3 . "*A28") (350 .
    <Entity name: 7ec660d8>) (3 . "*A3") (350 . <Entity name: 7ec66010>) (3 .
    "*A4") (350 . <Entity name: 7ec66018>) (3 . "*A5") (350 . <Entity name:
    7ec66020>) (3 . "*A6") (350 . <Entity name: 7ec66028>) (3 . "*A7") (350 .
    <Entity name: 7ec66030>) (3 . "*A8") (350 . <Entity name: 7ec66038>) (3 .
    "*A9") (350 . <Entity name: 7ec66040>))

    Command: (foreach n grp (if (= (car n) 350)(setq lt (cons (cdr n) lt))))
    (<Entity name: 7ec66040> <Entity name: 7ec66038> <Entity name: 7ec66030>
    <Entity name: 7ec66028> <Entity name: 7ec66020> <Entity name: 7ec66018> <Entity
    name: 7ec66010> <Entity name: 7ec660d8> <Entity name: 7ec660d0> <Entity name:
    7ec660c8> <Entity name: 7ec660c0> <Entity name: 7ec660b8> <Entity name:
    7ec660b0> <Entity name: 7ec660a8> <Entity name: 7ec660a0> <Entity name:
    7ec66098> <Entity name: 7ec66008> <Entity name: 7ec66090> <Entity name:
    7ec66088> <Entity name: 7ec66080> <Entity name: 7ec66078> <Entity name:
    7ec66070> <Entity name: 7ec66068> <Entity name: 7ec66060> <Entity name:
    7ec66058> <Entity name: 7ec66050> <Entity name: 7ec66048> <Entity name:
    7ec66000>)

    Command: (foreach n (entget (nth 0 lt)) (if (= (car n) 340)(setq lt2 (cons (cdr
    n) lt2))))
    (<Entity name: 7ec70708> <Entity name: 7ec70718> <Entity name: 7ec706e0>
    <Entity name: 7ec706f0> <Entity name: 7ec706f8> <Entity name: 7ec706e8> <Entity
    name: 7ec70618> <Entity name: 7ec70610> <Entity name: 7ec70620> <Entity name:
    7ec70340> <Entity name: 7ec706d8> <Entity name: 7ec70328> <Entity name:
    7ec706d0> <Entity name: 7ec70700> <Entity name: 7ec70658> <Entity name:
    7ec706a0> <Entity name: 7ec706a8> <Entity name: 7ec70520> <Entity name:
    7ec70528> <Entity name: 7ec70698> <Entity name: 7ec70648> <Entity name:
    7ec70668> <Entity name: 7ec70670> <Entity name: 7ec70488> <Entity name:
    7ec70448> <Entity name: 7ec70450> <Entity name: 7ec70480> <Entity name:
    7ec70338> <Entity name: 7ec70650> <Entity name: 7ec70660> <Entity name:
    7ec704f0> <Entity name: 7ec70680> <Entity name: 7ec70688> <Entity name:
    7ec70690> <Entity name: 7ec70640> <Entity name: 7ec70678> <Entity name:
    7ec706b0> <Entity name: 7ec70368> <Entity name: 7ec70370> <Entity name:
    7ec705d0> <Entity name: 7ec70628> <Entity name: 7ec70630> <Entity name:
    7ec70638> <Entity name: 7ec706b8> <Entity name: 7ec706c0> <Entity name:
    7ec706c8> <Entity name: 7ec70600> <Entity name: 7ec705f0> <Entity name:
    7ec705f8> <Entity name: 7ec705e0> <Entity name: 7ec705a8> <Entity name:
    7ec705b0> <Entity name: 7ec70530> <Entity name: 7ec705e8> <Entity name:
    7ec70720> <Entity name: 7ec70598> <Entity name: 7ec70568> <Entity name:
    7ec70570> <Entity name: 7ec70580> <Entity name: 7ec70588> <Entity name:
    7ec70578> <Entity name: 7ec70540> <Entity name: 7ec70590> <Entity name:
    7ec70320> <Entity name: 7ec70560> <Entity name: 7ec705a0> <Entity name:
    7ec70508> <Entity name: 7ec70510> <Entity name: 7ec704c8> <Entity name:
    7ec704f8> <Entity name: 7ec70500> <Entity name: 7ec70470> <Entity name:
    7ec70438> <Entity name: 7ec70440> <Entity name: 7ec70468> <Entity name:
    7ec70458> <Entity name: 7ec703b0> <Entity name: 7ec703b8> <Entity name:
    7ec70428> <Entity name: 7ec70390> <Entity name: 7ec70460> <Entity name:
    7ec704a8> <Entity name: 7ec704d8> <Entity name: 7ec704e0> <Entity name:
    7ec704e8> <Entity name: 7ec704b0> <Entity name: 7ec704b8> <Entity name:
    7ec70418> <Entity name: 7ec70408> <Entity name: 7ec70410> <Entity name:
    7ec703a8> <Entity name: 7ec703a0> <Entity name: 7ec70400> <Entity name:
    7ec70490> <Entity name: 7ec70498> <Entity name: 7ec704a0> <Entity name:
    7ec70398> <Entity name: 7ec70420> <Entity name: 7ec704c0> <Entity name:
    7ec70348> <Entity name: 7ec70350> <Entity name: 7ec70358> <Entity name:
    7ec70360> <Entity name: 7ec70378> <Entity name: 7ec70380> <Entity name:
    7ec70388> <Entity name: 7ec70538> <Entity name: 7ec70548> <Entity name:
    7ec70550> <Entity name: 7ec70558> <Entity name: 7ec705b8> <Entity name:
    7ec705c0> <Entity name: 7ec705c8> <Entity name: 7ec70330> <Entity name:
    7ec70430> <Entity name: 7ec70478> <Entity name: 7ec704d0> <Entity name:
    7ec70518> <Entity name: 7ec705d8> <Entity name: 7ec70608> <Entity name:
    7ec70710>)

    Command: (foreach n lt2 (entmake (entget n)))
    ((-1 . <Entity name: 7ec70710>) (0 . "LINE") (5 . "54A") (102 .
    "{ACAD_REACTORS") (330 . <Entity name: 7ec66040>) (102 . "}") (330 . <Entity
    name: 7ec695f8>) (100 . "AcDbEntity") (67 . 0) (8 . "OUTSIDE") (100 .
    "AcDbLine") (10 147.589 3.87312 0.0) (11 147.413 26.6312 0.0) (210 0.0 0.0 1.0))

    Now I have a perfect duplicate part of the entities in one of the valid groups except that the replica is slightly offset in the WCS. Maybe this entity info from the unwanted group is in OCS?

    Bill



    Bill
     
    BillZ, Oct 1, 2004
    #26
  7. Bill and Joe,
    ....

    In a new empty dwg I insert a dwg with 2 groups:
    If I do not explode the block (the new dwg) I have 2 groups but they are
    not listed in the Group command dialogue end thay are not purgeable.
    They are listed only with dictsearch (or equivalent):

    Comando: (setq grp (dictsearch (namedobjdict) "ACAD_GROUP"))
    ((-1 . <Nome entità: 7ef6fc68>) (0 . "DICTIONARY") (5 . "D") (102 .
    "{ACAD_REACTORS") (330 . <Nome entità: 7ef6fc60>) (102 . "}") (330 . <Nome
    entità: 7ef6fc60>) (100 . "AcDbDictionary") (280 . 0) (281 . 1) (3 . "*A1")
    (350 . <Nome entità: 7ef6fd68>) (3 . "*A2") (350 . <Nome entità: 7ef6fd70>))

    If I explode the block:
    Comando: _explode trovato(i) 1

    Now I have 4 groups listed with dictsearch (or equivalent):

    Comando: (setq grp (dictsearch (namedobjdict) "ACAD_GROUP"))
    ((-1 . <Nome entità: 7ef6fc68>) (0 . "DICTIONARY") (5 . "D") (102 .
    "{ACAD_REACTORS") (330 . <Nome entità: 7ef6fc60>) (102 . "}") (330 . <Nome
    entità: 7ef6fc60>) (100 . "AcDbDictionary") (280 . 0) (281 . 1) (3 . "*A1")
    (350 . <Nome entità: 7ef6fd68>) (3 . "*A2") (350 . <Nome entità: 7ef6fd70>)
    (3
    .. "*A3") (350 . <Nome entità: 7ef6fe00>) (3 . "*A4") (350 . <Nome entità:
    7ef6fe08>))

    but only 2 groups listed in the Group command dialogue and 0
    groups purgeable.

    If I save and reopen I have again 4 groups listed with dictsearch
    2 groups listed in the Group command dialogue BUT 2 groups ARE
    purgeable.

    save ... reopen

    Comando: (setq grp (dictsearch (namedobjdict) "ACAD_GROUP"))
    ((-1 . <Nome entità: 7ef6fc68>) (0 . "DICTIONARY") (5 . "D") (102 .
    "{ACAD_REACTORS") (330 . <Nome entità: 7ef6fc60>) (102 . "}") (330 . <Nome
    entità: 7ef6fc60>) (100 . "AcDbDictionary") (280 . 0) (281 . 1) (3 . "*A1")
    (350 . <Nome entità: 7ef6fd68>) (3 . "*A2") (350 . <Nome entità: 7ef6fd70>)
    (3
    .. "*A3") (350 . <Nome entità: 7ef6fdc0>) (3 . "*A4") (350 . <Nome entità:
    7ef6fdc8>))

    Comando: (ALE_PURGEGROUPS)
    0

    Comando: (setq grp (dictsearch (namedobjdict) "ACAD_GROUP"))
    ((-1 . <Nome entità: 7ef6fc68>) (0 . "DICTIONARY") (5 . "D") (102 .
    "{ACAD_REACTORS") (330 . <Nome entità: 7ef6fc60>) (102 . "}") (330 . <Nome
    entità: 7ef6fc60>) (100 . "AcDbDictionary") (280 . 0) (281 . 1) (3 . "*A3")
    (350 . <Nome entità: 7ef6fdc0>) (3 . "*A4") (350 . <Nome entità: 7ef6fdc8>))

    Theese are all my tests.

    I think that a similar behaviour appen with dimensions inside
    an inserted and exploded block, we have many anonimous blocks
    that duplicate the blocks of all dimensions.


    HTH

    Marco

    --

    Marc'Antonio Alessi
    http://xoomer.virgilio.it/alessi
    (strcat "NOT a " (substr (ver) 8 4) " guru.")

    --
     
    Marc'Antonio Alessi, Oct 1, 2004
    #27
  8. BillZ

    BillZ Guest

    Marc'Antonio Alessi,

    Mine (R2005) works the same except that all the groups are still non purgeable.

    I ran your ALE_PURGROUPS.lsp with and without the flag argument and had the same results.


    Bill
     
    BillZ, Oct 4, 2004
    #28
  9. Bill,
    purgeable

    To purge the zombies groups you must:

    1) PURGE the block generated by insert command
    2) save dwg
    3) close dwg
    4) open dwg

    If the Block exist it contain the zombies groups.

    I hope to be clear.


    HTH

    Cheers.

    Marco
     
    Marc'Antonio Alessi, Oct 5, 2004
    #29
  10. BillZ

    BillZ Guest

    1) PURGE the block generated by insert command<<<

    Ah, so these are associated with the block definition.
    That would make sense.

    Thanks.

    So then, the only thing wrong with this picture is that the zombies show up using the dictsearch or vla functions....

    At least I understand it now.

    Thnaks again.

    Bill
     
    BillZ, Oct 6, 2004
    #30
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.