# Group Name or Description

**URL:** <https://forums.sketchup.com/t/group-name-or-description/81010>\
**Category:** Ruby API\
**Created:** [November 11, 2018, 6:25pm UTC](https://forums.sketchup.com/t/group-name-or-description/81010 "2018-11-11T18:25:39Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![medeek](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/medeek/32/10675_2.png) [@medeek](https://forums.sketchup.com/u/medeek)\
**Post date:** [November 11, 2018, 6:25pm UTC](https://forums.sketchup.com/t/group-name-or-description/81010/1 "2018-11-11T18:25:39Z")

</div>

I’ve been in the habit of setting both the name and description for a group but really only ohe of these parameters is being displayed as the Instance name in the Entity Info tray.

So where or how is the description field actually used or where does it appear?

---

<div class="post-metadata">

**Author:** ![slbaumgartner](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/slbaumgartner/32/7302_2.png) [@slbaumgartner](https://forums.sketchup.com/u/slbaumgartner)\
**Post date:** [November 11, 2018, 7:03pm UTC](https://forums.sketchup.com/t/group-name-or-description/81010/2 "2018-11-11T19:03:19Z")

</div>

Because Groups and Components are implemented atop the same backend ComponentDefinition, they share some attributes that the SketchUp GUI suppresses when the Entity is actually a Group. In particular, there is nowhere that the GUI displays either the ComponentDefinition’s name or its description for a Group (a Group’s Instance name is displayed in Model Info and the Outliner).

So, although you can assign these properties via the Ruby API they are of no use except within the API. For Components, the definition name shows in both Model Info and the Outliner and the description shows in the Components browser window.

---

<div class="post-metadata">

**Author:** ![medeek](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/medeek/32/10675_2.png) [@medeek](https://forums.sketchup.com/u/medeek)\
**Post date:** [November 11, 2018, 7:10pm UTC](https://forums.sketchup.com/t/group-name-or-description/81010/3 "2018-11-11T19:10:50Z")

</div>

On a related note concerning groups and components it became obvious to me that using the definition method on a group:

```auto
group = Sketchup.active_model.entities.add_group
group_def = group.definition

```

Allows one to grab the component definition of the group and then perform operations on this group as if it were a component, for example add another instance:

```
new_instance = Sketchup.active_model.active_entities.add_instance(group_def, new_transformation)
new_instance.name = "group name #{pos_i}"

```

Does anyone see any problem in doing this with a group definition?

---

<div class="post-metadata">

**Author:** ![medeek](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/medeek/32/10675_2.png) [@medeek](https://forums.sketchup.com/u/medeek)\
**Post date:** [November 11, 2018, 7:13pm UTC](https://forums.sketchup.com/t/group-name-or-description/81010/4 "2018-11-11T19:13:22Z")

</div>

Thank-you for this point of clarification. **This information should be added to the API documentation.**

---

<div class="post-metadata">

**Author:** ![medeek](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/medeek/32/10675_2.png) [@medeek](https://forums.sketchup.com/u/medeek)\
**Post date:** [November 11, 2018, 8:18pm UTC](https://forums.sketchup.com/t/group-name-or-description/81010/5 "2018-11-11T20:18:57Z")

</div>

However if you use the add\_instance method on a group and then check the entity info of the groups in the SketchUp GUI each one will say only (1 in model). One would think that it would report (x in model) since you are using the same definition to create additional copies. For some reason it is making the groups unique, which is unexpected, and to be honest somewhat of an annoyance.

---

<div class="post-metadata">

**Author:** ![medeek](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/medeek/32/10675_2.png) [@medeek](https://forums.sketchup.com/u/medeek)\
**Post date:** [November 11, 2018, 8:24pm UTC](https://forums.sketchup.com/t/group-name-or-description/81010/6 "2018-11-11T20:24:50Z")

</div>

I would be nice if I could use the component method of “add\_instance” on a group and still maintain the component like attributes for the groups (ie. they are still using the same definition).

---

<div class="post-metadata">

**Author:** ![TIG](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/tig/32/198_2.png) [@TIG](https://forums.sketchup.com/u/TIG)\
**Post date:** [November 11, 2018, 8:26pm UTC](https://forums.sketchup.com/t/group-name-or-description/81010/7 "2018-11-11T20:26:44Z")

</div>

If your new group contains no entities at all, then it can simply ‘evaporate’ as SketchUp ‘garbage-collects’ and tidies up after itself… especially if there are too many complex steps before you next want to use that group later.

Provided that you add an entity to the group it will survive until later.  
So `@temp_cpoint = group.entities.add_cpoint(ORIGIN)` is a useful fix if you find it’s vanishing before you need it.  
You can then use `@temp_cpoint.erase! if @temp_cpoint.valid?` later on, e.g. once that group has some other entities populating it…

---

<div class="post-metadata">

**Author:** ![medeek](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/medeek/32/10675_2.png) [@medeek](https://forums.sketchup.com/u/medeek)\
**Post date:** [November 11, 2018, 8:55pm UTC](https://forums.sketchup.com/t/group-name-or-description/81010/8 "2018-11-11T20:55:47Z")

</div>

After further testing it appears that the new group (instance) is made unique when the name is set:

`new_instance.name = "group name #{pos_i}"`

I’m also setting the material and layer of the newly created group and this does not affect the group definition.

The odd thing about this is that if you set the name of the group in the GUI it does not make the group unique, what is going on here?

---

<div class="post-metadata">

**Author:** ![medeek](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/medeek/32/10675_2.png) [@medeek](https://forums.sketchup.com/u/medeek)\
**Post date:** [November 12, 2018, 12:24am UTC](https://forums.sketchup.com/t/group-name-or-description/81010/9 "2018-11-12T00:24:30Z")

</div>

Should I be using the group copy method instead?

---

<div class="post-metadata">

**Author:** ![medeek](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/medeek/32/10675_2.png) [@medeek](https://forums.sketchup.com/u/medeek)\
**Post date:** [November 12, 2018, 1:04am UTC](https://forums.sketchup.com/t/group-name-or-description/81010/10 "2018-11-12T01:04:11Z")

</div>

After some further testing it appears that the copy method makes the group unique from the outset. Only using the add\_instance method or using the copy feature in the GUI maintains the linked definition of the groups.

---

<div class="post-metadata">

**Author:** ![TDahl](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/tdahl/32/11584_2.png) [@TDahl](https://forums.sketchup.com/u/TDahl)\
**Post date:** [January 5, 2022, 8:24pm UTC](https://forums.sketchup.com/t/group-name-or-description/81010/11 "2022-01-05T20:24:40Z")

</div>

> [@medeek](#):
>
> After further testing it appears that the new group (instance) is made unique when the name is set:
> 
> `new_instance.name = "group name #{pos_i}"`
> 
> I’m also setting the material and layer of the newly created group and this does not affect the group definition.
> 
> The odd thing about this is that if you set the name of the group in the GUI it does not make the group unique, what is going on here?

I just noticed the same behavior: assigning a group’s name triggers uniqueness (with SketchUp Pro 2018). This is kind of a bummer, because I would like my Ruby script to assign names to other instances of a group’s definition. I wonder how the SketchUp GUI manages to assign a name to a group, without triggering uniqueness?
