public static void setThicknessFisso(PartDocument oDoc, string parametro)
        {
            SheetMetalComponentDefinition oCompDef = (SheetMetalComponentDefinition)oDoc.ComponentDefinition;

            string toSelect = parametro;

            if (!string.IsNullOrEmpty(toSelect))
            {
                SheetMetalStyle oStyle = oCompDef.SheetMetalStyles[toSelect];
                oStyle.Activate();
            }
            else
            {
                throw new Exception("Nessuno spessore trovato");
            }
        }
Esempio n. 2
0
        public static void setThickness(PartDocument oDoc)
        {
            SheetMetalComponentDefinition oCompDef = (SheetMetalComponentDefinition)oDoc.ComponentDefinition;

            Face biggestFace = getBiggestFace(oDoc);

            double thikness = Math.Round(getDistanceFromFace(biggestFace) * 100) / 100;
            //int count = 0;

            //foreach (Edge e in oCompDef.SurfaceBodies[1].Edges)
            //{
            //    double distance = Math.Round(iApp.MeasureTools.GetMinimumDistance(e.StartVertex.Point, e.StopVertex.Point) * 100);

            //    if (e.GeometryType == CurveTypeEnum.kLineSegmentCurve && distance != 0 && distance <= 50)
            //    {
            //        coloroEntita(oDoc, 255,0,0, e);
            //        thikness = Math.Truncate(distance / 10);
            //        count++;
            //    }
            //}

            string toSelect = null;

            switch (thikness)
            {
            case 0.6:
                toSelect = "Aluminium THK 0.6mm";
                break;

            case 0.8:
                toSelect = "Aluminium THK 0.8mm";
                break;

            case 1.0:
                toSelect = "Aluminium THK 1.0mm";
                break;

            case 1.2:
                toSelect = "Aluminium THK 1.2mm";
                break;

            case 1.5:
                toSelect = "Aluminium THK 1.5mm";
                break;

            case 2.0:
                toSelect = "Aluminium THK 2.0mm";
                break;

            case 2.5:
                toSelect = "Aluminium THK 2.5mm";
                break;

            case 3.0:
                toSelect = "Aluminium THK 3.0mm";
                break;

            case 4.0:
                toSelect = "Aluminium THK 4.0mm";
                break;

            case 5.0:
                toSelect = "Aluminium THK 5.0mm";
                break;

            default:
                //toSelect = "Default_mm";
                Console.WriteLine("SONO ENTRATO IN DEFAULT");
                break;
            }

            if (!string.IsNullOrEmpty(toSelect))
            {
                SheetMetalStyle oStyle = oCompDef.SheetMetalStyles[toSelect];
                oStyle.Activate();
            }
            else
            {
                throw new Exception("Nessuno spessore trovato");
            }
        }
        // ! Imposta thickness
        public static void setThickness(PartDocument oDoc)
        {
            SheetMetalComponentDefinition oCompDef = (SheetMetalComponentDefinition)oDoc.ComponentDefinition;

            Face biggestFace = getBiggestFace(oDoc);

            double thikness = Math.Round(getDistanceFromFace(biggestFace) * 10) / 10;

            string toSelect = null;

            switch (thikness)
            {
            case 0.6:
                toSelect = "Aluminium THK 0.6mm";
                break;

            case 0.8:
                toSelect = "Aluminium THK 0.8mm";
                break;

            case 1.0:
                toSelect = "Aluminium THK 1.0mm";
                break;

            case 1.2:
                toSelect = "Aluminium THK 1.2mm";
                break;

            case 1.5:
                toSelect = "Aluminium THK 1.5mm";
                break;

            case 2.0:
                toSelect = "Aluminium THK 2.0mm";
                break;

            case 2.5:
                toSelect = "Aluminium THK 2.5mm";
                break;

            case 3.0:
                toSelect = "Aluminium THK 3.0mm";
                break;

            case 4.0:
                toSelect = "Aluminium THK 4.0mm";
                break;

            case 5.0:
                toSelect = "Aluminium THK 5.0mm";
                break;

            default:
                //toSelect = "Default_mm";
                Console.WriteLine("SONO ENTRATO IN DEFAULT");
                break;
            }

            if (!string.IsNullOrEmpty(toSelect))
            {
                SheetMetalStyle oStyle = oCompDef.SheetMetalStyles[toSelect];
                oStyle.Activate();
            }
            else
            {
                throw new Exception("Nessuno spessore trovato");
            }
        }