Extrusion and difference

I managed to get the rhinocommons working and can now do some stuff from c#. But can’t get the most important functions to work:

  1. I want to extrude a shape along a curve.

  2. The end points of the curve should be on the surface of an object I click (my is click always return the coordinates on the XY plane).

  3. I want to make boolean differences of the objects I create. Do the objects have to be meshed (Brep?) to do this?

At the moment I just make the objects like below:

            Rhino.Geometry.Line line1 = new Line(pt1, pt2);

        Rhino.Geometry.Curve curve1 = Curve.CreateArcBlend(
            pt1, new Vector3d(1, 1, 0),
            pt2, new Vector3d(0, 2, 0),

        Extrusion extrusion = Extrusion.Create(curve1, 5, true);

        Cylinder cylExt = new Cylinder(new Circle(new Point3d(0, 0, 0), 0.3), 20);
        Extrusion extrusion = Extrusion.CreateCylinderExtrusion(cylExt, true, true);


Hi @per.mymail,

The RhinoCommon method you need to create Boolean differences is Brep.CreateBooleanDifference. The inputs to this method are Breps. Thus, if you have Extrusion objects, you’ll need to convert them using Extrusion.ToBrep().

var ext0 = Extrusion.Create(curve1, 5, true);
var ext1 = new Cylinder(new Circle(new Point3d(0, 0, 0), 0.3), 20);

var brep0 = ext0.ToBrep();
var brep1 = ext1.ToBrep();

var results = Brep.CreateBooleanDifference(ext0, ext1, doc.ModelAbsoluteTolerance);
// todo...

Hope this helps.

– Dale

Thanks that was just the thing… well one of the things. my first question was how to extrude a surface along a curve. I can do it in Rhino manually, but I can’t find the classes and methods in rhinocommons.

Hi @per.mymail,

There’s Surface.CreateExtrusion and BrepFace.CreateExtrusion.

– Dale