I am trying to explode a visualARQ beam into surfaces using the code below, but whenever I explode and add back to the doc the end surfaces of the beam are rectangular and not the same shape as the beam that was exploded. I am not sure if I am doing this correctly or if this is a bug but just thought I’d ask?
using System;
using Rhino;
using Rhino.Collections;
using Rhino.Commands;
using Rhino.DocObjects;
using Rhino.Input;
using Rhino.Input.Custom;
using Rhino.Geometry;
using Rhino.Geometry.Collections;
using System.Collections.Generic;
var doc = RhinoDoc.ActiveDoc;
GetObject get_obj;
get_obj = new GetObject();
get_obj.SetCommandPrompt(“Select objects to make hole”);
get_obj.GeometryFilter = ObjectType.InstanceReference;
get_obj.GetMultiple(1, 1);
ObjRef sourceObj = get_obj.Object(0);
List surfaces = new List();
List surface_guids = new List();
if (sourceObj.Object().ObjectType == ObjectType.InstanceReference)
{
InstanceObject instanceObject = (InstanceObject)sourceObj.Object();
RhinoObject[] exploded_obj = instanceObject.GetSubObjects();
Extrusion extrusion = (Extrusion)exploded_obj[0].Geometry;
Brep brep = extrusion.ToBrep();
BrepFaceList brep_faces = brep.Faces;
for (int i = 0;i < brep_faces.Count; i++)
{
surfaces.Add(brep_faces[i].ToNurbsSurface());
surface_guids.Add(doc.Objects.AddSurface(brep_faces[i]));
}
doc.Views.Redraw();
}
/*
foreach (Guid guidToDelete in surface_guids)
{
RhinoObject objToDelete = doc.Objects.Find(guidToDelete);
doc.Objects.Delete(objToDelete);
}
*/