コード例 #1
0
ファイル: Manifold.cs プロジェクト: AeroYoung/HotRunner
        private List <Line> GetManifoldEdge()
        {
            List <Line> lines = new List <Line>();

            ModelDoc2 swDoc   = (ModelDoc2)swApp.ActiveDoc;
            Feature   feature = swDoc.GetFeatureInPrt("runnerCube0");

            object[] faces  = feature.GetFaces();
            Vector   target = new Vector(0, 0, 1);

            for (int i = 0; i < faces.Count(); i++)
            {
                Face2  face   = (Face2)faces[i];
                Vector normal = new Vector(face.Normal);
                if (normal.isSameDir(target, 0.000005) != 1)
                {
                    continue;
                }
                object[] edges = face.GetEdges();
                double   area  = face.GetArea();
                int      count = face.GetEdgeCount();
                for (int j = 0; j < count; j++)
                {
                    Edge  edge  = (Edge)edges[j];
                    Point start = new Point(edge.GetCurveParams3().StartPoint);
                    Point end   = new Point(edge.GetCurveParams3().EndPoint);
                    Line  line  = new Line(start, end);
                    lines.Add(line);
                }
            }

            return(lines);
        }
コード例 #2
0
        public static MyCylinder CreateMyCylinderFromFace(Surface faceSurface, Face2 face)
        {
            //OSSERVAZIONE: CI POTREBBERO ESSERE EDGE CHIUSI CHE NON AVERE CENTRO SULL'ASSE
            //AD ESEMPIO EDGE CHIUSI CHE SI CREANO INTERSECANDO UN CILINDRO CON UNA SFERA
            //"INFILATA" SULLA SUA SUPERFICIE LATERALE.
            //DI QUESTI EDGE CHIUSI NON ME NE PREOCCUPO PERCHE' SONO A CONTATTO CON ALTRE FORME
            //DI CUI SPERO DI AVER CONTROLLATO (NEL CONTROLLO DELLA GEOMETRIA) IL GIUSTO
            //POSIZIONAMENTO.


            double[] myCylinderParameters = faceSurface.CylinderParams;
            double[] myCylinderOrigin     =
            {
                (double)myCylinderParameters.GetValue(0), (double)myCylinderParameters.GetValue(1),
                (double)myCylinderParameters.GetValue(2)
            };
            double[] myCylinderAxis =
            {
                (double)myCylinderParameters.GetValue(3), (double)myCylinderParameters.GetValue(4),
                (double)myCylinderParameters.GetValue(5)
            };
            double myCylinderRadius = (double)myCylinderParameters.GetValue(6);

            var newMyCylinder = new MyCylinder(myCylinderOrigin, myCylinderAxis, myCylinderRadius);

            var faceEdges  = (Array)face.GetEdges();
            var numOfEdges = faceEdges.Length;

            int i = 0;
            var currentListOfBaseCircle  = new List <MyCircle>();
            var currentListOfBaseEllipse = new List <MyEllipse>();

            while (i < numOfEdges)
            {
                Edge  edge      = (Edge)faceEdges.GetValue(i);
                Curve curveEdge = edge.GetCurve();
                if (IsClosedEdge(edge))
                {
                    //is the closed edge a circle?
                    if (curveEdge.IsCircle())
                    {
                        double[] circleParam   = curveEdge.CircleParams;
                        var      newBaseCircle = new MyCircle(circleParam);
                        currentListOfBaseCircle.Add(newBaseCircle);
                    }
                    //is the closed edge an ellipse?
                    if (curveEdge.IsEllipse())
                    {
                        double[] ellipseParam   = curveEdge.GetEllipseParams();
                        var      newBaseEllipse = new MyEllipse(ellipseParam);
                        currentListOfBaseEllipse.Add(newBaseEllipse);
                    }
                }
                i++;
            }
            newMyCylinder.listOfBaseCircle  = currentListOfBaseCircle;
            newMyCylinder.listOfBaseEllipse = currentListOfBaseEllipse;
            return(newMyCylinder);
        }
