Add Entity to Existing group -> Menu macro

We want to speed up this Process by a menu Macro or LISP Macro.

  1. Open Group Menu
  2. "F"ind Groups by entity
  3. Select Group in Modelspace
  4. "O"k in the next menu, Select (Sub)groups
  5. "A"dd enities to group in Modelspace

Only 3 and 5 should be done by the user the other steps should run by the macro.

In theory it should be easily done by a menu macro and accessing the menu Items

ALT + F

ALT + A

^c^c_group;^&F;\;^&A;

It seems that the menu macro is paused during the Group Window is openend, at least the command line is. I tried to use ' but i can't get the to run this macro in window

After closing the Window command line Shows this:

Unable to recognize command in menu.F

ant it opens the "fillet" console command.

the commandline Version of group doesn't support find group by enitity.

We will have a lot of groups in our Projects. We are Working with CADworx Plant suite, and Structure Part generates a lot of groups (see in Screenshot). The Groups we want to generate are f.e. the name of an Equipment X00-KY01-HT00 .

Getting the Group name into a Lisp Command by selecting it on the screen would be another ay, but i don't know how.

Would be great to get some Feedback.

Regards Christian

Comments

  • Hello.

    Using macro shortcuts to emulate clicks on the interface seems not to work - not any item from the interface supports macros, maybe only menus.

    One approach could be, indeed, to use a lisp script.
    Here are some steps that could be included in this approach:

    • Check for groups in the drawing.
    • If there are any, select an entity in a group.
    • Cycle through groups for the selected entity.
    • If there is no group containing the entity, the procedure stops.
    • If there is a group containing the entity, its name is found and the command -GROUP is run with the option _A and passing the group name.
    • At this stage -GROUP is running, expecting the user to make a selection.
    • Further, the workflow is just as with the -GROUP command.

    For reference, I post an idea about how this script could look like.
    I tested it only with a very basic drawing.
    To be used further, some significantly changes might be needed.

    To test the script, save it as a lsp file, then use APPLOAD to load it, then use the AddToGroup command.

    (vl-load-com)
    (defun c:AddToGroup (
    /
    app doc grps cnt_grps
    i j g cnt_g obj
    )

    (setq app (vlax-get-acad-object)
    doc (vla-get-activedocument app)
    grps (vla-get-groups doc)
    )

    (setq cnt_grps (vla-get-count grps)
    i 0
    )

    (if (> cnt_grps 0)
    (progn
    ; select entity in group
    (setq ent (entsel "\nSelect entity in group: "))

    (if ent
    (progn
    (setq ent_n (car ent)
    found nil
    )

    (while (and
    (not found)
    (< i cnt_grps)
    )

    ; get the group
    (setq g (vla-item grps i)
    g_n (vla-get-name g)
    cnt_g (vla-get-count g) ; count items in group
    j 0 ; index to cycle through group
    )

    (while (and
    (not found)
    (< j cnt_g)
    )

    ; the entity in group
    (setq obj (vla-item g j)
    obj_n (vlax-vla-object->ename obj)
    )

    (if (eq ent_n obj_n)
    (progn
    (setq found T
    gname g_n
    )
    )
    )

    (setq j (1+ j))
    )

    (setq i (1+ i))
    ) ; while

    (if found
    (command "_-group" "_a" gname)
    )
    )
    ) ; if ent
    )
    ) ; if groups found

    (princ)
    )

  • It may not be what you are after but there is a free routine from Dotsoft (Group Manager) that makes working with groups a bit easier.

    https://www.dotsoft.com/freestuff.htm

  • Just a comment in a lot of commands using lisp as above add the "-" to the start of the command its not applicable to all, but to a lot of common commands. -layer, -insert etc Just try typing the command with the "-" in front, write down the responses needed for the lisp to work.