How create breps as group directly

Hi everyone,

I have a RhinoList to create objects to doc as you can see code below. But I want to create breps as a group directly. Is there any method or any way do that?

RhinoList<Brep> storeys = sb.CreateBuilding(crv, doc);

        for(int i = 0; i < storeys.Count; i++)

Thanks in advance,

Yes, you need to collect the Guid ids that are returned by AddBrep, and then use doc.Groups.AddGroup("name-of-group", list-of-guids)

See also

1 Like

Hi @oguzhankoral,

You can also do this:

RhinoList<Brep> storeys = sb.CreateBuilding(crv, doc);
if (null != storeys && storeys.Count > 0)
  var group_index = doc.Groups.Add();
  var attributes = doc.CreateDefaultAttributes();

  for (var i = 0; i < storeys.Count; i++)
    doc.Objects.AddBrep(storeys[i], attributes);

– Dale


Hi @dale,

It is directly solved my question and make me awaken about the concept. So glad for answer!

I have two extra wondering,

1- If I want to scale1D in Z-axis of grouped breps in Viewport, using with EventWatchers and EventHandlers, should I use again this group index and attributes to recreate breps with different heights?

2- This new group that we have just created has own different GUID from single GUID’s of breps in the my list? Shortly, Is it new object or referenced from Breps in the my list?


Hi @menno,

I guess Dale’s answer solved my question with code example. Even so thanks for your kind answer.