コード例 #3
0
        private static List <Edge> GetSelectFaceEdgeList(Face2 swSelFace)
        {
            Object[] eages = (Object[])swSelFace.GetEdges();

            List <Edge> thisFaceEdgeList = new List <Edge>();

            foreach (var item in eages)
            {
                thisFaceEdgeList.Add((Edge)item);

                var tempE  = (Edge)item;
                var tStart = (Vertex)tempE.GetStartVertex();
                var tEnd   = (Vertex)tempE.GetEndVertex();
                var pstart = (double[])tStart.GetPoint();
                var pend   = (double[])tEnd.GetPoint();
                var s      = pstart[0] + "," + pstart[1] + "--------" + pend[0] + "," + pend[1];
            }

            return(thisFaceEdgeList);
        }
コード例 #4
0
        /// <summary>
        /// The my adjacence face.
        /// </summary>
        /// <param name="face">
        /// The face.
        /// </param>
        /// <returns>
        /// The <see cref="List{T}"/>.
        /// </returns>
        public static List <Face2> MyAdjacenceFace(Face2 face, SldWorks swApplWorks)
        {
            var listAdjacentFace = new List <Face2>();

            // Aggiungo la faccia stessa e tutte le sue adiacenti,
            // Se non aggiungo anche se stessa poi controlla la presenza di edge virtuali tra sé e sé.
            // listAdjacentFace.Add(face);
            var myEdgeOfFace = (Array)face.GetEdges();

            foreach (Edge edge in myEdgeOfFace)
            {
                Array myAdiacenceFaces = edge.GetTwoAdjacentFaces2();
                Face2 myAdiacenceFace  = null;
                var   firstFace        = (Face2)myAdiacenceFaces.GetValue(0);
                var   secondFace       = (Face2)myAdiacenceFaces.GetValue(1);

                // Se non c'è un'altra faccia adiacente allora ho un valore NULL e c'è un errore nel modello
                //(se ho un modello manifold devo avere per ogni edge due facce).
                if (firstFace == null || secondFace == null)
                {
                    swApplWorks.SendMsgToUser("ERROR: the model is defective and the adjacency relation cannot be stored correctly (NOT ALL THE EDGES ARE SHARED BY 2 FACES).");
                    return(listAdjacentFace);
                }

                // Se la faccia non è quella che ho già la salvo come faccia adiacente, altrimenti salvo l'altra.
                if (firstFace.GetFaceId() == face.GetFaceId())
                {
                    myAdiacenceFace = secondFace;
                }
                else if (secondFace.GetFaceId() == face.GetFaceId())
                {
                    myAdiacenceFace = firstFace;
                }

                listAdjacentFace.Add(myAdiacenceFace);
            }

            return(listAdjacentFace);
        }
