Пример #1
0
        public void ErzeugeKreis(Double r)
        {
            hsp_catiaProfil.set_Name("Kreis");
            Factory2D catFactory2D1 = hsp_catiaProfil.OpenEdition();

            Point2D  catPoint2D1  = catFactory2D1.CreatePoint(0, 0);
            Circle2D catcircle2D1 = catFactory2D1.CreateClosedCircle(0.000000, 0.000000, r);

            catcircle2D1.CenterPoint = catPoint2D1;

            hsp_catiaProfil.CloseEdition();
            hsp_catiaPart.Part.Update();
        }
Пример #2
0
        public void ErzeugeProfil(Double h, Double b)
        {
            hsp_catiaProfil.set_Name("Rechteck");
            Factory2D catFactory2D1 = hsp_catiaProfil.OpenEdition();

            Point2D catPoint2D1 = catFactory2D1.CreatePoint(0, h);
            Point2D catPoint2D2 = catFactory2D1.CreatePoint(b, h);
            Point2D catPoint2D3 = catFactory2D1.CreatePoint(b, 0);
            Point2D catPoint2D4 = catFactory2D1.CreatePoint(0, 0);

            Line2D catLine2D1 = catFactory2D1.CreateLine(0, h, b, h);

            catLine2D1.StartPoint = catPoint2D1;
            catLine2D1.EndPoint   = catPoint2D2;

            Line2D catLine2D2 = catFactory2D1.CreateLine(b, h, b, 0);

            catLine2D2.StartPoint = catPoint2D2;
            catLine2D2.EndPoint   = catPoint2D3;

            Line2D catLine2D3 = catFactory2D1.CreateLine(b, 0, 0, 0);

            catLine2D3.StartPoint = catPoint2D3;
            catLine2D3.EndPoint   = catPoint2D4;

            Line2D catLine2D4 = catFactory2D1.CreateLine(0, 0, 0, h);

            catLine2D4.StartPoint = catPoint2D4;
            catLine2D4.EndPoint   = catPoint2D1;

            hsp_catiaProfil.CloseEdition();
            hsp_catiaPart.Part.Update();
        }
Пример #3
0
        public void ErzeugeProfil(Double r)
        {
            // Skizze umbenennen
            hsp_catiaProfil.set_Name("Grundfläche Schaft");

            // Kreis in Skizze einzeichnen
            // Skizze oeffnen
            Factory2D catFactory2D1 = hsp_catiaProfil.OpenEdition();


            // erst die Punkte
            Point2D catPoint2D1 = catFactory2D1.CreatePoint(0, 0);


            // dann den Kreis
            Circle2D catCircle2D_1 = catFactory2D1.CreateCircle(0, 0, r, 0, 0);

            catCircle2D_1.CenterPoint = catPoint2D1;



            // Skizzierer verlassen
            hsp_catiaProfil.CloseEdition();
            // Part aktualisieren
            hsp_catiaPart.Part.Update();
        }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            INFITF.Application catia; //add the reference - catia v5 infiit interface...

            try
            {
                //열려 있는 catia가져오기
                catia = (INFITF.Application)Marshal.GetActiveObject("CATIA.Application");
            }
            catch (Exception)
            {
                //catia 실행하기
                catia         = (INFITF.Application)Activator.CreateInstance(Type.GetTypeFromProgID("CATIA.Application"));
                catia.Visible = true;
            }

            MECMOD.PartDocument prtDoc = (MECMOD.PartDocument)catia.Documents.Add("Part");
            MECMOD.Part         prt    = prtDoc.Part;
            MECMOD.Bodies       bdys   = prt.Bodies;
            MECMOD.Body         bdy    = bdys.Add();
            MECMOD.Sketches     skts   = bdy.Sketches;

            INFITF.Reference xypln = (INFITF.Reference)prt.OriginElements.PlaneXY;
            MECMOD.Sketch    skt   = skts.Add(xypln);

            MECMOD.Factory2D fac2d = skt.OpenEdition();

            Point2D p1 = fac2d.CreatePoint(10, 10);
            Point2D p2 = fac2d.CreatePoint(10, 40);
            Point2D p3 = fac2d.CreatePoint(40, 40);
            Point2D p4 = fac2d.CreatePoint(40, 10);
            Point2D p5 = fac2d.CreatePoint(30, 20);
            Point2D p6 = fac2d.CreatePoint(20, 5);

            Line2D linLft = fac2d.CreateLine(10, 10, 10, 40);
            Line2D linTop = fac2d.CreateLine(10, 40, 40, 40);
            Line2D linRgt = fac2d.CreateLine(40, 40, 40, 10);

            object[] parry = { p1, p6, p5, p4 };
            Spline2D spl   = fac2d.CreateSpline(parry);

            linLft.StartPoint = p1;
            linLft.EndPoint   = p2;
            linRgt.StartPoint = p3;
            linRgt.EndPoint   = p4;
            linTop.StartPoint = p2;
            linTop.EndPoint   = p3;

            MECMOD.Constraint cnst = skt.Constraints.AddBiEltCst(CatConstraintType.catCstTypeAxisPerpendicularity, (INFITF.Reference)linLft, (INFITF.Reference)linTop);

            /*
             * INFITF.Reference r1 = prt.CreateReferenceFromGeometry(linLft);
             * INFITF.Reference r2 = prt.CreateReferenceFromGeometry(linTop);
             * MECMOD.Constraint cnst1 = skt.Constraints.AddBiEltCst(CatConstraintType.catCstTypeAxisPerpendicularity, r1, r2);
             */
            skt.CloseEdition();

            prt.Update();
        }
Пример #5
0
        internal void ErstelleFaseProfil(object[] ParameterListe)
        {
            // Listen Werte wieder in richtige Datentypen umwandeln
            int    Kopf                 = Convert.ToInt32(ParameterListe[0]);
            double Durchmesser          = Convert.ToDouble(ParameterListe[1]);
            double Gewindelänge         = Convert.ToDouble(ParameterListe[2]);
            double Schaftlänge          = Convert.ToDouble(ParameterListe[3]);
            double Steigung             = Convert.ToDouble(ParameterListe[4]);
            int    Gewindeart           = Convert.ToInt32(ParameterListe[5]);
            double Schlüsselweite       = Convert.ToDouble(ParameterListe[6]);
            double Kopfhöhe             = Convert.ToDouble(ParameterListe[7]);
            double Kopfdurchmesser      = Convert.ToDouble(ParameterListe[8]);
            int    SchraubenrichtungInt = Convert.ToInt32(ParameterListe[9]);

            double Gesamtlänge = Gewindelänge + Schaftlänge + Kopfhöhe;
            Double P           = Steigung;
            Double Ri          = Durchmesser / 2;

            hsp_catiaPart.Part.InWorkObject = hsp_catiaProfil_Fase;
            hsp_catiaProfil_Fase.set_Name("Fase");

            double H_links = Ri;
            double V_links = Gesamtlänge - 0.65 * P;

            double H_rechts = Ri;
            double V_rechts = Gesamtlänge;

            double H_unten = Ri - 0.65 * P;
            double V_unten = Gesamtlänge;

            Factory2D catFactory2D3 = hsp_catiaProfil_Fase.OpenEdition();

            Point2D links  = catFactory2D3.CreatePoint(H_links, V_links);
            Point2D rechts = catFactory2D3.CreatePoint(H_rechts, V_rechts);
            Point2D unten  = catFactory2D3.CreatePoint(H_unten, V_unten);

            Line2D Oben = catFactory2D3.CreateLine(H_links, V_links, H_rechts, V_rechts);

            Oben.StartPoint = links;
            Oben.EndPoint   = rechts;

            Line2D hypo = catFactory2D3.CreateLine(H_links, V_links, H_unten, V_unten);

            hypo.StartPoint = links;
            hypo.EndPoint   = unten;

            Line2D seite = catFactory2D3.CreateLine(H_unten, V_unten, H_rechts, V_rechts);

            seite.StartPoint = unten;
            seite.EndPoint   = rechts;



            hsp_catiaProfil_Fase.CloseEdition();
            hsp_catiaPart.Part.Update();
        }
Пример #6
0
        //Hier beginnen RechteckProfile


        //RechteckVoll!
        //Erzeugen der Geometrie RechteckVoll
        internal void ErzeugeProfilRechteckVoll(RechteckVoll rechteckVoll)
        {
            hspB1_catia_Profil.set_Name("Rechteck_Voll");
            Factory2D factory2D = hspB1_catia_Profil.OpenEdition();

            //Setzen der Punkte
            Point2D catPoint2D1 = factory2D.CreatePoint(-rechteckVoll.Breite / 2, rechteckVoll.Höhe / 2);
            Point2D catPoint2D2 = factory2D.CreatePoint(rechteckVoll.Breite / 2, rechteckVoll.Höhe / 2);
            Point2D catPoint2D3 = factory2D.CreatePoint(rechteckVoll.Breite / 2, -rechteckVoll.Höhe / 2);
            Point2D catPoint2D4 = factory2D.CreatePoint(-rechteckVoll.Breite / 2, -rechteckVoll.Höhe / 2);

            //Linie Horrizontal Oben
            Line2D catLine2D1 = factory2D.CreateLine(-rechteckVoll.Breite / 2, rechteckVoll.Höhe / 2, rechteckVoll.Breite / 2, rechteckVoll.Höhe / 2);

            catLine2D1.StartPoint = catPoint2D1;
            catLine2D1.EndPoint   = catPoint2D2;

            //Linie Vertikal Rechts
            Line2D catLine2D2 = factory2D.CreateLine(rechteckVoll.Breite / 2, rechteckVoll.Höhe / 2, rechteckVoll.Breite / 2, -rechteckVoll.Höhe / 2);

            catLine2D2.StartPoint = catPoint2D2;
            catLine2D2.EndPoint   = catPoint2D3;


            //Linie Horizontal Unten
            Line2D catLine2D3 = factory2D.CreateLine(rechteckVoll.Breite / 2, -rechteckVoll.Höhe / 2, -rechteckVoll.Breite / 2, -rechteckVoll.Höhe / 2);

            catLine2D3.StartPoint = catPoint2D3;
            catLine2D3.EndPoint   = catPoint2D4;

            //Linie Vertikal Links
            Line2D catLine2D4 = factory2D.CreateLine(-rechteckVoll.Breite / 2, rechteckVoll.Höhe / 2, -rechteckVoll.Breite / 2, -rechteckVoll.Höhe / 2);

            catLine2D4.StartPoint = catPoint2D4;
            catLine2D4.EndPoint   = catPoint2D1;

            // Skizzierer verlassen
            hspB1_catia_Profil.CloseEdition();


            // Part aktualisieren
            hspB1_catiaPart.Part.Update();
        }
        public void setMittelpunkt(double a, double i)
        {
            // Skizze umbenennen
            hsp_catiaProfil.set_Name("Kreis");

            // Rechteck in Skizze einzeichnen
            // Skizze oeffnen
            Factory2D catFactory2D1 = hsp_catiaProfil.OpenEdition();
            Factory2D catFactory2D2 = hsp_catiaProfil.OpenEdition();

            // Kreis erzeugen
            // erst die Punkte


            Circle2D circle2D = catFactory2D1.CreateCircle(0, 0, i, 0, 0);
            Circle2D circle3D = catFactory2D2.CreateCircle(0, 0, a, 0, 0);

            // Skizzierer verlassen
            hsp_catiaProfil.CloseEdition();
            // Part aktualisieren
            hsp_catiaPart.Part.Update();
        }
