Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Group Problem??

38 views
Skip to first unread message

Michael Puckett

unread,
Jun 20, 1999, 3:00:00 AM6/20/99
to
I had posted this awhile back for another user inquiring about groups.
Hopefully some of it is helpful.

- - -

The -group command expects commands in the following order
if creating a new group:

(command
"-group"
"_create"
"some_name"
"some_description"
entities
terminating_carriage_return
)

;;; Also, if the group name you provide is already
;;; used, an additional prompt before "some_description"
;;; will ask if you want to redefine said group.

;;; In order to determine if a group already exists
;;; you have to check the appropriate autocad
;;; dictionary as follows

(setq
gname "1"
gdesc "description of group"
tobject (namedobjdict)
tdict (dictsearch tobject "acad_group")
)

;;; then, assuming you want to redefine the group
;;; defined by variable gname AND have a valid
;;; selection set of entities in variable sse ...

(if (dictsearch (cdar tdict) gname)
;;; exists,redefine
(command "-group" "_create" gname "_yes" gdesc sse "")
;;; doesn't exist, create
(command "-group" "_create" gname gdesc sse "")
)

;;; all of this is available in the online customization guide

- - -

Mark Bowes <mark...@hotmail.com> wrote in message
news:7kjfqu$p2...@adesknews2.autodesk.com...
> I have only just started to play with groups and am trying to write a
little
> code to identify if the selection is a group and if so to explode it into
> its elements. This I thought would have been simple but I am having
problems
> trying to identify the group name. Where do I find the group name? Is
there
> a group dxf code that I am missing. The info on groups seems limited...
>
> thanks to anyone who can help
>
> Mark
>
>

Mark Bowes

unread,
Jun 20, 1999, 3:00:00 AM6/20/99
to

Mark Bowes

unread,
Jun 20, 1999, 3:00:00 AM6/20/99
to
Thanks Michael but the problem is that I want to be able to pick a group and
explode it as you would any a blocked item.

The problem is that a group name is required ("Some_Name") as your reply
discussed. I know that it is possible because the group dialogue box allows
to select a group to find the item.

I can not find any suggestion in the online help for this. I think that I
may just go back to producing a block as opposed to a group.

Thanks fro your time

mark
Michael Puckett <puck...@cadvision.com> wrote in message
news:7kjg60$p2...@adesknews2.autodesk.com...

Michael Puckett

unread,
Jun 20, 1999, 3:00:00 AM6/20/99
to
Ok.

Did some quick experimentation, and produced the following. Keep in mind it
represents about 10 minutes work, so it's not exactly robust.

Pass the function an entity name. If it belongs to a group it will return
the group name; otherwise nil.

Usage: (entgname ent)