コード例 #5
0
        public void AddFeature(SldWorks SwApp, ModelDoc2 SwModel, Point2D P1, Point2D P2)
        {
            if (CheckUsing() == false)
            {
                return;
            }

            SwModel.ClearSelection2(true);
            Helper         helper         = new Helper(SwModel, SwApp);
            SketchManager  sketchManager  = SwModel.SketchManager;
            FeatureManager featureManager = SwModel.FeatureManager;
            SelectionMgr   selectionMgr   = SwModel.SelectionManager;
            Feature        feature        = default(Feature);
            Entity         entity         = default(Entity);
            Face2          face2          = default(Face2);
            Array          faceArray      = default(Array);
            Array          edgeArray      = default(Array);
            Edge           swEdge         = default(Edge);

            List <double> filletedges = new List <double>();
            double        edgeL       = default(double);

            double[] TNormal = { 0, 1, 0 };  // Y up normal
            double[] LNormal = { 0, 0, 1 };  // +Z normal
            double[] RNormal = { 0, 0, -1 }; // -Z normal

            CurveParamData curveParamData = default(CurveParamData);

            double LStage = P2.x - P1.x;

            #region // add features

            helper.select_feature("RefPlane", 0, false, 0);
            SwModel.InsertSketch();

            if (splinedMethod == (object)"From Start")
            {
                sketchManager.CreateLine(P1.x, P1.y, 0, (P1.x + splinedLength), P1.y, 0); // top line
                sketchManager.CreateLine(P1.x, splinedR, 0, ((P1.x + splinedLength) - splinedArcL), splinedR, 0);
                // bottom line
                sketchManager.CreateLine(P1.x, P1.y, 0, P1.x, splinedR, 0); //left line
                sketchManager.CreateTangentArc((P1.x + (splinedLength - splinedArcL)), splinedR, 0,
                                               (P1.x + splinedLength),
                                               P1.y, 0, 1);
            }

            if (splinedMethod == (object)"From End")
            {
                sketchManager.CreateLine(P2.x, P1.y, 0, (P2.x - splinedLength), P2.y, 0); // top line
                sketchManager.CreateLine(P2.x, splinedR, 0, (P2.x - (splinedLength - splinedArcL)), splinedR, 0);
                // bottom line
                sketchManager.CreateLine(P2.x, P1.y, 0, P2.x, splinedR, 0); //left line
                sketchManager.CreateTangentArc((P2.x - (splinedLength - splinedArcL)), splinedR, 0,
                                               (P2.x - splinedLength),
                                               P1.y, 0, 0);
            }

            if (splinedMethod == (object)"Through")
            {
                sketchManager.CreateCenterRectangle((P1.x + (LStage / 2)), (splinedR + (P1.y - splinedR) / 2), 0,
                                                    P1.x, P1.y, 0);
            }


            SwModel.FeatureManager.FeatureCut3(true, false, false, 6, 0, splinedWidth, 0,
                                               false, false, false, false, 0, 0, false, false, false, false, false, true, true, true, true,
                                               false, 0, 0, false); //cut from mide plane

            #endregion

            feature   = (Feature)selectionMgr.GetSelectedObject6(1, -1);
            faceArray = feature.GetFaces() as Array;

            #region // edge filleting, 0 - pass

            if (splinedFillet != 0)

            {
                for (int j = 0; j < faceArray.Length; j++) // get face by normal 0,1,0
                {
                    face2 = faceArray.GetValue(j) as Face2;
                    var normal = face2.Normal;
                    if (TNormal.SequenceEqual(normal as double[]))
                    {
                        entity = faceArray.GetValue(j) as Entity;
                        entity.Select4(false, null);
                        //                                MessageBox.Show(j.ToString());
                        break;
                    }
                }

                face2     = selectionMgr.GetSelectedObject6(1, -1);
                edgeArray = face2.GetEdges() as Array;
                //                     MessageBox.Show(""+face2.GetEdgeCount().ToString());
                SwModel.ClearSelection();

                for (int j = 0; j < face2.GetEdgeCount(); j++) // finding of edge length
                {
                    swEdge         = edgeArray.GetValue(j) as Edge;
                    curveParamData = swEdge.GetCurveParams3();
                    edgeL          = Math.Abs(curveParamData.UMaxValue - curveParamData.UMinValue);
                    filletedges.Add(edgeL);
                }


                double max = filletedges.Max();
                for (int j = 0; j < filletedges.Count; j++) // select edges for filleting
                {
                    if (filletedges[j] == max)
                    {
                        entity = edgeArray.GetValue(j) as Entity;
                        entity.Select4(true, null);
                    }
                }

                featureManager.FeatureFillet(194, splinedFillet, 0, 0, null, null, null);
                // edges fillet 194 - target propagate off
                SwModel.ClearSelection2(true);
            }

            #endregion

            #region // edge chamfering, 0 - pass

            if (splinedChamfer != 0)
            {
                List <Face2> facesList = new List <Face2>();
                facesList.Add(default(Face2));             // empty element
                facesList.Add(default(Face2));             // empty element

                for (int j = 0; j < faceArray.Length; j++) // select faces by normal
                {
                    face2 = faceArray.GetValue(j) as Face2;
                    var normal = face2.Normal;
                    if (LNormal.SequenceEqual(normal as double[]))
                    {
                        facesList[0] = face2;
                    }
                    if (RNormal.SequenceEqual(normal as double[]))
                    {
                        facesList[1] = face2;
                    }
                }

                faceArray = facesList.ToArray() as Array; // refill array of neded face's
                int index_f0 = 0;                         // index of top edge L
                int index_f1 = 0;                         // index of top edge R

                for (int j = 0; j < faceArray.Length; j++)
                {
                    face2     = faceArray.GetValue(j) as Face2;
                    edgeArray = face2.GetEdges() as Array;
                    swEdge    = edgeArray.GetValue(0) as Edge;

                    CurveParamData cData = swEdge.GetCurveParams3() as CurveParamData;

                    var Spoint = (double[])cData.StartPoint;
                    var Epoint = (double[])cData.EndPoint;


                    for (int k = 0; k < edgeArray.Length; k++)
                    {
                        swEdge = edgeArray.GetValue(k) as Edge;
                        cData  = swEdge.GetCurveParams3() as CurveParamData;
                        var SP = (double[])cData.StartPoint;
                        var EP = (double[])cData.EndPoint;

                        if ((SP[1] >= Spoint[1]) && (EP[1] >= Epoint[1])) // check max y cordinats of the edge
                        {
                            if (Spoint[1] == Spoint[1])                   // horisontal line always have same y cordinats
                            {
                                Epoint = EP;
                                Spoint = SP;
                                if (j == 0)
                                {
                                    index_f0 = k;
                                }
                                else
                                {
                                    index_f1 = k;
                                }
                            }
                        }
                    }
                }


                // finally selecy top up edges
                face2     = faceArray.GetValue(0) as Face2;
                edgeArray = face2.GetEdges() as Array;
                entity    = edgeArray.GetValue(index_f0) as Entity;
                entity.Select4(false, null);


                face2     = faceArray.GetValue(1) as Face2;
                edgeArray = face2.GetEdges() as Array;
                entity    = edgeArray.GetValue(index_f1) as Entity;
                entity.Select4(true, null);

                int chamferOpt = 4; // target propagate by default

                if (splinedMethod == (object)"From Start" ||
                    splinedMethod == (object)"From End")
                {
                    chamferOpt = 1; // flip direction
                }
                featureManager.InsertFeatureChamfer(chamferOpt, 1, splinedChamfer, helper.ToRad(45), 0, 0, 0, 0);
                SwModel.ClearSelection2(true);
            }

            #endregion

            #region //Pattern if value less then 1 pass

            if (splinedArray > 1)
            {
                helper.select_feature("Cut", (helper.get_features_count("Cut") - 1), false, 4);
                helper.select_feature("RefAxis", 0, true, 1);

                if (splinedChamfer > 0)
                {
                    helper.select_feature("Chamfer", (helper.get_features_count("Chamfer") - 1), true, 4);
                }

                if (splinedFillet > 0)
                {
                    helper.select_feature("Fillet", (helper.get_features_count("Fillet") - 1), true, 4);
                }

                featureManager.FeatureCircularPattern4(splinedArray, helper.ToRad(360), false, "null", false, true,
                                                       false);
            }

            #endregion
            helper.HidePlanes();
        }