Пример #8
0
        public void ErzeugeProfil(object sender, RoutedEventArgs e)
        {
            // Skizze umbenennen
            hsp_catiaProfil.set_Name("Rechteck");

            // Rechteck in Skizze einzeichnen
            // Skizze oeffnen
            Factory2D catFactory2D1 = hsp_catiaProfil.OpenEdition();
            double hoeheRechteck = Convert.ToDouble(
            // Rechteck erzeugen
            Point2D catPoint2D1 = catFactory2D1.CreatePoint();
            Line2D catLine2D1 = catFactory2D1.CreateLine();
        }
Пример #9
0
        public void ErzeugeProfilRechteck(Double Breite, Double Hoehe, Double Laenge)
        {
            // Werte aus Variblen verarbeiten
            Double HalbeBreite = Breite / 2;
            Double HalbeHöhe   = Hoehe / 2;

            // Skizze umbenennen
            hsp_catiaProfil.set_Name("Rechteck");

            // Rechteck in Skizze einzeichnen
            // Skizze oeffnen
            Factory2D catFactory2D1 = hsp_catiaProfil.OpenEdition();

            // Rechteck erzeugen

            // erst die Punkte
            Point2D catPoint2D1 = catFactory2D1.CreatePoint(-HalbeBreite, HalbeHöhe);
            Point2D catPoint2D2 = catFactory2D1.CreatePoint(HalbeBreite, HalbeHöhe);
            Point2D catPoint2D3 = catFactory2D1.CreatePoint(HalbeBreite, -HalbeHöhe);
            Point2D catPoint2D4 = catFactory2D1.CreatePoint(-HalbeBreite, -HalbeHöhe);

            // dann die Linien
            Line2D catLine2D1 = catFactory2D1.CreateLine(-HalbeBreite, HalbeHöhe, HalbeBreite, HalbeHöhe);

            catLine2D1.StartPoint = catPoint2D1;
            catLine2D1.EndPoint   = catPoint2D2;

            Line2D catLine2D2 = catFactory2D1.CreateLine(HalbeBreite, HalbeHöhe, HalbeBreite, -HalbeHöhe);

            catLine2D2.StartPoint = catPoint2D2;
            catLine2D2.EndPoint   = catPoint2D3;

            Line2D catLine2D3 = catFactory2D1.CreateLine(HalbeBreite, -HalbeHöhe, -HalbeBreite, -HalbeHöhe);

            catLine2D3.StartPoint = catPoint2D3;
            catLine2D3.EndPoint   = catPoint2D4;

            Line2D catLine2D4 = catFactory2D1.CreateLine(-HalbeBreite, -HalbeHöhe, -HalbeBreite, HalbeHöhe);

            catLine2D4.StartPoint = catPoint2D4;
            catLine2D4.EndPoint   = catPoint2D1;

            // Skizzierer verlassen
            hsp_catiaProfil.CloseEdition();

            // Part aktualisieren
            hsp_catiaPart.Part.Update();
        }
        public void ErzeugeProfil(int z, double b, double m, double p, double c, double df, double hf, double h, double ha, double da)
        {
            //                                                Punkte
            //Nullpunkte
            double x0     = 0;
            double y0     = 0;
            double radius = 20;

            //Startpunkte
            double StartPkt_Fußkreis_x  = x0;
            double StartPkt_Fußkreis_y  = df / 2;
            double StartPkt_Kopfkreis_x = x0;
            double StartPkt_Kopfkreis_y = da / 2;
            //Endpunkte
            double EndPkt_Kopfkreis_x = p / 2;
            double EndPkt_Kopfkreis_y = da / 2;
            double EndPkt_Fußkreis_x  = p / 2;
            double EndPkt_Fußkreis_y  = df / 2;
            //Winkelpunkt
            double Alpha           = z / 2 * Math.PI;
            double EndPkt_Radius_x = Math.Sin(90 * Math.PI / 180 - Alpha) * df / 2;
            double EndPkt_Radius_y = Math.Cos(90 * Math.PI / 180 - Alpha) * df / 2;



            Factory2D catFactory2D1 = hsp_catiaProfil.OpenEdition();

            Point2D catP2D_MPkt_Radius = catFactory2D1.CreatePoint(x0, y0);

            Point2D catP2D_StartPkt_Fußkreis  = catFactory2D1.CreatePoint(StartPkt_Fußkreis_x, StartPkt_Fußkreis_y);
            Point2D catP2D_StartPkt_Kopfkreis = catFactory2D1.CreatePoint(StartPkt_Kopfkreis_x, StartPkt_Kopfkreis_y);
            Point2D catP2D_EndPkt_Kopfkreis   = catFactory2D1.CreatePoint(EndPkt_Kopfkreis_x, EndPkt_Kopfkreis_y);
            Point2D catP2D_EndPkt_Fußkreis    = catFactory2D1.CreatePoint(EndPkt_Fußkreis_x, EndPkt_Fußkreis_y);
            Point2D catP2D_EndPkt_Radius      = catFactory2D1.CreatePoint(EndPkt_Radius_x, EndPkt_Radius_y);


            //                                               Linien

            Line2D catLine2D1 = catFactory2D1.CreateLine(StartPkt_Fußkreis_x, StartPkt_Fußkreis_y, StartPkt_Kopfkreis_x, StartPkt_Kopfkreis_y);
            Line2D catLine2D2 = catFactory2D1.CreateLine(StartPkt_Kopfkreis_x, StartPkt_Kopfkreis_y, EndPkt_Kopfkreis_x, EndPkt_Kopfkreis_y);
            Line2D catLine2D3 = catFactory2D1.CreateLine(EndPkt_Kopfkreis_x, EndPkt_Kopfkreis_y, EndPkt_Fußkreis_x, EndPkt_Fußkreis_y);
            //  Line2D catLine2D4 = catFactory2D1.CreateLine(EndPkt_Fußkreis_x, EndPkt_Fußkreis_y,EndPkt_Radius_x, EndPkt_Radius_y);

            Circle2D catC2D_Fußkreis = catFactory2D1.CreateCircle(catP2D_MPkt_Radius, radius);

            // Skizzierer verlassen
            hsp_catiaProfil.CloseEdition();
            // Part aktualisieren
            hsp_catiaPart.Part.Update();
        }
Пример #11
0
        public void Kreis_DrawSketch(double KreisDurchmesser)
        {
            double d = KreisDurchmesser;

            CATIA_Kreis2D.set_Name("Kreisprofil");

            Factory2D KreisFactory = CATIA_Kreis2D.OpenEdition();

            // Definition des Kreises
            Circle2D KreisSketch = KreisFactory.CreateCircle(0, 0, (d / 2), 0, 0);

            CATIA_Kreis2D.CloseEdition();

            CATIA_KreisPart.Part.Update();
        }
Пример #12
0
        public void Kreis_hohl_DrawSketch(double KreisDurchmesser, double Wandstaerke)
        {
            double d  = KreisDurchmesser;
            double t  = Wandstaerke;
            double di = (d / 2) - t;

            CATIA_Kreis_hohl_2D.set_Name("Kreis-Hohlprofil");

            Factory2D Kreis_hohl_Factory = CATIA_Kreis_hohl_2D.OpenEdition();

            // Definition der Kreise
            Circle2D OuterCircle = Kreis_hohl_Factory.CreateCircle(0, 0, (d / 2), 0, 0);
            Circle2D InnerCircle = Kreis_hohl_Factory.CreateCircle(0, 0, di, 0, 0);

            CATIA_Kreis_hohl_2D.CloseEdition();

            CATIA_Kreis_hohl_Part.Part.Update();
        }
Пример #13
0
        private void ProfilSchaft(object[] ParameterListe)
        {
            double Durchmesser = Convert.ToDouble(ParameterListe[1]);

            // Skizze umbenennen
            hsp_catiaProfil_Schaft.set_Name("Schaft");

            // Skizze oeffnen
            Factory2D catFactory2D2 = hsp_catiaProfil_Schaft.OpenEdition();


            Circle2D circle2DSchaft = catFactory2D2.CreateClosedCircle(0, 0, Durchmesser / 2);

            // Skizzierer verlassen
            hsp_catiaProfil_Schaft.CloseEdition();
            // Part aktualisieren
            hsp_catiaPart.Part.Update();
        }
Пример #14
0
        internal void SkizzeZylinder(Schraube arr)
        {
            part_Schraube = hsp_catiaPartDoc.Part;
            Bodies bodies = part_Schraube.Bodies;

            body_Schraube = part_Schraube.MainBody;

            part_Schraube.InWorkObject = part_Schraube.MainBody;

            // hsp_catiaPartDoc.Part.InWorkObject = hsp_catiaPartDoc.Part.MainBody;   eventuell überflüssig
            hsp_catiaSkizze.set_Name("Zylinder");

            // Bearbeitungsumgebung der Skizze Öffnen
            Factory2D catfactory2D1 = hsp_catiaSkizze.OpenEdition();

            Circle2D Zylinder1 = catfactory2D1.CreateClosedCircle(0, 0, 0.5 * arr.durchmesser);

            hsp_catiaSkizze.CloseEdition();
        }
Пример #15
0
        public void ErzeugeProfil(Double b, Double h)
        {
            // Skizze umbenennen
            hsp_catiaProfil.set_Name("Rechteck");

            // Rechteck in Skizze einzeichnen
            // Skizze oeffnen
            Factory2D catFactory2D1 = hsp_catiaProfil.OpenEdition();

            // Rechteck erzeugen

            // erst die Punkte
            Point2D catPoint2D1 = catFactory2D1.CreatePoint(-25, 25);
            Point2D catPoint2D2 = catFactory2D1.CreatePoint(25, 25);
            Point2D catPoint2D3 = catFactory2D1.CreatePoint(25, -25);
            Point2D catPoint2D4 = catFactory2D1.CreatePoint(-25, -25);

            // dann die Linien
            Line2D catLine2D1 = catFactory2D1.CreateLine(-25, 25, 25, 25);

            catLine2D1.StartPoint = catPoint2D1;
            catLine2D1.EndPoint   = catPoint2D2;

            Line2D catLine2D2 = catFactory2D1.CreateLine(25, 25, 25, -25);

            catLine2D2.StartPoint = catPoint2D2;
            catLine2D2.EndPoint   = catPoint2D3;

            Line2D catLine2D3 = catFactory2D1.CreateLine(25, -25, -25, -25);

            catLine2D3.StartPoint = catPoint2D3;
            catLine2D3.EndPoint   = catPoint2D4;

            Line2D catLine2D4 = catFactory2D1.CreateLine(-25, -25, -25, 25);

            catLine2D4.StartPoint = catPoint2D4;
            catLine2D4.EndPoint   = catPoint2D1;

            // Skizzierer verlassen
            hsp_catiaProfil.CloseEdition();
            // Part aktualisieren
            hsp_catiaPart.Part.Update();
        }
        public void ErzeugeProfil(double breitedreieck, double hoehedreieck)
        {
            // Skizze umbenennen
            hsp_catiaProfil.set_Name("Dreieck");

            // Dreieck in Skizze einzeichnen
            // Skizze oeffnen
            Factory2D catFactory2D1 = hsp_catiaProfil.OpenEdition();

            // Dreieck erzeugen
            Point2D catPoint2D1 = catFactory2D1.CreatePoint(0, hoehedreieck);
            Point2D catPoint2D2 = catFactory2D1.CreatePoint(0, hoehedreieck);
            Point2D catPoint2D3 = catFactory2D1.CreatePoint(breitedreieck / 2, 0);
            Point2D catPoint2D4 = catFactory2D1.CreatePoint(-breitedreieck / 2, 0);

            Line2D catLine2D1 = catFactory2D1.CreateLine(0, hoehedreieck, 0, hoehedreieck);

            catLine2D1.StartPoint = catPoint2D1;
            catLine2D1.EndPoint   = catPoint2D2;

            Line2D catLine2D2 = catFactory2D1.CreateLine(0, Math.Sqrt(Math.Pow(hoehedreieck, 4)), breitedreieck / 2, 0);

            catLine2D2.StartPoint = catPoint2D2;
            catLine2D2.EndPoint   = catPoint2D3;

            Line2D catLine2D3 = catFactory2D1.CreateLine(breitedreieck / 2, 0, -breitedreieck / 2, 0);

            catLine2D3.StartPoint = catPoint2D3;
            catLine2D3.EndPoint   = catPoint2D4;

            Line2D catLine2D4 = catFactory2D1.CreateLine(-breitedreieck / 2, 0, 0, Math.Sqrt(Math.Pow(hoehedreieck, 4)));

            catLine2D4.StartPoint = catPoint2D4;
            catLine2D4.EndPoint   = catPoint2D1;

            // Skizzierer verlassen
            hsp_catiaProfil.CloseEdition();
            // Part aktualisieren
            hsp_catiaPart.Part.Update();
        }
Пример #17
0
        public void Rechteck_DrawSketch(double RechteckBreite, double RechteckHoehe)
        {
            double b = RechteckBreite;
            double h = RechteckHoehe;

            CATIA_Rechteck2D.set_Name("Rechteckprofil");

            Factory2D RechteckFactory = CATIA_Rechteck2D.OpenEdition();

            // Definition der Eckpunkte
            Point2D Rechteck_Eckpunkt1 = RechteckFactory.CreatePoint(0, 0);
            Point2D Rechteck_Eckpunkt2 = RechteckFactory.CreatePoint(b, 0);
            Point2D Rechteck_Eckpunkt3 = RechteckFactory.CreatePoint(b, h);
            Point2D Rechteck_Eckpunkt4 = RechteckFactory.CreatePoint(0, h);

            // Definition der Linien
            Line2D RechteckLinie1 = RechteckFactory.CreateLine(0, 0, b, 0);

            RechteckLinie1.StartPoint = Rechteck_Eckpunkt1;
            RechteckLinie1.EndPoint   = Rechteck_Eckpunkt2;

            Line2D RechteckLinie2 = RechteckFactory.CreateLine(b, 0, b, h);

            RechteckLinie2.StartPoint = Rechteck_Eckpunkt2;
            RechteckLinie2.EndPoint   = Rechteck_Eckpunkt3;

            Line2D RechteckLinie3 = RechteckFactory.CreateLine(b, h, 0, h);

            RechteckLinie3.StartPoint = Rechteck_Eckpunkt3;
            RechteckLinie3.EndPoint   = Rechteck_Eckpunkt4;

            Line2D RechteckLinie4 = RechteckFactory.CreateLine(0, 0, 0, h);

            RechteckLinie4.StartPoint = Rechteck_Eckpunkt1;
            RechteckLinie4.EndPoint   = Rechteck_Eckpunkt4;

            CATIA_Rechteck2D.CloseEdition();

            CATIA_RechteckPart.Part.Update();
        }
Пример #18
0
        public void ErzeugeProfil(double längequadrat)
        {
            // Skizze umbenennen
            hsp_catiaProfil.set_Name("Quadrat");

            // quadrat in Skizze einzeichnen
            // Skizze oeffnen
            Factory2D catFactory2D1 = hsp_catiaProfil.OpenEdition();

            // Quadrat erzeugen
            Point2D catPoint2D1 = catFactory2D1.CreatePoint(-längequadrat / 2, längequadrat / 2);
            Point2D catPoint2D2 = catFactory2D1.CreatePoint(längequadrat / 2, längequadrat / 2);
            Point2D catPoint2D3 = catFactory2D1.CreatePoint(längequadrat / 2, -längequadrat / 2);
            Point2D catPoint2D4 = catFactory2D1.CreatePoint(-längequadrat / 2, -längequadrat / 2);

            Line2D catLine2D1 = catFactory2D1.CreateLine(-längequadrat / 2, längequadrat / 2, längequadrat / 2, längequadrat / 2);

            catLine2D1.StartPoint = catPoint2D1;
            catLine2D1.EndPoint   = catPoint2D2;

            Line2D catLine2D2 = catFactory2D1.CreateLine(längequadrat / 2, längequadrat / 2, längequadrat / 2, -längequadrat / 2);

            catLine2D2.StartPoint = catPoint2D2;
            catLine2D2.EndPoint   = catPoint2D3;

            Line2D catLine2D3 = catFactory2D1.CreateLine(längequadrat / 2, -längequadrat / 2, -längequadrat / 2, -längequadrat / 2);

            catLine2D3.StartPoint = catPoint2D3;
            catLine2D3.EndPoint   = catPoint2D4;

            Line2D catLine2D4 = catFactory2D1.CreateLine(-längequadrat / 2, -längequadrat / 2, -längequadrat / 2, längequadrat / 2);

            catLine2D4.StartPoint = catPoint2D4;
            catLine2D4.EndPoint   = catPoint2D1;

            // Skizzierer verlassen
            hsp_catiaProfil.CloseEdition();
            // Part aktualisieren
            hsp_catiaPart.Part.Update();
        }
Пример #19
0
    public void ErzeugeRechteckprofil(string currentItemName, double[] parameterListe)
    {
        //  ()  <--breite-->     b

        double b = parameterListe[0];
        double h = parameterListe[1];

        //double e = parameterListe[2];
        //double f = parameterListe[3];

        // Skizze umbenennen
        hsp_catiaProfil.set_Name(currentItemName);
        // Skizze oeffnen
        Factory2D catFactory2D1 = hsp_catiaProfil.OpenEdition();
        // erst die Punkte
        Point2D catPoint2D1 = catFactory2D1.CreatePoint(-b / 2, h / 2);
        Point2D catPoint2D2 = catFactory2D1.CreatePoint(b / 2, h / 2);
        Point2D catPoint2D3 = catFactory2D1.CreatePoint(b / 2, -h / 2);
        Point2D catPoint2D4 = catFactory2D1.CreatePoint(-b / 2, -h / 2);
        // dann die Linien
        Line2D catLine2D1 = catFactory2D1.CreateLine(-b / 2, h / 2, b / 2, h / 2);

        catLine2D1.StartPoint = catPoint2D1;
        catLine2D1.EndPoint   = catPoint2D2;

        Line2D catLine2D2 = catFactory2D1.CreateLine(b / 2, h / 2, b / 2, -h / 2);

        catLine2D2.StartPoint = catPoint2D2;
        catLine2D2.EndPoint   = catPoint2D3;

        Line2D catLine2D3 = catFactory2D1.CreateLine(b / 2, -h / 2, -b / 2, -h / 2);

        catLine2D3.StartPoint = catPoint2D3;
        catLine2D3.EndPoint   = catPoint2D4;

        Line2D catLine2D4 = catFactory2D1.CreateLine(-b / 2, -h / 2, -b / 2, h / 2);

        catLine2D4.StartPoint = catPoint2D4;
        catLine2D4.EndPoint   = catPoint2D1;

        // Skizzierer verlassen
        hsp_catiaProfil.CloseEdition();
        // Part aktualisieren
        hsp_catiaPart.Part.Update();
    }
Пример #20
0
        public void SonderT_DrawSketch(double SonderT_Breite, double SonderT_Hoehe, double Flanschbreite, double Stegbreite)
        {
            double b = SonderT_Breite;
            double h = SonderT_Hoehe;
            double f = Flanschbreite;
            double s = Stegbreite;

            double alpha = Math.Atan(0.02);

            double upperDelta = Math.Tan(alpha) * (b / 4);
            double lowerDelta = Math.Tan(alpha) * (h / 2);

            double delta = h - f + Math.Tan(alpha) * (b / 4);
            double phi   = (b / 2) - (s / 2) + (Math.Tan(alpha) * (h / 2));

            double x = (delta - Math.Tan((Math.PI / 2) - alpha) * phi) / (Math.Tan(alpha) - Math.Tan((Math.PI / 2) - alpha));
            double y = ((-1) * Math.Tan(alpha)) * x + delta;

            CATIA_SonderT_2D.set_Name("T-Profil");

            Factory2D SonderT_Factory = CATIA_SonderT_2D.OpenEdition();

            // Definition der Geometrie
            Point2D Konturpunkt1 = SonderT_Factory.CreatePoint(0, h);
            Point2D Konturpunkt2 = SonderT_Factory.CreatePoint(b, h);
            Point2D Konturpunkt3 = SonderT_Factory.CreatePoint(b, (h - f + upperDelta));
            Point2D Konturpunkt4 = SonderT_Factory.CreatePoint((b - x), y);
            Point2D Konturpunkt5 = SonderT_Factory.CreatePoint(((b / 2) + (s / 2) - (lowerDelta)), 0);
            Point2D Konturpunkt6 = SonderT_Factory.CreatePoint(((b / 2) - (s / 2) + (lowerDelta)), 0);
            Point2D Konturpunkt7 = SonderT_Factory.CreatePoint(x, y);
            Point2D Konturpunkt8 = SonderT_Factory.CreatePoint(0, (h - f + upperDelta));

            Line2D Linie12 = SonderT_Factory.CreateLine(0, h, b, h);

            Linie12.StartPoint = Konturpunkt1;
            Linie12.EndPoint   = Konturpunkt2;

            Line2D Linie23 = SonderT_Factory.CreateLine(b, h, b, (h - f + upperDelta));

            Linie23.StartPoint = Konturpunkt2;
            Linie23.EndPoint   = Konturpunkt3;

            Line2D Linie34 = SonderT_Factory.CreateLine(b, (h - f + upperDelta), (b - x), y);

            Linie34.StartPoint = Konturpunkt3;
            Linie34.EndPoint   = Konturpunkt4;

            Line2D Linie45 = SonderT_Factory.CreateLine((b - x), y, ((b / 2) + (s / 2) - (lowerDelta)), 0);

            Linie45.StartPoint = Konturpunkt4;
            Linie45.EndPoint   = Konturpunkt5;

            Line2D Linie56 = SonderT_Factory.CreateLine(((b / 2) + (s / 2) - (lowerDelta)), 0, ((b / 2) - (s / 2) + (lowerDelta)), 0);

            Linie56.StartPoint = Konturpunkt5;
            Linie56.EndPoint   = Konturpunkt6;

            Line2D Linie67 = SonderT_Factory.CreateLine(((b / 2) - (s / 2) + (lowerDelta)), 0, x, y);

            Linie67.StartPoint = Konturpunkt6;
            Linie67.EndPoint   = Konturpunkt7;

            Line2D Linie78 = SonderT_Factory.CreateLine(x, y, 0, (h - f + upperDelta));

            Linie78.StartPoint = Konturpunkt7;
            Linie78.EndPoint   = Konturpunkt8;

            Line2D Linie81 = SonderT_Factory.CreateLine(0, (h - f + upperDelta), 0, h);

            Linie81.StartPoint = Konturpunkt8;
            Linie81.EndPoint   = Konturpunkt1;

            CATIA_SonderT_2D.CloseEdition();

            CATIA_SonderT_Part.Part.Update();
        }
Пример #21
0
        private void button1_Click(object sender, EventArgs e)
        {
            INFITF.Application Catia;


            try
            {
                Catia = (INFITF.Application)Marshal.GetActiveObject("CATIA.Application");
            }


            catch
            {
                Catia         = (INFITF.Application)Activator.CreateInstance(Type.GetTypeFromProgID("CATIA.Application"));
                Catia.Visible = true;
            }
            INFITF.Documents Docts = Catia.Documents;

            MECMOD.PartDocument PrtDoc = (MECMOD.PartDocument)Docts.Add("Part");

            MECMOD.Part Prt = PrtDoc.Part;

            MECMOD.Bodies Bodis = Prt.Bodies;

            MECMOD.Body PartBody = Bodis.Item(1);

            MECMOD.Body Body = Bodis.Add();

            MECMOD.Sketches Skts = Body.Sketches;


            INFITF.Reference plane = (INFITF.Reference)Prt.OriginElements.PlaneXY;

            MECMOD.Sketch Skt = Skts.Add(plane);

            MECMOD.Factory2D Fac2D = Skt.OpenEdition();



            Point2D Pt1 = Fac2D.CreatePoint(50, 50);
            Point2D Pt2 = Fac2D.CreatePoint(50, 100);
            Point2D Pt3 = Fac2D.CreatePoint(100, 100);
            Point2D Pt4 = Fac2D.CreatePoint(100, 50);


            //  <<  Create Line >>
            Line2D Lin1 = Fac2D.CreateLine(50, 50, 50, 100);

            Line2D Lin2 = Fac2D.CreateLine(50, 100, 100, 100);

            Line2D Lin3 = Fac2D.CreateLine(100, 100, 100, 50);

            Line2D Lin4 = Fac2D.CreateLine(100, 50, 50, 50);

            //     Line2D Lin22 = MCreateLine(Fac2d, Pt1, Pt2);



            //라인의 시작점부터 마지막점을 결정

            Lin1.StartPoint = Pt1;
            Lin1.EndPoint   = Pt2;
            Lin2.StartPoint = Pt2;
            Lin2.EndPoint   = Pt3;
            Lin3.StartPoint = Pt3;
            Lin3.EndPoint   = Pt4;
            Lin4.StartPoint = Pt4;
            Lin4.EndPoint   = Pt1;

            INFITF.Reference rline1 = Prt.CreateReferenceFromGeometry(Lin1);
            INFITF.Reference rline2 = Prt.CreateReferenceFromGeometry(Lin2);
            INFITF.Reference rline3 = Prt.CreateReferenceFromGeometry(Lin3);
            INFITF.Reference rline4 = Prt.CreateReferenceFromGeometry(Lin4);
            INFITF.Reference rlineH = Prt.CreateReferenceFromGeometry(Skt.AbsoluteAxis.HorizontalReference);
            INFITF.Reference rlineV = Prt.CreateReferenceFromGeometry(Skt.AbsoluteAxis.VerticalReference);

            MECMOD.Constraint d1 = Skt.Constraints.AddBiEltCst(CatConstraintType.catCstTypeDistance, rline1, rline3);
            MECMOD.Constraint d2 = Skt.Constraints.AddBiEltCst(CatConstraintType.catCstTypeDistance, rline2, rline4);
            MECMOD.Constraint d3 = Skt.Constraints.AddBiEltCst(CatConstraintType.catCstTypeDistance, rlineH, rline4);
            MECMOD.Constraint d4 = Skt.Constraints.AddBiEltCst(CatConstraintType.catCstTypeDistance, rlineV, rline1);

            Skt.CloseEdition();//Skech조건 끝 //

            //PAD를 하기 위해서 조건문을 만든다.//
            PARTITF.ShapeFactory ShpFac = (PARTITF.ShapeFactory)Prt.ShapeFactory;
            //그 shapeFactory를 돌출하기 위해서 AddNewPad를 사용해서 50만큼 돌출한다.//
            ShpFac.AddNewPad(Skt, 50);



            //새로운 Body2를 만들기 //
            MECMOD.Body Body2 = Bodis.Add();
            //planed을 기준으로 Skt2를 만든다.//
            MECMOD.Sketch Skt2 = (MECMOD.Sketch)Body2.Sketches.Add(plane);
            //스켓이 시작 //
            Fac2D = Skt2.OpenEdition();
            //  X=75,Y=75 를 중심으로 D=20의  원을  만들기//
            Circle2D Cir2D = Fac2D.CreateClosedCircle(75, 75, 20);

            //스켓을 끝내기//
            Skt2.CloseEdition();
            //PAD  80만큼 //
            ShpFac.AddNewPad(Skt2, 80);

            //Body3 만들기 //
            Body Body3 = Prt.Bodies.Add();
            //Skt3를 Body2 안에 plane면을 기준으로  Sketche를 한다.
            Sketch Skt3 = Body2.Sketches.Add(plane);

            //스킷을 시작//
            Fac2D = Skt3.OpenEdition();
            //  X=75,Y=75 를 중심으로 D=5의  원을  만들기//
            Fac2D.CreateClosedCircle(75, 75, 5);
            //스켓3을 끝내기//
            Skt3.CloseEdition();
            //스켓3을 80만큼 PAD를 한다.
            ShpFac.AddNewPad(Skt3, 80);
            /////////////////
            //PartBody에 Prat In Work Object를 사용해서 조건을 만든다.
            Prt.InWorkObject = PartBody;

            ShpFac.AddNewAdd(Body);     //PartBody에 Body를추가
            ShpFac.AddNewAdd(Body2);    //PartBody에 Body2를추가
            ShpFac.AddNewRemove(Body3); //PartBody에 Body3를 제거한다


            Prt.Update();
        }
Пример #22
0
        public void SonderU_DrawSketch(double SonderU_Breite, double SonderU_Hoehe, double Flanschbreite, double Stegbreite)
        {
            double b = SonderU_Breite;
            double h = SonderU_Hoehe;
            double f = Flanschbreite;
            double s = Stegbreite;

            double c;   // Hilfsmaß zur Bemaßung am abgeschrägten Flansch
            double alpha;

            if (h <= 300)
            {
                c = 0.5 * b;
            }
            else
            {
                c = 0.5 * (b - s);
            }

            if (h > 300)
            {
                alpha = Math.Atan(0.05);
            }
            else
            {
                alpha = Math.Atan(0.08);
            }

            double outerDelta = Math.Tan(alpha) * c;    // Berechnung des Versatzmaßes der Schrägenkonturpunkte
            double innerDelta = Math.Tan(alpha) * (b - c - s);

            CATIA_SonderU_2D.set_Name("U-Profil");

            Factory2D SonderU_Factory = CATIA_SonderU_2D.OpenEdition();

            // Definition der Geometrie
            Point2D Konturpunkt1 = SonderU_Factory.CreatePoint(0, 0);
            Point2D Konturpunkt2 = SonderU_Factory.CreatePoint(b, 0);
            Point2D Konturpunkt3 = SonderU_Factory.CreatePoint(b, (f - outerDelta));
            Point2D Konturpunkt4 = SonderU_Factory.CreatePoint(s, (f + innerDelta));
            Point2D Konturpunkt5 = SonderU_Factory.CreatePoint(s, (h - f - innerDelta));
            Point2D Konturpunkt6 = SonderU_Factory.CreatePoint(b, (h - f + outerDelta));
            Point2D Konturpunkt7 = SonderU_Factory.CreatePoint(b, h);
            Point2D Konturpunkt8 = SonderU_Factory.CreatePoint(0, h);

            Line2D Linie12 = SonderU_Factory.CreateLine(0, 0, b, 0);

            Linie12.StartPoint = Konturpunkt1;
            Linie12.EndPoint   = Konturpunkt2;

            Line2D Linie23 = SonderU_Factory.CreateLine(b, 0, b, (f - outerDelta));

            Linie23.StartPoint = Konturpunkt2;
            Linie23.EndPoint   = Konturpunkt3;

            Line2D Linie34 = SonderU_Factory.CreateLine(b, (f - outerDelta), s, (f + innerDelta));

            Linie34.StartPoint = Konturpunkt3;
            Linie34.EndPoint   = Konturpunkt4;

            Line2D Linie45 = SonderU_Factory.CreateLine(s, (f + innerDelta), s, (h - f - innerDelta));

            Linie45.StartPoint = Konturpunkt4;
            Linie45.EndPoint   = Konturpunkt5;

            Line2D Linie56 = SonderU_Factory.CreateLine(s, (h - f - innerDelta), b, (h - f + outerDelta));

            Linie56.StartPoint = Konturpunkt5;
            Linie56.EndPoint   = Konturpunkt6;

            Line2D Linie67 = SonderU_Factory.CreateLine(b, (h - f + outerDelta), b, h);

            Linie67.StartPoint = Konturpunkt6;
            Linie67.EndPoint   = Konturpunkt7;

            Line2D Linie78 = SonderU_Factory.CreateLine(b, h, 0, h);

            Linie78.StartPoint = Konturpunkt7;
            Linie78.EndPoint   = Konturpunkt8;

            Line2D Linie81 = SonderU_Factory.CreateLine(0, h, 0, 0);

            Linie81.StartPoint = Konturpunkt8;
            Linie81.EndPoint   = Konturpunkt1;

            CATIA_SonderU_2D.CloseEdition();

            CATIA_SonderU_Part.Part.Update();
        }
Пример #23
0
        public void erstelleSkizzenElemente()
        {
            Factory2D fact2D = hsp_catiaProfil.OpenEdition();

            // Eckpunkte erstellen

            Console.Write("Vertikale Länge Außen : ");
            double dL1 = Convert.ToDouble(Console.ReadLine());

            Console.Write("Horizontale Länge Außen : ");
            double dL2 = Convert.ToDouble(Console.ReadLine());

            Point2D P1 = fact2D.CreatePoint(dL2 / 2, dL1 / 2);
            Point2D P2 = fact2D.CreatePoint(dL2 / 2, -dL1 / 2);
            Point2D P3 = fact2D.CreatePoint(-dL2 / 2, -dL1 / 2);
            Point2D P4 = fact2D.CreatePoint(-dL2 / 2, dL1 / 2);

            Line2D L1 = fact2D.CreateLine(dL2 / 2, dL1 / 2, dL2 / 2, -dL1 / 2);
            Line2D L2 = fact2D.CreateLine(dL2 / 2, -dL1 / 2, -dL2 / 2, -dL1 / 2);
            Line2D L3 = fact2D.CreateLine(-dL2 / 2, -dL1 / 2, -dL2 / 2, dL1 / 2);
            Line2D L4 = fact2D.CreateLine(-dL2 / 2, dL1 / 2, dL2 / 2, dL1 / 2);

            L1.StartPoint = P1;
            L1.EndPoint   = P2;

            L2.StartPoint = P2;
            L2.EndPoint   = P3;

            L3.StartPoint = P3;
            L3.EndPoint   = P4;

            L4.StartPoint = P4;
            L4.EndPoint   = P1;


            Console.Write("Vertikale Länge Innen : ");
            double dL3 = Convert.ToDouble(Console.ReadLine());

            Console.Write("Horizontale Länge Innen : ");
            double dL4 = Convert.ToDouble(Console.ReadLine());

            Point2D P5 = fact2D.CreatePoint(dL4 / 2, dL3 / 2);
            Point2D P6 = fact2D.CreatePoint(dL4 / 2, -dL3 / 2);
            Point2D P7 = fact2D.CreatePoint(-dL4 / 2, -dL3 / 2);
            Point2D P8 = fact2D.CreatePoint(-dL4 / 2, dL3 / 2);

            Line2D L5 = fact2D.CreateLine(dL4 / 2, dL3 / 2, dL4 / 2, -dL3 / 2);
            Line2D L6 = fact2D.CreateLine(dL4 / 2, -dL3 / 2, -dL4 / 2, -dL3 / 2);
            Line2D L7 = fact2D.CreateLine(-dL4 / 2, -dL3 / 2, -dL4 / 2, dL3 / 2);
            Line2D L8 = fact2D.CreateLine(-dL4 / 2, dL3 / 2, dL4 / 2, dL3 / 2);

            L5.StartPoint = P5;
            L5.EndPoint   = P6;

            L6.StartPoint = P6;
            L6.EndPoint   = P7;

            L7.StartPoint = P7;
            L7.EndPoint   = P8;

            L8.StartPoint = P8;
            L8.EndPoint   = P5;


            hsp_catiaProfil.CloseEdition();

            hsp_catiaPart.Part.Update();
        }
Пример #24
0
        public void Stirnzahnrad(MainWindow.Außenverzahnung av)
        {
            //Profil Erstellen

            //Nullpunkt
            double x0 = 0;
            double y0 = 0;

            //Hilfsgrößen
            double Teilkreisradius   = av.d / 2;
            double Hilfskreisradius  = Teilkreisradius * 0.94;
            double Fußkreisradius    = Teilkreisradius - (1.25 * av.m);
            double Kopfkreisradius   = Teilkreisradius + av.m;
            double Verrundungsradius = 0.35 * av.m;

            double Alpha         = 2;
            double Alpharad      = Math.PI * Alpha / 180;
            double Beta          = 140 / av.z;
            double Betarad       = Math.PI * Beta / 180;
            double Gamma         = 90 - (Alpha - Beta);
            double Gammarad      = Math.PI * Gamma / 180;
            double Totalangel    = 360.0 / av.z;
            double Totalangelrad = Math.PI * Totalangel / 180;


            //Punkte
            //Kopfkreis
            double xKopfkreis = -Kopfkreisradius *Math.Sin(Alpharad);

            double yKopfkreis = Kopfkreisradius * Math.Cos(Alpharad);

            //Fußkreis
            double xFußkreis = -Fußkreisradius *Math.Sin(Betarad);

            double yFußkreis = Fußkreisradius * Math.Cos(Betarad);

            //Koordinaten Anfangspunkt Fußkreis
            double Hilfswinkel            = Totalangelrad - Math.Atan(Math.Abs(xFußkreis) / Math.Abs(yFußkreis));
            double x_AnfangspunktFußkreis = Fußkreisradius * Math.Sin(Hilfswinkel);
            double y_AnfangspunktFußkreis = Fußkreisradius * Math.Cos(Hilfswinkel);

            //Skizze umbenennen und öffnen
            hsp_catiaProfil.set_Name("Zahnradskizze");
            Factory2D catfactory2D1 = hsp_catiaProfil.OpenEdition();

            //Nun die Punkte in die Skizze
            Point2D point_Ursprung          = catfactory2D1.CreatePoint(x0, y0);
            Point2D point_KopfkreisLinks    = catfactory2D1.CreatePoint(xKopfkreis, yKopfkreis);
            Point2D point_FußkreisLinks     = catfactory2D1.CreatePoint(xFußkreis, yFußkreis);
            Point2D point_KopfkreisRechts   = catfactory2D1.CreatePoint(-xKopfkreis, yKopfkreis);
            Point2D point_FußkreisRechts    = catfactory2D1.CreatePoint(-xFußkreis, yFußkreis);
            Point2D point_AnfangspunktLinks = catfactory2D1.CreatePoint(-x_AnfangspunktFußkreis, y_AnfangspunktFußkreis);

            //Linien
            Line2D line_FußkreisKopfkreis = catfactory2D1.CreateLine(xFußkreis, yFußkreis, xKopfkreis, yKopfkreis);

            line_FußkreisKopfkreis.StartPoint = point_FußkreisLinks;
            line_FußkreisKopfkreis.EndPoint   = point_KopfkreisLinks;

            Line2D line_KopfkreisFußkreis = catfactory2D1.CreateLine(-xKopfkreis, yKopfkreis, -xFußkreis, yFußkreis);

            line_KopfkreisFußkreis.StartPoint = point_KopfkreisRechts;
            line_KopfkreisFußkreis.EndPoint   = point_FußkreisRechts;


            //Kreise
            Circle2D circle_KopfkreisLinksRechts = catfactory2D1.CreateCircle(x0, y0, Kopfkreisradius, 0, Math.PI * 2);

            circle_KopfkreisLinksRechts.CenterPoint = point_Ursprung;
            circle_KopfkreisLinksRechts.EndPoint    = point_KopfkreisLinks;
            circle_KopfkreisLinksRechts.StartPoint  = point_KopfkreisRechts;

            Circle2D circle_AnfangFußkreis = catfactory2D1.CreateCircle(x0, x0, Fußkreisradius, 0, Math.PI * 2);

            circle_AnfangFußkreis.CenterPoint = point_Ursprung;
            circle_AnfangFußkreis.EndPoint    = point_AnfangspunktLinks;
            circle_AnfangFußkreis.StartPoint  = point_FußkreisLinks;

            hsp_catiaProfil.CloseEdition();

            hsp_catiaPart.Part.Update();


            //Profilerstellen Ende

            //Kreismuster

            ShapeFactory       SF  = (ShapeFactory)hsp_catiaPart.Part.ShapeFactory;
            HybridShapeFactory HSF = (HybridShapeFactory)hsp_catiaPart.Part.HybridShapeFactory;
            Part myPart            = hsp_catiaPart.Part;

            Factory2D             Factory2D2  = hsp_catiaProfil.Factory2D;
            HybridShapePointCoord Ursprung    = HSF.AddNewPointCoord(0, 0, 0);
            Reference             RefUrsprung = myPart.CreateReferenceFromObject(Ursprung);
            HybridShapeDirection  XDir        = HSF.AddNewDirectionByCoord(1, 0, 0);
            Reference             RefXDir     = myPart.CreateReferenceFromObject(XDir);

            CircPattern Kreismuster = SF.AddNewSurfacicCircPattern(Factory2D2, 1, 2, 0, 0, 1, 1, RefUrsprung, RefXDir, false, 0, true, false);

            Kreismuster.CircularPatternParameters = CatCircularPatternParameters.catInstancesandAngularSpacing;
            AngularRepartition angularRepartition1 = Kreismuster.AngularRepartition;
            Angle angle1 = angularRepartition1.AngularSpacing;

            angle1.Value = Convert.ToDouble(360 / Convert.ToDouble(av.z));
            AngularRepartition angularRepartition2 = Kreismuster.AngularRepartition;
            IntParam           intParam1           = angularRepartition2.InstancesCount;

            intParam1.Value = Convert.ToInt32(av.z) + 1;

            Reference           Ref_Kreismuster = myPart.CreateReferenceFromObject(Kreismuster);
            HybridShapeAssemble Verbindung      = HSF.AddNewJoin(Ref_Kreismuster, Ref_Kreismuster);
            Reference           Ref_Verbindung  = myPart.CreateReferenceFromObject(Verbindung);

            HSF.GSMVisibility(Ref_Verbindung, 0);
            myPart.Update();
            Bodies bodies = myPart.Bodies;
            Body   myBody = bodies.Add();

            myBody.set_Name("Zahnrad");
            myBody.InsertHybridShape(Verbindung);
            myPart.Update();

            myPart.InWorkObject = myBody;
            Pad myPad = SF.AddNewPadFromRef(Ref_Verbindung, av.t);

            myPart.Update();


            //Bohrung
            Reference RefBohrung1       = hsp_catiaPart.Part.CreateReferenceFromBRepName("FSur:(Face:(Brp:(Pad.1;2);None:();Cf11:());WithTemporaryBody;WithoutBuildError;WithInitialFeatureSupport;MonoFond;MFBRepVersion_CXR15)", myPad);
            Hole      catBohrung1       = SF.AddNewHoleFromPoint(0, 0, 0, RefBohrung1, 0);
            Length    catLengthBohrung1 = catBohrung1.Diameter;

            catLengthBohrung1.Value = Convert.ToDouble(av.d / 2);

            hsp_catiaPart.Part.Update();
        }
Пример #25
0
        public void Stirnzahnrad(Außenverzahnung av)
        {
            //Profil erstellen
            //Nullpunkt
            double x0 = 0;
            double y0 = 0;

            //Hilfsgrößen
            double Teilkreisradius   = av.d / 2;
            double Hilfskreisradius  = Teilkreisradius * 0.94;
            double Fußkreisradius    = Teilkreisradius - (1.25 * av.m);
            double Kopfkreisradius   = Teilkreisradius + av.m;
            double Verrundungsradius = 0.35 * av.m;

            double Alpha         = 20;
            double Beta          = 90 / av.z;
            double Betarad       = Math.PI * Beta / 180;
            double Gamma         = 90 - (Alpha - Beta);
            double Gammarad      = Math.PI * Gamma / 180;
            double Totalangel    = 360.0 / av.z;
            double Totalangelrad = Math.PI + Totalangel / 180;

            //Punkte erzeugen
            //Kleiner Kreis
            double xMittelpunktaufEvol_links = Hilfskreisradius * Math.Cos(Gammarad);
            double yMittelpunktaufEvol_links = Hilfskreisradius * Math.Sin(Gammarad);

            //Schnittpunkt auf Evolvente und Teilkreisradius
            double xPunktaufEvolvente = -Teilkreisradius *Math.Sin(Betarad);

            double yPunktaufEvolvente = Teilkreisradius * Math.Cos(Betarad);

            //Evolventenkreis Radius
            double EvolventenkreisRadius = Math.Sqrt(Math.Pow((xMittelpunktaufEvol_links - xPunktaufEvolvente), 2) + Math.Pow((yMittelpunktaufEvol_links - yPunktaufEvolvente), 2));

            //Koordinaten Schnittpunkt Kopfkreis und Evolventenkreis
            double xEvolventenkopfkreis_links = Schnittpunkt_X(x0, y0, Kopfkreisradius, xMittelpunktaufEvol_links, yMittelpunktaufEvol_links, EvolventenkreisRadius);
            double yEvolventenkopfkreis_links = Schnittpunkt_Y(x0, y0, Kopfkreisradius, xMittelpunktaufEvol_links, yMittelpunktaufEvol_links, EvolventenkreisRadius);

            //Mittelpunktkoordinaten Verrundung
            double xMittelpunktVerrundung_links = Schnittpunkt_X(x0, y0, Fußkreisradius + Verrundungsradius, xMittelpunktaufEvol_links, yMittelpunktaufEvol_links, EvolventenkreisRadius + Verrundungsradius);
            double yMittelpunktVerrundung_links = Schnittpunkt_Y(x0, y0, Fußkreisradius + Verrundungsradius, xMittelpunktaufEvol_links, yMittelpunktaufEvol_links, EvolventenkreisRadius + Verrundungsradius);

            //Schnittpunktkoordinaten Verrundung - Evolventenkreis
            double x_SP_EvolventeVerrundung_links = Schnittpunkt_X(xMittelpunktaufEvol_links, yMittelpunktaufEvol_links, EvolventenkreisRadius, xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius);
            double y_SP_EvolventeVerrundung_links = Schnittpunkt_Y(xMittelpunktaufEvol_links, yMittelpunktaufEvol_links, EvolventenkreisRadius, xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius);

            //Schnittpunktkoordinaten Verrundung - Fußkreis
            double x_SP_FußkreisradiusVerrundung_links = Schnittpunkt_X(x0, y0, Fußkreisradius, xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius);
            double y_SP_FußkreisradiusVerrundung_links = Schnittpunkt_Y(x0, y0, Fußkreisradius, xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius);

            //Koordinaten Anfangspunkt Fußkreis
            double Hilfswinkel            = Totalangelrad - Math.Atan(Math.Abs(x_SP_FußkreisradiusVerrundung_links) / Math.Abs(y_SP_FußkreisradiusVerrundung_links));
            double x_AnfangspunktFußkreis = -Fußkreisradius *Math.Sin(Hilfswinkel);

            double y_AnfangspunktFußkreis = Fußkreisradius * Math.Cos(Hilfswinkel);

            //Ende

            //Skizze umbenennen
            hsp_catiaProfil.set_Name("Zahnrad-Test");
            Factory2D catfactory2D1 = hsp_catiaProfil.OpenEdition();

            //Punkte in Skizze
            Point2D point_Ursprung                   = catfactory2D1.CreatePoint(x0, y0);
            Point2D pointAnfangFußkreisLinks         = catfactory2D1.CreatePoint(x_AnfangspunktFußkreis, y_AnfangspunktFußkreis);
            Point2D pointFußkreisVerrundungLinks     = catfactory2D1.CreatePoint(x_SP_FußkreisradiusVerrundung_links, y_SP_FußkreisradiusVerrundung_links);
            Point2D pointFußkreisVerrundungRechts    = catfactory2D1.CreatePoint(-x_SP_FußkreisradiusVerrundung_links, y_SP_FußkreisradiusVerrundung_links);
            Point2D pointMittelpunktVerrundungLinks  = catfactory2D1.CreatePoint(xMittelpunktVerrundung_links, yMittelpunktVerrundung_links);
            Point2D pointMittelpunktVerrundungRechts = catfactory2D1.CreatePoint(-xMittelpunktVerrundung_links, yMittelpunktVerrundung_links);
            Point2D pointVerrundungEvolventeLinks    = catfactory2D1.CreatePoint(x_SP_EvolventeVerrundung_links, y_SP_EvolventeVerrundung_links);
            Point2D pointVerrundungEvolventeRechts   = catfactory2D1.CreatePoint(-x_SP_EvolventeVerrundung_links, y_SP_EvolventeVerrundung_links);
            Point2D pointMittelpunktevolventeLinks   = catfactory2D1.CreatePoint(xMittelpunktaufEvol_links, xMittelpunktaufEvol_links);
            Point2D pointMittelpunktevolventeRechts  = catfactory2D1.CreatePoint(-xMittelpunktaufEvol_links, yMittelpunktaufEvol_links);
            Point2D pointEvolventenKopfkreisLinks    = catfactory2D1.CreatePoint(xEvolventenkopfkreis_links, yEvolventenkopfkreis_links);
            Point2D pointEvolventenKopfkreisRechts   = catfactory2D1.CreatePoint(-xEvolventenkopfkreis_links, yEvolventenkopfkreis_links);

            //Kreise
            Circle2D KreisFußkreis = catfactory2D1.CreateCircle(x0, y0, Fußkreisradius, 0, Math.PI * 2);

            KreisFußkreis.CenterPoint = point_Ursprung;
            KreisFußkreis.StartPoint  = pointFußkreisVerrundungLinks;
            KreisFußkreis.EndPoint    = pointAnfangFußkreisLinks;

            Circle2D KreisVerrundungLinks = catfactory2D1.CreateCircle(xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius, 0, Math.PI * 2);

            KreisVerrundungLinks.CenterPoint = pointMittelpunktVerrundungLinks;
            KreisVerrundungLinks.StartPoint  = pointFußkreisVerrundungLinks;
            KreisVerrundungLinks.EndPoint    = pointVerrundungEvolventeLinks;

            Circle2D KreisEvolventenkreisLinks = catfactory2D1.CreateCircle(xMittelpunktaufEvol_links, yMittelpunktaufEvol_links, EvolventenkreisRadius, 0, Math.PI * 2);

            KreisEvolventenkreisLinks.CenterPoint = pointMittelpunktevolventeLinks;
            KreisEvolventenkreisLinks.StartPoint  = pointEvolventenKopfkreisLinks;
            KreisEvolventenkreisLinks.EndPoint    = pointVerrundungEvolventeLinks;

            Circle2D KreisKopfkreis = catfactory2D1.CreateCircle(x0, y0, Kopfkreisradius, 0, Math.PI * 2);

            KreisKopfkreis.CenterPoint = point_Ursprung;
            KreisKopfkreis.StartPoint  = pointEvolventenKopfkreisRechts;
            KreisKopfkreis.EndPoint    = pointEvolventenKopfkreisLinks;

            Circle2D KreisEvolventenkreisRechts = catfactory2D1.CreateCircle(-xMittelpunktaufEvol_links, yMittelpunktaufEvol_links, EvolventenkreisRadius, 0, Math.PI * 2);

            KreisEvolventenkreisRechts.CenterPoint = pointMittelpunktVerrundungRechts;
            KreisEvolventenkreisRechts.StartPoint  = pointVerrundungEvolventeRechts;
            KreisEvolventenkreisRechts.EndPoint    = pointEvolventenKopfkreisRechts;

            Circle2D KreisVerrundungRechts = catfactory2D1.CreateCircle(-xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius, 0, Math.PI * 2);

            KreisVerrundungRechts.CenterPoint = pointMittelpunktVerrundungRechts;
            KreisVerrundungRechts.StartPoint  = pointVerrundungEvolventeRechts;
            KreisVerrundungRechts.EndPoint    = pointFußkreisVerrundungRechts;

            //Skizzierer schließen
            hsp_catiaProfil.CloseEdition();

            //Aktualisieren
            hsp_catiaPart.Part.Update();



            //Kreismuster erstellen
            //Deklarierung
            ShapeFactory       SF  = (ShapeFactory)hsp_catiaPart.Part.ShapeFactory;
            HybridShapeFactory HSF = (HybridShapeFactory)hsp_catiaPart.Part.HybridShapeFactory;
            Part myPart            = hsp_catiaPart.Part;

            Factory2D             Factory2D1  = hsp_catiaProfil.Factory2D;
            HybridShapePointCoord Ursprung    = HSF.AddNewPointCoord(0, 0, 0);
            Reference             RefUrsprung = myPart.CreateReferenceFromObject(Ursprung);
            HybridShapeDirection  XDir        = HSF.AddNewDirectionByCoord(1, 0, 0);
            Reference             RefXDir     = myPart.CreateReferenceFromObject(XDir);

            //Kreismuster Daten ausfüllen
            CircPattern Kreismuster = SF.AddNewSurfacicCircPattern(Factory2D1, 1, 2, 0, 0, 1, 1, RefUrsprung, RefXDir, false, 0, true, false);

            Kreismuster.CircularPatternParameters = CatCircularPatternParameters.catInstancesandAngularSpacing;
            AngularRepartition angularRepartition1 = Kreismuster.AngularRepartition;
            Angle angle1 = angularRepartition1.AngularSpacing;

            angle1.Value = Convert.ToDouble(360 / Convert.ToDouble(av.z));
            AngularRepartition angularRepartition2 = Kreismuster.AngularRepartition;
            IntParam           intParam1           = angularRepartition2.InstancesCount;

            intParam1.Value = Convert.ToInt32(av.z) + 1;

            //geschlossene Kontur herstellen
            Reference           Ref_Kreismuster = myPart.CreateReferenceFromObject(Kreismuster);
            HybridShapeAssemble Verbindung      = HSF.AddNewJoin(Ref_Kreismuster, Ref_Kreismuster);
            Reference           Ref_Verbindung  = myPart.CreateReferenceFromObject(Verbindung);

            HSF.GSMVisibility(Ref_Verbindung, 0);
            myPart.Update();
            Bodies bodies = myPart.Bodies;
            Body   myBody = bodies.Add();

            myBody.set_Name("Zahnrad");
            myBody.InsertHybridShape(Verbindung);
            myPart.Update();
        }
        public void ErzeugeProfil(Data dat)
        {
            //Nullpunkt
            double x0 = 0;
            double y0 = 0;

            //Hilfsgrößen von Wilkos PDF
            double teilkreisradius   = dat.getTeilkreisdurchmesser() / 2;
            double hilfskreisradius  = teilkreisradius * 0.94;
            double fußkreisradius    = teilkreisradius - (1.25 * dat.getModul());
            double kopfkreisradius   = teilkreisradius + dat.getModul();
            double verrundungsradius = 0.35 * dat.getModul();

            double alpha         = 20;
            double beta          = 90 / dat.getZähnezahl();
            double betarad       = Math.PI * beta / 180;
            double gamma         = 90 - (alpha - beta);
            double gammarad      = Math.PI * gamma / 180;
            double totalangle    = 360.0 / dat.getZähnezahl();
            double totalanglerad = Math.PI * totalangle / 180;

            //Punkte
            //LinkerEvolKreis Mittelp. Koordinaten
            double mittelpunktEvol_x = hilfskreisradius * Math.Cos(gammarad);
            double mittelpunktEvol_y = hilfskreisradius * Math.Sin(gammarad);

            // Schnittpkt. auf Evolvente und Teilkreisradius
            double punktEvol_x = -teilkreisradius *Math.Sin(betarad);

            double punktEvol_y = teilkreisradius * Math.Cos(betarad);

            //Evolventenkreis Radius
            double EvolventenkreisRadius = Math.Sqrt(Math.Pow((mittelpunktEvol_x - punktEvol_x), 2) + Math.Pow((mittelpunktEvol_y - punktEvol_y), 2));

            //Koordinaten Schnittpunkt Kopfkreis und Evolventenkreis
            double evolventenKopfk_x = Schnittpunkt_X(x0, y0, kopfkreisradius, mittelpunktEvol_x, mittelpunktEvol_y, EvolventenkreisRadius);
            double evolventenKopfk_y = Schnittpunkt_Y(x0, y0, kopfkreisradius, mittelpunktEvol_x, mittelpunktEvol_y, EvolventenkreisRadius);

            //Mittelpunktkoordinaten Verrundung
            double mittelpunktVer_x = Schnittpunkt_X(x0, y0, fußkreisradius + verrundungsradius, mittelpunktEvol_x, mittelpunktEvol_y, EvolventenkreisRadius + verrundungsradius);
            double mittelpunktVer_y = Schnittpunkt_Y(x0, y0, fußkreisradius + verrundungsradius, mittelpunktEvol_x, mittelpunktEvol_y, EvolventenkreisRadius + verrundungsradius);

            //Schnittpubktkoordinaten Verrundung - Evolventenkreis
            double evolventenVer_x = Schnittpunkt_X(mittelpunktEvol_x, mittelpunktEvol_y, EvolventenkreisRadius, mittelpunktVer_x, mittelpunktVer_y, verrundungsradius);
            double evolventenVer_y = Schnittpunkt_Y(mittelpunktEvol_x, mittelpunktEvol_y, EvolventenkreisRadius, mittelpunktVer_x, mittelpunktVer_y, verrundungsradius);

            //Schnittpunktkoordinaten Verrundung - Fußkreis
            double fußkreisVer_x = Schnittpunkt_X(x0, y0, fußkreisradius, mittelpunktVer_x, mittelpunktVer_y, verrundungsradius);
            double fußkreisVer_y = Schnittpunkt_Y(x0, y0, fußkreisradius, mittelpunktVer_x, mittelpunktVer_y, verrundungsradius);

            //Koordinaten Anfangspunkt Fußkreis
            double hilfswinkel        = totalanglerad - Math.Atan(Math.Abs(fußkreisVer_x) / Math.Abs(fußkreisVer_y));
            double anfangspunktFußk_x = -fußkreisradius *Math.Sin(hilfswinkel);

            double anfangspunktFußk_y = fußkreisradius * Math.Cos(hilfswinkel);

            //Skizze umbenennen und öffnen
            hsp_catiaProfil.set_Name("Außenverzahntes Stirnrad");
            Factory2D catfactory2D1 = hsp_catiaProfil.OpenEdition();

            //Nun die Punkte in die Skizze
            Point2D point_Ursprung             = catfactory2D1.CreatePoint(x0, y0);
            Point2D pointAnfangFußkreis        = catfactory2D1.CreatePoint(anfangspunktFußk_x, anfangspunktFußk_y);
            Point2D pointFußkreisVer_l         = catfactory2D1.CreatePoint(fußkreisVer_x, fußkreisVer_y);
            Point2D pointFußkreisVer_r         = catfactory2D1.CreatePoint(-fußkreisVer_x, fußkreisVer_y);
            Point2D pointMittelpunktVer_l      = catfactory2D1.CreatePoint(mittelpunktVer_x, mittelpunktVer_y);
            Point2D pointMittelpunktVer_r      = catfactory2D1.CreatePoint(-mittelpunktVer_x, mittelpunktVer_y);
            Point2D pointVerrundungEvol_l      = catfactory2D1.CreatePoint(evolventenVer_x, evolventenVer_y);
            Point2D pointVerrundungEvol_r      = catfactory2D1.CreatePoint(-evolventenVer_x, evolventenVer_y);
            Point2D pointMittelpunktevol_l     = catfactory2D1.CreatePoint(mittelpunktEvol_x, mittelpunktEvol_y);
            Point2D pointMittelpunktevol_r     = catfactory2D1.CreatePoint(-mittelpunktEvol_x, mittelpunktEvol_y);
            Point2D pointEvolventenKopfkreis_l = catfactory2D1.CreatePoint(evolventenKopfk_x, evolventenKopfk_y);
            Point2D pointEvolventenKopfkreis_r = catfactory2D1.CreatePoint(-evolventenKopfk_x, evolventenKopfk_y);

            //Kreise
            Circle2D kreisFußkreis = catfactory2D1.CreateCircle(x0, y0, fußkreisradius, 0, Math.PI * 2);

            kreisFußkreis.CenterPoint = point_Ursprung;
            kreisFußkreis.StartPoint  = pointFußkreisVer_l;
            kreisFußkreis.EndPoint    = pointAnfangFußkreis;

            Circle2D kreisVerrundung_l = catfactory2D1.CreateCircle(mittelpunktVer_x, mittelpunktVer_y, verrundungsradius, 0, Math.PI * 2);

            kreisVerrundung_l.CenterPoint = pointMittelpunktVer_l;
            kreisVerrundung_l.StartPoint  = pointFußkreisVer_l;
            kreisVerrundung_l.EndPoint    = pointVerrundungEvol_l;

            Circle2D kreisEvolventenkreis_l = catfactory2D1.CreateCircle(mittelpunktEvol_x, mittelpunktEvol_y, EvolventenkreisRadius, 0, Math.PI * 2);

            kreisEvolventenkreis_l.CenterPoint = pointMittelpunktevol_l;
            kreisEvolventenkreis_l.StartPoint  = pointEvolventenKopfkreis_l;
            kreisEvolventenkreis_l.EndPoint    = pointVerrundungEvol_l;

            Circle2D kreisKopfkreis = catfactory2D1.CreateCircle(x0, y0, kopfkreisradius, 0, Math.PI * 2);

            kreisKopfkreis.CenterPoint = point_Ursprung;
            kreisKopfkreis.StartPoint  = pointEvolventenKopfkreis_r;
            kreisKopfkreis.EndPoint    = pointEvolventenKopfkreis_l;

            Circle2D kreisEvolventenkreis_r = catfactory2D1.CreateCircle(-mittelpunktEvol_x, mittelpunktEvol_y, EvolventenkreisRadius, 0, Math.PI * 2);

            kreisEvolventenkreis_r.CenterPoint = pointMittelpunktevol_r;
            kreisEvolventenkreis_r.StartPoint  = pointVerrundungEvol_r;
            kreisEvolventenkreis_r.EndPoint    = pointEvolventenKopfkreis_r;

            Circle2D kreisVerrundung_r = catfactory2D1.CreateCircle(-mittelpunktVer_x, mittelpunktVer_y, verrundungsradius, 0, Math.PI * 2);

            kreisVerrundung_r.CenterPoint = pointMittelpunktVer_r;
            kreisVerrundung_r.StartPoint  = pointVerrundungEvol_r;
            kreisVerrundung_r.EndPoint    = pointFußkreisVer_r;



            hsp_catiaProfil.CloseEdition();

            hsp_catiaPart.Part.Update();
        }
Пример #27
0
        public void ErzeugeProfil(Zahnrad Zahnrad1)
        {
            // geometrisches Set auswaehlen und umbenennen
            HybridBodies catHybridBodies1 = hsp_catiaPart.Part.HybridBodies;
            HybridBody   catHybridBody1;

            try
            {
                catHybridBody1 = catHybridBodies1.Item("Geometrisches Set.1");
            }
            catch (Exception)
            {
                MessageBox.Show("Kein geometrisches Set gefunden! " + Environment.NewLine +
                                "Ein PART manuell erzeugen und ein darauf achten, dass 'Geometisches Set' aktiviert ist.",
                                "Fehler", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            catHybridBody1.set_Name("Profile");
            // neue Skizze im ausgewaehlten geometrischen Set anlegen
            Sketches       catSketches1      = catHybridBody1.HybridSketches;
            OriginElements catOriginElements = hsp_catiaPart.Part.OriginElements;
            Reference      catReference1     = (Reference)catOriginElements.PlaneYZ;

            hsp_catiaProfil = catSketches1.Add(catReference1);

            // Achsensystem in Skizze erstellen
            ErzeugeAchsensystem();

            // Part aktualisieren
            hsp_catiaPart.Part.Update();

            //Nullpunkt
            double x0 = 0;
            double y0 = 0;

            //Hilfsgrößen von Wilkos PDF
            double Teilkreisradius   = Zahnrad1.d / 2;
            double Hilfskreisradius  = Teilkreisradius * 0.94;
            double Fußkreisradius    = Teilkreisradius - (1.25 * Zahnrad1.m);
            double Kopfkreisradius   = Teilkreisradius + Zahnrad1.m;
            double Verrundungsradius = 0.35 * Zahnrad1.m;

            double Alpha         = 20;
            double Beta          = 90 / Zahnrad1.z;
            double Betarad       = Math.PI * Beta / 180;
            double Gamma         = 90 - (Alpha - Beta);
            double Gammarad      = Math.PI * Gamma / 180;
            double Totalangel    = 360.0 / Zahnrad1.z;
            double Totalangelrad = Math.PI * Totalangel / 180;


            //Punkte
            //LinkerEvolKreis Mittelp. Koordinaten
            double xMPEvo_links = Hilfskreisradius * Math.Cos(Gammarad);
            double yMPEvo_links = Hilfskreisradius * Math.Sin(Gammarad);

            //Schnittpkt. auf Evolvente und Teilkreisradius
            double xPunktAufEvolvente = -Teilkreisradius *Math.Sin(Betarad);

            double yPunktAufEvolvente = Teilkreisradius * Math.Cos(Betarad);

            //Evolventenkreis Radius
            double EvolventenkreisRadius = Math.Sqrt(Math.Pow((xMPEvo_links - xPunktAufEvolvente), 2) + Math.Pow((yMPEvo_links - yPunktAufEvolvente), 2));

            //Koordinaten Schnittpunkt Kopfkreis und Evolventenkreis
            double xEvolventenkopfkreis_links = Schnittpunkt_X(x0, y0, Kopfkreisradius, xMPEvo_links, yMPEvo_links, EvolventenkreisRadius);
            double yEvolventenkopfkreis_links = Schnittpunkt_Y(x0, y0, Kopfkreisradius, xMPEvo_links, yMPEvo_links, EvolventenkreisRadius);

            //Mittelpunktkoordinaten Verrundung
            double xMittelpunktVerrundung_links = Schnittpunkt_X(x0, y0, Fußkreisradius + Verrundungsradius, xMPEvo_links, yMPEvo_links, EvolventenkreisRadius + Verrundungsradius);
            double yMittelpunktVerrundung_links = Schnittpunkt_Y(x0, y0, Fußkreisradius + Verrundungsradius, xMPEvo_links, yMPEvo_links, EvolventenkreisRadius + Verrundungsradius);

            //Schnittpubktkoordinaten Verrundung - Evolventenkreis
            double x_SP_EvolventeVerrundung_links = Schnittpunkt_X(xMPEvo_links, yMPEvo_links, EvolventenkreisRadius, xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius);
            double y_SP_EvolventeVerrundung_links = Schnittpunkt_Y(xMPEvo_links, yMPEvo_links, EvolventenkreisRadius, xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius);

            //Schnittpunktkoordinaten Verrundung - Fußkreis
            double x_SP_FußkreisradiusVerrundung_links = Schnittpunkt_X(x0, y0, Fußkreisradius, xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius);
            double y_SP_FußkreisradiusVerrundung_links = Schnittpunkt_Y(x0, y0, Fußkreisradius, xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius);

            //Koordinaten Anfangspunkt Fußkreis
            double Hilfswinkel            = Totalangelrad - Math.Atan(Math.Abs(x_SP_FußkreisradiusVerrundung_links) / Math.Abs(y_SP_FußkreisradiusVerrundung_links));
            double x_AnfangspunktFußkreis = Fußkreisradius * Math.Sin(Hilfswinkel);
            double y_AnfangspunktFußkreis = Fußkreisradius * Math.Cos(Hilfswinkel);

            //Skizze umbenennen und öffnen
            hsp_catiaProfil.set_Name("Zahnradskizze");
            Factory2D catfactory2D1 = hsp_catiaProfil.OpenEdition();

            //Nun die Punkte in die Skizze
            Point2D Ursprung = catfactory2D1.CreatePoint(x0, y0);
            Point2D EndpunktEvolventenkreis = catfactory2D1.CreatePoint(x_AnfangspunktFußkreis, y_AnfangspunktFußkreis);
            Point2D VerrundungLinksAnfang   = catfactory2D1.CreatePoint(x_SP_FußkreisradiusVerrundung_links, y_SP_FußkreisradiusVerrundung_links);
            Point2D VerrundungRechtsEnde    = catfactory2D1.CreatePoint(-x_SP_FußkreisradiusVerrundung_links, y_SP_FußkreisradiusVerrundung_links);
            Point2D MPVerrundungLinks       = catfactory2D1.CreatePoint(xMittelpunktVerrundung_links, yMittelpunktVerrundung_links);
            Point2D MPVerrundungRechts      = catfactory2D1.CreatePoint(-xMittelpunktVerrundung_links, yMittelpunktVerrundung_links);
            Point2D VerrundungEndeLinks     = catfactory2D1.CreatePoint(x_SP_EvolventeVerrundung_links, y_SP_EvolventeVerrundung_links);
            Point2D VerrundungAnfangRechts  = catfactory2D1.CreatePoint(-x_SP_EvolventeVerrundung_links, y_SP_EvolventeVerrundung_links);
            Point2D MPEvolventeLinks        = catfactory2D1.CreatePoint(xMPEvo_links, yMPEvo_links);
            Point2D MPEvolventeRechts       = catfactory2D1.CreatePoint(-xMPEvo_links, yMPEvo_links);
            Point2D EvolventenEndeLinks     = catfactory2D1.CreatePoint(xEvolventenkopfkreis_links, yEvolventenkopfkreis_links);
            Point2D EvolventenEndeRechts    = catfactory2D1.CreatePoint(-xEvolventenkopfkreis_links, yEvolventenkopfkreis_links);

            //Kreise

            Circle2D Fußkreis = catfactory2D1.CreateCircle(x0, y0, Fußkreisradius, 0, Math.PI * 2);

            Fußkreis.CenterPoint = Ursprung;
            Fußkreis.StartPoint  = EndpunktEvolventenkreis;
            Fußkreis.EndPoint    = VerrundungRechtsEnde;

            Circle2D VerrundungLinks = catfactory2D1.CreateCircle(xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius, 0, Math.PI * 2);

            VerrundungLinks.CenterPoint = MPVerrundungLinks;
            VerrundungLinks.StartPoint  = VerrundungLinksAnfang;
            VerrundungLinks.EndPoint    = VerrundungEndeLinks;

            Circle2D EvolventenkreisLinks = catfactory2D1.CreateCircle(xMPEvo_links, yMPEvo_links, EvolventenkreisRadius, 0, Math.PI * 2);

            EvolventenkreisLinks.CenterPoint = MPEvolventeLinks;
            EvolventenkreisLinks.StartPoint  = EvolventenEndeLinks;
            EvolventenkreisLinks.EndPoint    = VerrundungEndeLinks;

            Circle2D Kopfkreis = catfactory2D1.CreateCircle(x0, y0, Kopfkreisradius, 0, Math.PI * 2);

            Kopfkreis.CenterPoint = Ursprung;
            Kopfkreis.StartPoint  = EvolventenEndeRechts;
            Kopfkreis.EndPoint    = EvolventenEndeLinks;

            Circle2D EvolventenkreisRechts = catfactory2D1.CreateCircle(-xMPEvo_links, yMPEvo_links, EvolventenkreisRadius, 0, Math.PI * 2);

            EvolventenkreisRechts.CenterPoint = MPEvolventeRechts;
            EvolventenkreisRechts.StartPoint  = VerrundungAnfangRechts;
            EvolventenkreisRechts.EndPoint    = EvolventenEndeRechts;

            Circle2D VerrundungRechts = catfactory2D1.CreateCircle(-xMittelpunktVerrundung_links, yMittelpunktVerrundung_links, Verrundungsradius, 0, Math.PI * 2);

            VerrundungRechts.CenterPoint = MPVerrundungRechts;
            VerrundungRechts.StartPoint  = VerrundungAnfangRechts;
            VerrundungRechts.EndPoint    = VerrundungRechtsEnde;

            // Skizzierer verlassen
            hsp_catiaProfil.CloseEdition();
            // Part aktualisieren
            hsp_catiaPart.Part.Update();

            ShapeFactory       shapeFactory1       = (ShapeFactory)hsp_catiaPart.Part.ShapeFactory;
            HybridShapeFactory hybridShapeFactory1 = (HybridShapeFactory)hsp_catiaPart.Part.HybridShapeFactory;

            Factory2D factory2D1 = hsp_catiaProfil.Factory2D;

            HybridShapePointCoord ursprung    = hybridShapeFactory1.AddNewPointCoord(0, 0, 0);
            Reference             refUrsprung = hsp_catiaPart.Part.CreateReferenceFromObject(ursprung);

            HybridShapeDirection xRichtung    = hybridShapeFactory1.AddNewDirectionByCoord(1, 0, 0);
            Reference            refxRichtung = hsp_catiaPart.Part.CreateReferenceFromObject(xRichtung);

            CircPattern kreismuster = shapeFactory1.AddNewSurfacicCircPattern(factory2D1, 1, 2, 0, 0, 1, 1, refUrsprung, refxRichtung, false, 0, true, false);

            kreismuster.CircularPatternParameters = CatCircularPatternParameters.catInstancesandAngularSpacing;
            AngularRepartition angularRepartition1 = kreismuster.AngularRepartition;
            Angle angle1 = angularRepartition1.AngularSpacing;

            angle1.Value = Convert.ToDouble(360 / Zahnrad1.z);
            AngularRepartition angularRepartition2 = kreismuster.AngularRepartition;
            IntParam           intParam1           = angularRepartition2.InstancesCount;

            intParam1.Value = Convert.ToInt32(Zahnrad1.z) + 1;


            //Kreismusterenden verbinden

            Reference           refKreismuster = hsp_catiaPart.Part.CreateReferenceFromObject(kreismuster);
            HybridShapeAssemble verbindung     = hybridShapeFactory1.AddNewJoin(refKreismuster, refKreismuster);
            Reference           refVerbindung  = hsp_catiaPart.Part.CreateReferenceFromObject(verbindung);

            hybridShapeFactory1.GSMVisibility(refVerbindung, 0);

            hsp_catiaPart.Part.MainBody.InsertHybridShape(verbindung);

            hsp_catiaPart.Part.Update();

            ErzeugeBlock(Zahnrad1, refVerbindung, shapeFactory1);


            Sketches       sketchesBohrung   = catHybridBody1.HybridSketches;
            OriginElements catoriginelements = hsp_catiaPart.Part.OriginElements;
            Reference      refmxPlaneX       = (Reference)catoriginelements.PlaneYZ;

            hsp_catiaProfil = catSketches1.Add(refmxPlaneX);

            ErzeugeAchsensystem();

            hsp_catiaPart.Part.Update();

            hsp_catiaProfil.set_Name("Bohrung");

            Factory2D catfactory2D2 = hsp_catiaProfil.OpenEdition();

            Circle2D KreisFürBohrungsskizze = catfactory2D2.CreateClosedCircle(x0, y0, Zahnrad1.bd / 2);

            hsp_catiaProfil.CloseEdition();

            hsp_catiaPart.Part.Update();

            hsp_catiaPart.Part.InWorkObject = hsp_catiaPart.Part.MainBody;
            Pocket Tasche = shapeFactory1.AddNewPocket(hsp_catiaProfil, Zahnrad1.b);

            hsp_catiaPart.Part.Update();
        }
Пример #28
0
        private void button1_Click(object sender, EventArgs e)
        {
            INFITF.Application catia;        //INFITF.Application; returntype, catia; 변수명

            try
            {
                catia = (INFITF.Application)Marshal.GetActiveObject("CATIA.Application"); //실행되 있는 카티아 가져오기
            }
            catch (Exception ex)
            {
                //MessageBox.Show("카티아가 실행돼 있지 않습니다.");
                //MessageBox.Show("카티아 가져오기 오류: "+ex.Message);
                //catia 열기
                catia         = (INFITF.Application)Activator.CreateInstance(Type.GetTypeFromProgID("CATIA.Application"));
                catia.Visible = true;
            }
            //creat a part

            /*
             * catia.Documents.Add("Part1");
             * //catia.Documents.Open();
             * MECMOD.PartDocument part1;
             */
            MECMOD.PartDocument partDoc;
            partDoc = (MECMOD.PartDocument)catia.Documents.Add("Part");

            MECMOD.Part prt = partDoc.Part; //partDoc에 part를 담은 것

            MECMOD.Bodies bodies = prt.Bodies;

            MECMOD.Body body = bodies.Add();    //다름 body만들기
            //MECMOD.Body body0 = bodies.Item(1); //생성되 있는 partbody가져오기
            //MECMOD.Body body2 = bodies.Item("PartBody"); //해당되는 것에 이름
            //MECMOD.Body body1 = prt.MainBody;   //partbody가져오기

            MECMOD.Sketches skts = body.Sketches;

            INFITF.Reference xyPln = (INFITF.Reference)prt.OriginElements.PlaneXY; //creat a plan

            MECMOD.Sketch skt = skts.Add(xyPln);                                   //plane에 skt를 작성한다.
                                                                                   //open the skt
            MECMOD.Factory2D fac2d = skt.OpenEdition();

            //6.create the points
            MECMOD.GeometricElements gme = prt.GeometricElements;
            MECMOD.Point2D           p1  = fac2d.CreatePoint(10, 10);
            MECMOD.Point2D           p2  = fac2d.CreatePoint(10, 40);
            MECMOD.Point2D           p3  = fac2d.CreatePoint(40, 40);
            MECMOD.Point2D           p4  = fac2d.CreatePoint(40, 10);
            MECMOD.Point2D           p5  = fac2d.CreatePoint(30, 20);
            MECMOD.Point2D           p6  = fac2d.CreatePoint(20, 5);

            //7.create the lines
            MECMOD.Line2D line1 = fac2d.CreateLine(10, 10, 10, 40);
            MECMOD.Line2D line2 = fac2d.CreateLine(10, 40, 40, 40);
            MECMOD.Line2D line3 = fac2d.CreateLine(40, 40, 40, 10);

            //8.9 create  the spline
            Object[]        pa     = { p1, p6, p5, p4 };
            MECMOD.Spline2D spline = fac2d.CreateSpline(pa);

            //구속조건 추가
            //10
            line1.StartPoint = p1;
            line1.EndPoint   = p2;

            line2.StartPoint = p2;
            line2.EndPoint   = p3;

            line3.StartPoint = p3;
            line3.EndPoint   = p4;

            //11.create references
            INFITF.Reference rline1 = prt.CreateReferenceFromGeometry(line1);
            INFITF.Reference rline2 = prt.CreateReferenceFromGeometry(line2);

            INFITF.Reference rline3 = prt.CreateReferenceFromGeometry(line3);

            //12.
            MECMOD.Constraint cns = skt.Constraints.AddBiEltCst(CatConstraintType.catCstTypeAxisPerpendicularity, rline1, rline2);

            MECMOD.Constraint cns1 = skt.Constraints.AddBiEltCst(CatConstraintType.catCstTypeAxisPerpendicularity, rline3, rline2);

            //13.
            skt.CloseEdition();

            //catia.Visible = true;
        }
Пример #29
0
        public void SonderIPE_DrawSketch(double SonderIPE_Breite, double SonderIPE_Hoehe, double Flanschbreite, double Stegbreite)
        {
            double b  = SonderIPE_Breite;
            double h  = SonderIPE_Hoehe;
            double f  = Flanschbreite;
            double s  = Stegbreite;
            double R  = 2 * s;  // Definition des Eckenradius nach DIN 1025-2 und DIN 1025-5
            double bs = (b - s) / 2;

            CATIA_SonderIPE_2D.set_Name("I-Profil");

            Factory2D SonderIPE_Factory = CATIA_SonderIPE_2D.OpenEdition();

            // Definition der Geometrie

            // Definition der Radienmittelpunkte
            Point2D Mittelpunkt1 = SonderIPE_Factory.CreatePoint((bs - R), (f + R));
            Point2D Mittelpunkt2 = SonderIPE_Factory.CreatePoint((bs + s + R), (f + R));
            Point2D Mittelpunkt3 = SonderIPE_Factory.CreatePoint((bs + s + R), (h - f - R));
            Point2D Mittelpunkt4 = SonderIPE_Factory.CreatePoint((bs - R), (h - f - R));

            // Definition der Konturpunkte
            Point2D Konturpunkt1  = SonderIPE_Factory.CreatePoint(0, 0);
            Point2D Konturpunkt2  = SonderIPE_Factory.CreatePoint(b, 0);
            Point2D Konturpunkt3  = SonderIPE_Factory.CreatePoint(b, f);
            Point2D Konturpunkt4  = SonderIPE_Factory.CreatePoint((bs + s + R), f);
            Point2D Konturpunkt5  = SonderIPE_Factory.CreatePoint((bs + s), (f + R));
            Point2D Konturpunkt6  = SonderIPE_Factory.CreatePoint((bs + s), (h - f - R));
            Point2D Konturpunkt7  = SonderIPE_Factory.CreatePoint((bs + s + R), (h - f));
            Point2D Konturpunkt8  = SonderIPE_Factory.CreatePoint(b, (h - f));
            Point2D Konturpunkt9  = SonderIPE_Factory.CreatePoint(b, h);
            Point2D Konturpunkt10 = SonderIPE_Factory.CreatePoint(0, h);
            Point2D Konturpunkt11 = SonderIPE_Factory.CreatePoint(0, (h - f));
            Point2D Konturpunkt12 = SonderIPE_Factory.CreatePoint((bs - R), (h - f));
            Point2D Konturpunkt13 = SonderIPE_Factory.CreatePoint(bs, (h - f - R));
            Point2D Konturpunkt14 = SonderIPE_Factory.CreatePoint(bs, (f + R));
            Point2D Konturpunkt15 = SonderIPE_Factory.CreatePoint((bs - R), f);
            Point2D Konturpunkt16 = SonderIPE_Factory.CreatePoint(0, f);

            // Defintion der Linien
            Line2D Linie12 = SonderIPE_Factory.CreateLine(0, 0, b, 0);

            Linie12.StartPoint = Konturpunkt1;
            Linie12.EndPoint   = Konturpunkt2;

            Line2D Linie23 = SonderIPE_Factory.CreateLine(b, 0, b, f);

            Linie23.StartPoint = Konturpunkt2;
            Linie23.EndPoint   = Konturpunkt3;

            Line2D Linie34 = SonderIPE_Factory.CreateLine(b, f, (bs + s + R), f);

            Linie34.StartPoint = Konturpunkt3;
            Linie34.EndPoint   = Konturpunkt4;

            Line2D Linie56 = SonderIPE_Factory.CreateLine((bs + s), (f + R), (bs + s), (h - f - R));

            Linie56.StartPoint = Konturpunkt5;
            Linie56.EndPoint   = Konturpunkt6;

            Line2D Linie78 = SonderIPE_Factory.CreateLine((bs + s + R), (h - f), b, (h - f));

            Linie78.StartPoint = Konturpunkt7;
            Linie78.EndPoint   = Konturpunkt8;

            Line2D Linie89 = SonderIPE_Factory.CreateLine(b, (h - f), b, h);

            Linie89.StartPoint = Konturpunkt8;
            Linie89.EndPoint   = Konturpunkt9;

            Line2D Linie910 = SonderIPE_Factory.CreateLine(b, h, 0, h);

            Linie910.StartPoint = Konturpunkt9;
            Linie910.EndPoint   = Konturpunkt10;

            Line2D Linie1011 = SonderIPE_Factory.CreateLine(0, h, 0, (h - f));

            Linie1011.StartPoint = Konturpunkt10;
            Linie1011.EndPoint   = Konturpunkt11;

            Line2D Linie1112 = SonderIPE_Factory.CreateLine(0, (h - f), (bs - R), (h - f));

            Linie1112.StartPoint = Konturpunkt11;
            Linie1112.EndPoint   = Konturpunkt12;

            Line2D Linie1314 = SonderIPE_Factory.CreateLine(bs, (h - f - R), bs, (f + R));

            Linie1314.StartPoint = Konturpunkt13;
            Linie1314.EndPoint   = Konturpunkt14;

            Line2D Linie1516 = SonderIPE_Factory.CreateLine((bs - R), f, 0, f);

            Linie1516.StartPoint = Konturpunkt15;
            Linie1516.EndPoint   = Konturpunkt16;

            Line2D Linie161 = SonderIPE_Factory.CreateLine(0, f, 0, 0);

            Linie161.StartPoint = Konturpunkt16;
            Linie161.EndPoint   = Konturpunkt1;

            // Definition der Eckenverrundungen
            Circle2D Eckenverrundung1 = SonderIPE_Factory.CreateCircle((bs - R), (f + R), R, 0, 0);

            Eckenverrundung1.CenterPoint = Mittelpunkt1;
            Eckenverrundung1.StartPoint  = Konturpunkt15;
            Eckenverrundung1.EndPoint    = Konturpunkt14;

            Circle2D Eckenverrundung2 = SonderIPE_Factory.CreateCircle((bs + s + R), (f + R), R, 0, 0);

            Eckenverrundung2.CenterPoint = Mittelpunkt2;
            Eckenverrundung2.StartPoint  = Konturpunkt5;
            Eckenverrundung2.EndPoint    = Konturpunkt4;

            Circle2D Eckenverrundung3 = SonderIPE_Factory.CreateCircle((bs + s + R), (h - f - R), R, 0, 0);

            Eckenverrundung3.CenterPoint = Mittelpunkt3;
            Eckenverrundung3.StartPoint  = Konturpunkt7;
            Eckenverrundung3.EndPoint    = Konturpunkt6;

            Circle2D Eckenverrundung4 = SonderIPE_Factory.CreateCircle((bs - R), (h - f - R), R, 0, 0);

            Eckenverrundung4.CenterPoint = Mittelpunkt4;
            Eckenverrundung4.StartPoint  = Konturpunkt13;
            Eckenverrundung4.EndPoint    = Konturpunkt12;

            CATIA_SonderIPE_2D.CloseEdition();

            CATIA_SonderIPE_Part.Part.Update();
        }
Пример #30
0
        static void Main(string[] args)
        {
            INFITF.Application catia; //add the reference - catia v5 infiit interface...

            try
            {
                //열려 있는 catia가져오기
                catia = (INFITF.Application)Marshal.GetActiveObject("CATIA.Application");
            }
            catch (Exception)
            {
                //catia 실행하기
                catia         = (INFITF.Application)Activator.CreateInstance(Type.GetTypeFromProgID("CATIA.Application"));
                catia.Visible = true;
            }

            MECMOD.PartDocument prtDoc = (MECMOD.PartDocument)catia.Documents.Add("Part");
            MECMOD.Part         prt    = prtDoc.Part;
            MECMOD.Bodies       bdys   = prt.Bodies;
            MECMOD.Body         bdy    = bdys.Add();
            MECMOD.Sketches     skts   = bdy.Sketches;

            INFITF.Reference xypln = (INFITF.Reference)prt.OriginElements.PlaneXY;
            MECMOD.Sketch    skt   = skts.Add(xypln);

            MECMOD.Factory2D fac2d = skt.OpenEdition();

            Point2D p1 = fac2d.CreatePoint(50, 50);
            Point2D p2 = fac2d.CreatePoint(50, 100);
            Point2D p3 = fac2d.CreatePoint(100, 100);
            Point2D p4 = fac2d.CreatePoint(100, 50);

            //method를 만들고 line생성
            Line2D lin1 = CreateLine(fac2d, p1, p2);
            Line2D lin2 = CreateLine(fac2d, p2, p3);
            Line2D lin3 = CreateLine(fac2d, p3, p4);
            Line2D lin4 = CreateLine(fac2d, p4, p1);

            /*
             * Line2D lin1 = fac2d.CreateLine(50,50,50,100);
             * Line2D lin2 = fac2d.CreateLine(50, 100, 100, 100);
             * Line2D lin3 = fac2d.CreateLine(100, 100, 100, 50);
             * Line2D lin4 = fac2d.CreateLine(100, 50, 50, 50);
             *
             * lin1.StartPoint = p1;
             * lin1.EndPoint = p2;
             *
             * lin2.StartPoint = p2;
             * lin2.EndPoint = p3;
             *
             * lin3.StartPoint = p3;
             * lin3.EndPoint = p4;
             *
             * lin4.StartPoint = p4;
             * lin4.EndPoint = p1;
             */

            INFITF.Reference rline1 = prt.CreateReferenceFromGeometry(lin1);
            INFITF.Reference rline2 = prt.CreateReferenceFromGeometry(lin2);
            INFITF.Reference rline3 = prt.CreateReferenceFromGeometry(lin3);
            INFITF.Reference rline4 = prt.CreateReferenceFromGeometry(lin4);
            INFITF.Reference rlineH = prt.CreateReferenceFromGeometry(skt.AbsoluteAxis.HorizontalReference);
            INFITF.Reference rlineV = prt.CreateReferenceFromGeometry(skt.AbsoluteAxis.VerticalReference);

            Constraint d1 = skt.Constraints.AddBiEltCst(CatConstraintType.catCstTypeDistance, rline1, rline3);
            Constraint d2 = skt.Constraints.AddBiEltCst(CatConstraintType.catCstTypeDistance, rline2, rline4);
            Constraint d3 = skt.Constraints.AddBiEltCst(CatConstraintType.catCstTypeDistance, rlineH, rline4);
            Constraint d4 = skt.Constraints.AddBiEltCst(CatConstraintType.catCstTypeDistance, rlineV, rline1);

            skt.CloseEdition();
        }