I’m noticing that when I go to GetObject with GeometryFilter = Brep, sometimes I get a BrepObject, and sometimes I get an ExtrusionObject. Is there a good way to turn the ExtrusionObject into a BrepObject? Must I delete the extursion object from the doc and add it back in its brep form? This is a little bit annoying because I would also have to sychronize their attributes, and add this code everywhere I prompt a user to select a Brep, I guess I was just wondering If there is a better way?
The solution that I was wondering about would be a more convenient way to make sure that all objects returned by GetObject() GeometryFilter=Brep are infact BrepObjects. The following seems to work, it is just more complicated than I would like:
var brepObj = obj as BrepObject;
if (brepObj != null)
{
m_Brep = brepObj.BrepGeometry;
m_BrepId = brepId;
}
else
{
var extrusionObj = obj as ExtrusionObject;
if (extrusionObj == null)
{
throw new Exception(
"GetObject() GeometryFilter = Brep seems to get things that are not breps or extrusions"
);
}
m_Brep = extrusionObj.ExtrusionGeometry.ToBrep();
var attributes = extrusionObj.Attributes;
m_BrepId = RhinoDoc.ActiveDoc.Objects.Add(m_Brep);
obj = RhinoDoc.ActiveDoc.Objects.FindId(m_BrepId);
brepObj = obj as BrepObject;
brepObj.Attributes = attributes;
brepObj.CommitChanges();
RhinoDoc.ActiveDoc.Objects.Delete(extrusionObj, true, true);
}