コード例 #6
0
        public static MyCylinder KLCreateMyCylinderFromFace(Surface faceSurface, Face2 face, double[,] transformationMatrix)
        {
            //OSSERVAZIONE: CI POTREBBERO ESSERE EDGE CHIUSI CHE NON AVERE CENTRO SULL'ASSE
            //AD ESEMPIO EDGE CHIUSI CHE SI CREANO INTERSECANDO UN CILINDRO CON UNA SFERA
            //"INFILATA" SULLA SUA SUPERFICIE LATERALE.
            //DI QUESTI EDGE CHIUSI NON ME NE PREOCCUPO PERCHE' SONO A CONTATTO CON ALTRE FORME
            //DI CUI SPERO DI AVER CONTROLLATO (NEL CONTROLLO DELLA GEOMETRIA) IL GIUSTO
            //POSIZIONAMENTO.

            //KLdebug.Print("FACCIA CILINDRICA", "buildRepeatedEntity.txt");
            //KLdebug.Print(" ", "buildRepeatedEntity.txt");

            double[] myCylinderParameters = faceSurface.CylinderParams;
            double[] myCylinderOrigin     =
            {
                (double)myCylinderParameters.GetValue(0), (double)myCylinderParameters.GetValue(1),
                (double)myCylinderParameters.GetValue(2)
            };
            double[] myCylinderAxis =
            {
                (double)myCylinderParameters.GetValue(3), (double)myCylinderParameters.GetValue(4),
                (double)myCylinderParameters.GetValue(5)
            };
            double myCylinderRadius = (double)myCylinderParameters.GetValue(6);

            if (transformationMatrix != null)
            {
                double[] myCylinderOriginAffine = { (double)myCylinderOrigin.GetValue(0), (double)myCylinderOrigin.GetValue(1), (double)myCylinderOrigin.GetValue(2), 1 };
                double[] myCylinderAxisAffine   = { (double)myCylinderAxis.GetValue(0), (double)myCylinderAxis.GetValue(1), (double)myCylinderAxis.GetValue(2), 1 };

                var newMyCylinderOrigin = Matrix.Multiply(transformationMatrix, myCylinderOriginAffine);
                var newMyCylinderAxis   = Matrix.Multiply(transformationMatrix, myCylinderAxisAffine);

                myCylinderOrigin.SetValue((double)newMyCylinderOrigin.GetValue(0), 0);
                myCylinderOrigin.SetValue((double)newMyCylinderOrigin.GetValue(1), 1);
                myCylinderOrigin.SetValue((double)newMyCylinderOrigin.GetValue(2), 2);

                //myCylinderAxis.SetValue((double)newMyCylinderAxis.GetValue(0), 0);
                //myCylinderAxis.SetValue((double)newMyCylinderAxis.GetValue(1), 1);
                //myCylinderAxis.SetValue((double)newMyCylinderAxis.GetValue(2), 2);
            }

            var newMyCylinder = new MyCylinder(myCylinderOrigin, myCylinderAxis, myCylinderRadius);

            var faceEdges  = (Array)face.GetEdges();
            var numOfEdges = faceEdges.Length;

            int i = 0;
            var currentListOfBaseCircle  = new List <MyCircle>();
            var currentListOfBaseEllipse = new List <MyEllipse>();

            while (i < numOfEdges)
            {
                Edge  edge      = (Edge)faceEdges.GetValue(i);
                Curve curveEdge = edge.GetCurve();
                if (IsClosedEdge(edge))
                {
                    //KLdebug.Print("trovato edge chiuso:", "buildRepeatedEntity.txt");


                    //is the closed edge a circle?
                    if (curveEdge.IsCircle())
                    {
                        double[] circleParam = curveEdge.CircleParams;
                        if (transformationMatrix != null)
                        {
                            double[] circleCenterAffine = { (double)circleParam.GetValue(0), (double)circleParam.GetValue(1), (double)circleParam.GetValue(2), 1 };

                            var newMyCircleOrigin = Matrix.Multiply(transformationMatrix, circleCenterAffine);

                            circleParam.SetValue((double)newMyCircleOrigin.GetValue(0), 0);
                            circleParam.SetValue((double)newMyCircleOrigin.GetValue(1), 1);
                            circleParam.SetValue((double)newMyCircleOrigin.GetValue(2), 2);
                        }
                        var newBaseCircle = new MyCircle(circleParam);
                        currentListOfBaseCircle.Add(newBaseCircle);
                    }
                    //is the closed edge an ellipse?
                    if (curveEdge.IsEllipse())
                    {
                        double[] ellipseParam = curveEdge.GetEllipseParams();

                        if (transformationMatrix != null)
                        {
                            double[] circleCenterAffine = { (double)ellipseParam.GetValue(0), (double)ellipseParam.GetValue(1), (double)ellipseParam.GetValue(2), 1 };

                            var newMyCircleOrigin = Matrix.Multiply(transformationMatrix, circleCenterAffine);

                            ellipseParam.SetValue((double)newMyCircleOrigin.GetValue(0), 0);
                            ellipseParam.SetValue((double)newMyCircleOrigin.GetValue(1), 1);
                            ellipseParam.SetValue((double)newMyCircleOrigin.GetValue(2), 2);
                        }

                        var newBaseEllipse = new MyEllipse(ellipseParam);
                        currentListOfBaseEllipse.Add(newBaseEllipse);
                    }
                }
                i++;
            }
            newMyCylinder.listOfBaseCircle  = currentListOfBaseCircle;
            newMyCylinder.listOfBaseEllipse = currentListOfBaseEllipse;
            return(newMyCylinder);
        }
