Hi,
I am looking for method to extrude surface into solid, ‘z’ direction. Is there anything that gives straight result? Or do I need to code this around?
Hi,
I am looking for method to extrude surface into solid, ‘z’ direction. Is there anything that gives straight result? Or do I need to code this around?
I think this is what you are looking for:
Rhino.Geometry.Extrusion extrusion = Rhino.Geometry.Extrusion.Create(curve, ext_height, create_cap);
But this is valid only for flat curves. The same way I can use Box. I was rather counting, that there is a method, that will allow me to make solid from curved surface.
You can use Rhino.Geometry.BrepFace.CreateExtrusion()
You have to duplicate the face from a brep first.
Very crudely:
using(GetObject gob = new GetObject())
{
gob.SetCommandPrompt("Pick a brep");
gob.GeometryFilter = Rhino.DocObjects.ObjectType.Brep;
GetResult rc = gob.Get();
if(rc == GetResult.Object)
{
ObjRef or = gob.Object(0);
Brep brep = or.Brep();
Brep facebr = brep.Faces[0].DuplicateFace(false);
BrepFace face = facebr.Faces[0];
double u = face.UnderlyingSurface().Domain(0).Mid;
double v = face.UnderlyingSurface().Domain(1).Mid;
Vector3d N = face.NormalAt(u, v);
Line l = new Line(0.0, 0.0, 0.0, N.X, N.Y, N.Z);
LineCurve dir = new LineCurve(l);
Brep b2 = face.CreateExtrusion(dir, true);
doc.Objects.AddBrep(b2);
}
}