AnsweredAssumed Answered

extrude sketch by region/contour

Question asked by Christopher Elyassi on Aug 14, 2018
Latest reply on Aug 15, 2018 by Christopher Elyassi

Hey all,

 

I have a sketch with multiple contours and I am trying to write some code to extrude a specific contour of that sketch.

Idea is that the method takes in the sketch name and the coordinates a point in the desired region, but it is not working. The "test" boolean in the snippet below always returns false:

 

public static void ExtrudeSketchWithContour(string SketchName, double value, double X, double Y, double Z)
{
    ModelDoc2 swModel = (ModelDoc2)swApp.ActiveDoc;
    SelectionMgr swSelectionMgr = swModel.SelectionManager;


    swModel.Extension.SelectByID2(SketchName, "SKETCH", 0, 0, 0, false, 0, null, 0);


    swSelectionMgr.EnableContourSelection = true;


    bool test = swModel.Extension.SelectByID2(SketchName, "SKETCHREGION", X, Y, Z, true, 0, null, 0);


    swModel.FeatureManager.FeatureExtrusion3
        (true, false, true, 6, 6, value, 0, false, false, false, false, 0, 0, false, false, false, false, false, true, true, 0, 0, false);


    swSelectionMgr.EnableContourSelection = false;


    swModel.ClearSelection2(true);
}

















 

Does anyone know what I am doing wrong?

Also, what is the difference between a sketch contour and a sketch region?

 

Thanks in advance!

Chris

Outcomes