How to cut sphere in SOLIDWORKS 2019 in C# api

52 Views Asked by At

I have example of code, where it can cut cylindre. I want to write method for cut sphere.

Example:

public static Feature CutCilindr(ModelDoc2 doc, double xc, double yc, double zc, int iteration, Feature swPlane, double height = 0.07, double radious = 0.0024)
{
    double unit = 1000;
    doc.ClearSelection();

    double adjustedYc = yc - (iteration / 10) * 10;
    double adjustedXc = (xc + iteration * 5.5);
        
    Point3D center = new Point3D(adjustedXc / unit, adjustedYc / unit, zc / unit);

    doc.SketchManager.InsertSketch(true);
    doc.SketchManager.CreateCircleByRadius(center.x, center.y, center.z, 0.002);
           
    var cut = doc.FeatureManager.FeatureCut4(true, false, false, 6, 0, height, height, false, false, false, false, 1.74532925199433E-02, 1.74532925199433E-02, false, false, false,
                false, false, true, true, true, true, false, 0, 0, false, false);

    doc.InsertSketch2(false);
    doc.ClearSelection();
           
    return cut;
}

I know that the SOLIDWORKS has a rotated cutout, but I don't know what method to use for it. And besides the FeatureCut4, there are other similar methods, but I still don’t understand where I can read about them, I didn't find anything in the documentation

0

There are 0 best solutions below