(defun entgname (ent / ptr1 ptr2)
(if (= (type ent) 'ename)
(if (setq ptr1 (cdr (assoc 330 (entget ent))))
(if (setq ptr2 (cdr (assoc 330 (entget ptr1))))
(cdr (assoc 3 (entget ptr2)))
nil
)
nil
)
nil
)
)

Cheers.

- - -

Mark Bowes <mark...@hotmail.com> wrote in message

news:7kjp39$qs...@adesknews2.autodesk.com...

Michael Puckett

unread,
Jun 20, 1999, 3:00:00 AM6/20/99
to
I sent a previous post but yanked it. If you see it please be mindful of
the following:.

What I notice is that it returns the wrong name for nested groups, otherwise
it works. For nested groups it returns the group name first assigned to any
entity within that group.

Have fun figuring that one out. My times up for now.

- - -

My original post:

Ok.

Did some quick experimentation, and produced the following. Keep in mind it
represents about 10 minutes work, so it's not exactly robust.

Pass the function an entity name. If it belongs to a group it will return
the group name; otherwise nil.

Usage: (entgname ent)

(defun entgname (ent / ptr1 ptr2)
(if (= (type ent) 'ename)
(if (setq ptr1 (cdr (assoc 330 (entget ent))))
(if (setq ptr2 (cdr (assoc 330 (entget ptr1))))
(cdr (assoc 3 (entget ptr2)))
nil
)
nil
)
nil
)
)

Cheers.


Michael Puckett

unread,
Jun 20, 1999, 3:00:00 AM6/20/99
to
Take 2 ...

Of course, the real solution is to walk thru all the group dictionaries,
finding the entities for each group, and then determining if your entity is
a member of that elite. If so bingo, you have the name. If I had time I
would do it for you. Should be do-able in 1/2 hour (+/-), but I simply
don't have that luxury of excess time right now.

Good luck.

- - -

Michael Puckett <puck...@cadvision.com> wrote in message

news:7kjr9c$qs...@adesknews2.autodesk.com...

Michael Puckett

unread,
Jun 20, 1999, 3:00:00 AM6/20/99
to
Ok, so I found a 1/2 hour.

The function (entgname ent) walks thru the group dictionary entries, and if
it finds a match between "your" ent and one of the entities corresponding to
a given name, it returns that name, otherwise nil. While I didn't test it
exhaustively, it appears to work fine with nested groups, returning the name
of the "outermost", or parent group.

I utilized Tony Tanzillo's rather efficient (listcdrs dat) routine, and
hereby giving credit accordingly.

; by tanzillo

(defun listcdrs (key dat)
(if (assoc key dat)
(apply 'append
(mapcar
'(lambda (item)
(if (eq (car item) key)
(list (cdr item))
)
)
dat
)
)
nil
)
)

; by puckett

(defun entgname (ent / dct dat x y rtn)
(cond
( (= (type ent) 'ename)
(setq
dct (dictsearch (namedobjdict) "acad_group")
dat (listcdrs 3 dct)
)
(foreach x dat
(setq ents (listcdrs 340 (dictsearch (cdar dct) x)))
(foreach y ents
(if (eq y ent) (setq rtn x ents nil dat nil))
)
)
)
)
rtn
)

Cheerio.

- - -

Michael Puckett <puck...@cadvision.com> wrote in message

news:7kjrjp$qt...@adesknews2.autodesk.com...

Michael Puckett

unread,
Jun 20, 1999, 3:00:00 AM6/20/99
to
Ok, so I found a 1/2 hour.

The function (entgname ent) walks thru the group dictionary entries, and if
it finds a match between "your" ent and one of the entities corresponding to
a given name, it returns that name, otherwise nil. While I didn't test it
exhaustively, it appears to work fine with nested groups, returning the name
of the "outermost", or parent group.

>only tested under r14<

I utilized Tony Tanzillo's rather efficient (listcdrs dat) routine, and
hereby giving credit accordingly.

; by tanzillo

(defun listcdrs (key dat)
(if (assoc key dat)
(apply 'append
(mapcar
'(lambda (item)
(if (eq (car item) key)
(list (cdr item))
)
)
dat
)
)
nil
)
)

; by puckett

(defun entgname (ent / dct dat x rtn)


(cond
( (= (type ent) 'ename)
(setq
dct (dictsearch (namedobjdict) "acad_group")
dat (listcdrs 3 dct)
)
(foreach x dat

(if (member ent (listcdrs 340 (dictsearch (cdar dct) x)))
(setq rtn x dat nil)


)
)
)
)
rtn
)

; cheerio

- - -

Michael Puckett <puck...@cadvision.com> wrote in message
news:7kjrjp$qt...@adesknews2.autodesk.com...
> Take 2 ...
>
> Of course, the real solution is to walk thru all the group dictionaries,
> finding the entities for each group, and then determining if your entity
is
> a member of that elite. If so bingo, you have the name. If I had time I
> would do it for you. Should be do-able in 1/2 hour (+/-), but I simply
> don't have that luxury of excess time right now.
>
> Good luck.
>
> - - -
>
> Michael Puckett <puck...@cadvision.com> wrote in message

> > > Michael Puckett <puck...@cadvision.com> wrote in message

Michael Puckett

unread,
Jun 20, 1999, 3:00:00 AM6/20/99
to
Beggin' the colonel's pardon but ... .. .

While it is true what you say about groups being nothing more than
persistent selections sets etc., it simply isn't true that you cannot
explode groups. All you have to do is call (command ".-group" "_explode"
group_name) and woila, the group is exploded --- exactly what Mark wants.

While technically it is not the same as exploding a block, it is the
terminology AutoDESK gave it.

- - -

Tony Tanzillo <tony.t...@worldnet.att.net> wrote in message
news:376DC0FD...@worldnet.att.net...
> Mark - Groups are not like blocks. You can't
> explode them. You can remove elements from a
> group (including all, leaving an empty group),
> but for all intensive purposes, groups are
> really nothing but named persistent selection
> sets (that is, groups allow you to select objects
> and save that selection with an optional name,
> so the same objects can be easily reselected).
>
> Perhaps you could elaborate on what exactly
> you are trying to achieve, as it might be
> more appropriate to use blocks (or anonymous
> blocks).


>
> Mark Bowes wrote:
> >
> > I have only just started to play with groups and am trying to write a
little
> > code to identify if the selection is a group and if so to explode it
into
> > its elements. This I thought would have been simple but I am having
problems
> > trying to identify the group name. Where do I find the group name? Is
there
> > a group dxf code that I am missing. The info on groups seems limited...
> >
> > thanks to anyone who can help
> >
> > Mark
>

> --
> /*********************************************************/
> /* Tony Tanzillo Design Automation Consulting */
> /* Programming & Customization for AutoCAD & Compatibles */
> /* ----------------------------------------------------- */
> /* tony.t...@worldnet.att.net */
> /* http://ourworld.compuserve.com/homepages/tonyt */
> /*********************************************************/

Michael Puckett

unread,
Jun 20, 1999, 3:00:00 AM6/20/99
to
What are you talking about?

You said you cannot explode groups.

You are wrong.

- - -

Tony Tanzillo <tony.t...@worldnet.att.net> wrote in message

news:376DCF3E...@worldnet.att.net...
> You seem to be interested in bickering about terminology.
>
> Sorry, but I'm not.

Tony Tanzillo

unread,
Jun 21, 1999, 3:00:00 AM6/21/99
to

Tony Tanzillo

unread,
Jun 21, 1999, 3:00:00 AM6/21/99
to
You seem to be interested in bickering about terminology.

Sorry, but I'm not.

Michael Puckett wrote:
>
> Beggin' the colonel's pardon but ... .. .
>
> While it is true what you say about groups being nothing more than
> persistent selections sets etc., it simply isn't true that you cannot
> explode groups. All you have to do is call (command ".-group" "_explode"
> group_name) and woila, the group is exploded --- exactly what Mark wants.
>
> While technically it is not the same as exploding a block, it is the
> terminology AutoDESK gave it.
>
> - - -
>
> Tony Tanzillo <tony.t...@worldnet.att.net> wrote in message
> news:376DC0FD...@worldnet.att.net...

Tony Tanzillo

unread,
Jun 21, 1999, 3:00:00 AM6/21/99
to
I wasn't referring ot the 'EXPLODE' option of the
-GROUP command or dialog, but the meaning of 'EXPLODE',
as it relates to blocks, and was questioning whether
the use of groups/exploding was appropriate for what
Mark wants to do.

So, if we're going to mince words (or command options),
then you are right - I should have said 'you can't
explode a group in the same sense that you explode
a block'.


Michael Puckett wrote:
>
> Beggin' the colonel's pardon but ... .. .
>
> While it is true what you say about groups being nothing more than
> persistent selections sets etc., it simply isn't true that you cannot
> explode groups. All you have to do is call (command ".-group" "_explode"
> group_name) and woila, the group is exploded --- exactly what Mark wants.
>
> While technically it is not the same as exploding a block, it is the
> terminology AutoDESK gave it.
>

Tony Tanzillo

unread,
Jun 21, 1999, 3:00:00 AM6/21/99
to
No, I am not wrong. You simply are not understanding
the simple fact that my reference to 'explode' in
"can't explode", was not a reference to the GROUP/Explode
subcommand or what it does (which to be precise, is to
delete the group). My use of the term 'explode' was a
reference to the abstract concept of explosion, and what
it means precisely, in the context of whether it may be
more appropriate for Mark to use blocks instead of groups.

IOW: "You can't explode them [in the same sense that
you can explode blocks]".

> "You are wrong".

No, I'm not wrong. Guilty of poor choice of words perhaps,
but not wrong.

If you want to debate this further, then please
post your reply in the 'you-are-wrong-and-I-am-right-
because-that's-what-autodesk-says' newsgroup.

Michael Puckett wrote:
>
> What are you talking about?
>
> You said you cannot explode groups.
>
> You are wrong.
>

> - - -
>
> Tony Tanzillo <tony.t...@worldnet.att.net> wrote in message

> news:376DCF3E...@worldnet.att.net...


> > You seem to be interested in bickering about terminology.
> >
> > Sorry, but I'm not.
> >

> > Michael Puckett wrote:
> > >
> > > Beggin' the colonel's pardon but ... .. .
> > >
> > > While it is true what you say about groups being nothing more than
> > > persistent selections sets etc., it simply isn't true that you cannot
> > > explode groups. All you have to do is call (command ".-group"
> "_explode"
> > > group_name) and woila, the group is exploded --- exactly what Mark
> wants.
> > >
> > > While technically it is not the same as exploding a block, it is the
> > > terminology AutoDESK gave it.
> > >

Michael Puckett

unread,
Jun 21, 1999, 3:00:00 AM6/21/99
to
What a bucket of horse slop.

- - -

Tony Tanzillo <tony.t...@worldnet.att.net> wrote in message

news:376DDDA1...@worldnet.att.net...

Jeff Rhodes

unread,
Jun 21, 1999, 3:00:00 AM6/21/99
to
Mark - try this code:

-- this will search the entire db of the draing for groups!
(setq BASELIST (dictsearch (namedobjdict) "ACAD_GROUP"))

-- the group info is actually stored in the extended entity area of
the object - look at codes 330, 340, or 350. I have used groups before
& can help you out. email me if you are still stuck (remove the nospam
from my email). You CAN DO what you want - I have!

Mark Bowes

unread,
Jun 21, 1999, 3:00:00 AM6/21/99
to
Just finished reading the rest of the threads, didn't want to start an
argument!

Michael, You understood exactly what I wanted. I was speaking in the terms
that the AutoCAD gods have given it, I am fully aware that they are totally
different.

I should have said "I want to break up a collected group into it's original
components using the -group explode code (although I know that it really
isn't anything to do with exploding as in a block sense)".
Can we really afford the bandwidth??

Thanks again ;^)

Michael Puckett <puck...@bantrel.com> wrote in message
news:7klcnh$si...@adesknews2.autodesk.com...

> > > > > > Mark Bowes wrote:
> > > > > > >
> > > > > > > I have only just started to play with groups and am trying to
> write
> > > a
> > > > > little
> > > > > > > code to identify if the selection is a group and if so to
> explode it
> > > > > into
> > > > > > > its elements. This I thought would have been simple but I am
> having
> > > > > problems
> > > > > > > trying to identify the group name. Where do I find the group
> name?
> > > Is
> > > > > there
> > > > > > > a group dxf code that I am missing. The info on groups seems
> > > limited...
> > > > > > >
> > > > > > > thanks to anyone who can help
> > > > > > >
> > > > > > > Mark
> > > > > >

Rudy Tovar

unread,
Jun 21, 1999, 3:00:00 AM6/21/99
to
Hello Mark, I'm Rudy.

I had the same problem creating custom objects.

I had doors, which I wanted to be able to manipulate each part, while
maintaining all the components as one.

So I grouped all the components to the frame and used the frame handle as
the name of the group.

To erase the door and remove, I created a function which would ssget just
the filtered frame which would return the data for the frame. I would then
extract the handle of the frame, and remove the door.

As you know groups stay within a drawing even if you erase the names. So
after removing the door I would remove the group via the frame handle.

The same could be applied for exploding a group.

Use one of the objects handle as a group name, then filter the object and
extract the name after, if you want to explode the group.


--
Ru...@whainc.com
Job Captain/MIS Assist./Programmer

Mark Bowes <mark...@hotmail.com> wrote in article
<7kjfqu$p2...@adesknews2.autodesk.com>...

Tony Tanzillo

unread,
Jun 22, 1999, 3:00:00 AM6/22/99
to
Mark Bowes wrote:
>
> I should have said "I want to break up a collected group
> into it's original components using the -group explode
> code (although I know that it really isn't anything to do
> with exploding as in a block sense)".

I believe you started this thread with:

"I have only just started to play with groups..."

My comments to you related more to the question of
whether it is appropriate to use groups or not. If you
feel that you fully understand all of the subtle
implications of using groups in lieu of blocks, then by
all means, knock yourself out, but given your first
sentence above, you probably don't understand what you
are getting yourself into.

0 new messages