コード例 #7
0
        public void AddFeature(SldWorks SwApp, ModelDoc2 SwModel, Point2D P1, Point2D P2)
        {
            if (CheckUsing() == false)
            {
                return;
            }

            SwModel.ClearSelection2(true);

            object[] seating_types    = new[] { "None", "Prismatic A", "Prismatic B", "Segmented" };
            object[] operations_types = new[] { "None", "Chamfer", "Fillet" }; // array of operation names
            Helper   helper           = new Helper(SwModel, SwApp);

            FeatureManager featureManager = SwModel.FeatureManager;
            SketchManager  sketchManager  = SwModel.SketchManager;
            SelectionMgr   selectionMgr   = (SelectionMgr)SwModel.SelectionManager;
            Entity         ent            = default(Entity);
            Array          facesArray     = default(Array);
            Array          edgesArray     = default(Array);
            Feature        swFeature      = default(Feature);
            Face2          face2          = default(Face2); // neds to get edges of selected face
            double         LStage         = 0;
            double         x_center       = 0;
            double         y_center       = 0;
            double         L      = 0;
            double         W      = 0;
            bool           append = false;

            LStage   = P2.x - P1.x;                         // length of current stage
            x_center = P1.x + (LStage / 2) + seatingOffset; // center of current stage
            y_center = 0;
            L        = x_center + seatingLength / 2;
            W        = seatingWidth / 2;


            SwModel.ClearSelection2(true);

            #region                              // make prismatic A keyseat

            if (seatingType == seating_types[1]) //Prismatic A
            {
                helper.select_feature("RefPlane", 1, false, 0);
                SwModel.CreatePlaneAtOffset(P1.y, false);
                sketchManager.InsertSketch(true);

                sketchManager.CreateCenterRectangle(x_center, y_center, 0, L, W, 0);
                SwModel.FeatureManager.FeatureCut3(true, false, false, 0, 0, seatingDepth, 0,
                                                   false, false, false, false, 0, 0, false, false, false, false, false, true, true, true, true,
                                                   false, 0, 0, false); // add cut feature

                if (seatingOpearationType != operations_types[0])       // add chamfer or fillet, if none or value is 0 - pass
                {
                    swFeature  = (Feature)selectionMgr.GetSelectedObject6(1, -1);
                    facesArray = (Array)swFeature.GetFaces();
                    ent        = facesArray.GetValue(0) as Entity;
                    ent.Select4(false, null);

                    if (seatingOpearationType == operations_types[1])
                    {
                        featureManager.InsertFeatureChamfer(4, 1, seatingChamferFilletValue, helper.ToRad(45), 0, 0, 0,
                                                            0);
                    }
                    if (seatingOpearationType == operations_types[2])
                    {
                        SwModel.FeatureManager.FeatureFillet(195, seatingChamferFilletValue, 0,
                                                             0, null, null, null);
                    }

                    swFeature = selectionMgr.GetSelectedObject6(1, -1);
                    swFeature.Select2(false, 4); //create selection for pattern
                    append = true;
                }


                CreatePattern(helper, append, SwModel, swFeature, selectionMgr);
            }

            #endregion

            #region                              // make prismatic B keyseat

            if (seatingType == seating_types[2]) //Prismatic B
            {
                W = seatingWidth;                //Width

                helper.select_feature("RefPlane", 1, false, 0);
                SwModel.CreatePlaneAtOffset(P1.y, false);
                sketchManager.InsertSketch(true);
                sketchManager.CreateSketchSlot((int)swSketchSlotCreationType_e.swSketchSlotCreationType_line,
                                               (int)swSketchSlotLengthType_e.swSketchSlotLengthType_CenterCenter, W, L - seatingLength, 0, 0, L, 0,
                                               0,
                                               0, 0, 0, 1, false);
                SwModel.FeatureManager.FeatureCut3(true, false, false, 0, 0, seatingDepth, 0,
                                                   false, false, false, false, 0, 0, false, false, false, false, false, true, true, true, true,
                                                   false, 0, 0, false);

                if (seatingOpearationType != operations_types[0]) // add chamfer or fillet, if none or value is 0 - pass
                {
                    swFeature  = (Feature)selectionMgr.GetSelectedObject6(1, -1);
                    facesArray = (Array)swFeature.GetFaces();
                    ent        = facesArray.GetValue(0) as Entity;
                    ent.Select4(false, null);

                    if (seatingOpearationType == operations_types[1])
                    {
                        featureManager.InsertFeatureChamfer(4, 1,
                                                            seatingChamferFilletValue, helper.ToRad(45), 0, 0, 0, 0);
                    }
                    if (seatingOpearationType == operations_types[2])
                    {
                        SwModel.FeatureManager.FeatureFillet(195, seatingChamferFilletValue, 0,
                                                             0, null, null, null);
                    }


                    swFeature = selectionMgr.GetSelectedObject6(1, -1);
                    swFeature.Select2(false, 4); //create selection for pattern
                    append = true;
                }


                CreatePattern(helper, append, SwModel, swFeature, selectionMgr);
            }

            #endregion

            #region                              // make segmented seatkey

            if (seatingType == seating_types[3]) //Segmented
            {
                helper.select_feature("RefPlane", 0, false, 0);
                sketchManager.InsertSketch(true);
                sketchManager.Create3PointArc(L - seatingLength, P1.y, 0, L, P1.y, 0, x_center, (P1.y - seatingDepth), 0);
                sketchManager.CreateLine(L - seatingLength, P1.y, 0, L, P1.y, 0); //close sketsh
                SwModel.FeatureManager.FeatureCut3(true, false, false, 6, 0, (seatingWidth), 0,
                                                   false, false, false, false, 0, 0, false, false, false, false, false, true, true, true, true,
                                                   false, 0, 0, false); //cut from mide plane

                if (SeatingOpearationType != operations_types[0])       // add chamfer or fillet, if nono or value is 0 - pass
                {
                    // select edges for chamfering or filleting
                    swFeature  = (Feature)selectionMgr.GetSelectedObject6(1, -1);
                    facesArray = (Array)swFeature.GetFaces();
                    SelectData selectData = selectionMgr.CreateSelectData();
                    ent = facesArray.GetValue(2) as Entity;
                    ent.Select4(false, selectData);
                    face2      = selectionMgr.GetSelectedObject6(1, -1);
                    edgesArray = (Array)face2.GetEdges();
                    ent        = edgesArray.GetValue(0) as Entity;
                    ent.Select4(false, null);
                    ent = edgesArray.GetValue(2) as Entity;
                    ent.Select4(true, null);
                    // select edges for chamfering or filleting
                    //  MessageBox.Show("" + face2.GetEdgeCount());

                    if (seatingOpearationType == operations_types[1])
                    {
                        featureManager.InsertFeatureChamfer(4, 1, seatingChamferFilletValue, helper.ToRad(45), 0, 0, 0,
                                                            0);
                    }

                    if (seatingOpearationType == operations_types[2])
                    {
                        SwModel.FeatureManager.FeatureFillet(195, seatingChamferFilletValue, 0, 0, null, null, null);
                    }


                    swFeature = selectionMgr.GetSelectedObject6(1, -1);
                    swFeature.Select2(false, 4); //create selection for pattern
                    append = true;
                }

                CreatePattern(helper, append, SwModel, swFeature, selectionMgr);
            }

            #endregion

            helper.HidePlanes();
        }