public void ErzeugeDreieckprofil(string currentItemName, double[] parameterListe) { double b = parameterListe[0]; double h = parameterListe[1]; // 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(0, h / 2); Point2D catPoint2D3 = catFactory2D1.CreatePoint(-b / 2, -h / 2); // dann die Linien Line2D catLine2D1 = catFactory2D1.CreateLine(b / 2, -h / 2, 0, h / 2); catLine2D1.StartPoint = catPoint2D1; catLine2D1.EndPoint = catPoint2D2; Line2D catLine2D2 = catFactory2D1.CreateLine(0, 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 = catPoint2D1; // Skizzierer verlassen hsp_catiaProfil.CloseEdition(); // Part aktualisieren hsp_catiaPart.Part.Update(); }
//Ende RundVoll //Halbrund //Erzeugen der Geometrie Halbrund internal void ErzeugeProfilHalbRund(HalbrundProfil neuHalbRund) { hspB1_catia_Profil.set_Name("Halbrund"); Factory2D factory2D = hspB1_catia_Profil.OpenEdition(); //Setzen der Punkte Point2D catPoint2D1 = factory2D.CreatePoint(-neuHalbRund.Radius, 0); Point2D catPoint2D2 = factory2D.CreatePoint(neuHalbRund.Radius, 0); //Kreis Erzeugen Circle2D circle2D1 = factory2D.CreateClosedCircle(0.000000, 0.000000, neuHalbRund.Radius); circle2D1.StartPoint = catPoint2D2; circle2D1.EndPoint = catPoint2D1; //Linie Ziehen Line2D line2D1 = factory2D.CreateLine(-(neuHalbRund.Radius), 0.000000, neuHalbRund.Radius, 0.000000); // Skizzierer verlassen hspB1_catia_Profil.CloseEdition(); // Part aktualisieren hspB1_catiaPart.Part.Update(); }
public void ErzeugeRechteck(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(); }
private Sketch Gewindeskizze(Schraube arr) { // Referenzen für Skizze festlegen OriginElements catoriginElements = part_Schraube.OriginElements; Reference RefPlanezx = (Reference)catoriginElements.PlaneZX; //Neue Skizze erstellen Sketch Skizze_gewinde = sketches_Schraube.Add(RefPlanezx); part_Schraube.InWorkObject = Skizze_gewinde; Skizze_gewinde.set_Name("Gewinde"); //Koordinaten Für gewindeSkizze berechnen double zInnen = 0.5 * arr.kerndurchmesser + arr.gewinderundung - Math.Sin((30 * Math.PI) / 180) * arr.gewinderundung; double xInnen = Math.Cos((30 * Math.PI) / 180) * arr.gewinderundung; double zAußen = 0.5 * arr.durchmesser; double xAußen = 2 * 0.1875 * arr.gewindesteigung; double zRadius = 0.5 * (arr.kerndurchmesser + arr.gewinderundung); double xRadius = 0; // Geometrie zeichnen Factory2D catfactory2D2 = Skizze_gewinde.OpenEdition(); Point2D geweindepunkt1 = catfactory2D2.CreatePoint(zInnen, -xInnen); Point2D geweindepunkt2 = catfactory2D2.CreatePoint(zInnen, xInnen); Point2D geweindepunkt3 = catfactory2D2.CreatePoint(zAußen, xAußen); Point2D geweindepunkt4 = catfactory2D2.CreatePoint(zAußen, -xAußen); Point2D geweindepunkt5 = catfactory2D2.CreatePoint(zRadius, xRadius); Line2D linieOben = catfactory2D2.CreateLine(zInnen, xInnen, zAußen, xAußen); linieOben.StartPoint = geweindepunkt2; linieOben.EndPoint = geweindepunkt3; Line2D linieAußen = catfactory2D2.CreateLine(zAußen, xAußen, zAußen, -xAußen); linieAußen.StartPoint = geweindepunkt3; linieAußen.EndPoint = geweindepunkt4; Line2D linieUnten = catfactory2D2.CreateLine(zAußen, -xAußen, zInnen, -xInnen); linieUnten.StartPoint = geweindepunkt4; linieUnten.EndPoint = geweindepunkt1; Circle2D gewindeRundung = catfactory2D2.CreateCircle(zRadius, xRadius, arr.gewinderundung, 0, 0); gewindeRundung.CenterPoint = geweindepunkt5; gewindeRundung.EndPoint = geweindepunkt1; gewindeRundung.StartPoint = geweindepunkt2; Skizze_gewinde.CloseEdition(); return(Skizze_gewinde); }
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(); }
public bool ErzeugeProfilDoppelTTräger(Double b, Double h) { b = b / 2; h = h / 2; if (b > 0 & h > 0) { // Skizze umbenennen catiaSketch.set_Name("Doppel T-Träger"); // Rechteck in Skizze einzeichnen // Skizze oeffnen Factory2D catFactory2D1 = catiaSketch.OpenEdition(); // Rechteck erzeugen // erst die Punkte Point2D catPoint2D1 = catFactory2D1.CreatePoint(-b, h); Point2D catPoint2D2 = catFactory2D1.CreatePoint(b, h); Point2D catPoint2D3 = catFactory2D1.CreatePoint(b, -h); Point2D catPoint2D4 = catFactory2D1.CreatePoint(-b, -h); // dann die Linien Line2D catLine2D1 = catFactory2D1.CreateLine(-b, h, b, h); catLine2D1.StartPoint = catPoint2D1; catLine2D1.EndPoint = catPoint2D2; Line2D catLine2D2 = catFactory2D1.CreateLine(b, h, b, -h); catLine2D2.StartPoint = catPoint2D2; catLine2D2.EndPoint = catPoint2D3; Line2D catLine2D3 = catFactory2D1.CreateLine(b, -h, -b, -h); catLine2D3.StartPoint = catPoint2D3; catLine2D3.EndPoint = catPoint2D4; Line2D catLine2D4 = catFactory2D1.CreateLine(-b, -h, -b, h); catLine2D4.StartPoint = catPoint2D4; catLine2D4.EndPoint = catPoint2D1; // Skizzierer verlassen catiaSketch.CloseEdition(); // Part aktualisieren catiaPart.Part.Update(); skizzeerstellt = true; } else { MessageBox.Show("Fehler beim Erstellen des Profils:\rDie Werte dürfen nicht null sein!"); skizzeerstellt = false; } return(skizzeerstellt); }
public bool ErzeugeProfilRechteckrohr(Double breite, Double laenge) { if (breite == 0 | laenge == 0) { MessageBox.Show("Fehler beim Erstellen des Profils:\rDie Werte dürfen nicht null sein!"); skizzeerstellt = false; } else { breite = breite / 2; laenge = laenge / 2; // Skizze umbenennen catiaSketch.set_Name("Rechteckrohr"); // Rechteck in Skizze einzeichnen // Skizze oeffnen Factory2D catFactory2D1 = catiaSketch.OpenEdition(); // Rechteck erzeugen // erst die Punkte Point2D catPoint2D1 = catFactory2D1.CreatePoint(-breite, laenge); Point2D catPoint2D2 = catFactory2D1.CreatePoint(breite, laenge); Point2D catPoint2D3 = catFactory2D1.CreatePoint(breite, -laenge); Point2D catPoint2D4 = catFactory2D1.CreatePoint(-breite, -laenge); // dann die Linien Line2D catLine2D1 = catFactory2D1.CreateLine(-breite, laenge, breite, laenge); catLine2D1.StartPoint = catPoint2D1; catLine2D1.EndPoint = catPoint2D2; Line2D catLine2D2 = catFactory2D1.CreateLine(breite, laenge, breite, -laenge); catLine2D2.StartPoint = catPoint2D2; catLine2D2.EndPoint = catPoint2D3; Line2D catLine2D3 = catFactory2D1.CreateLine(breite, -laenge, -breite, -laenge); catLine2D3.StartPoint = catPoint2D3; catLine2D3.EndPoint = catPoint2D4; Line2D catLine2D4 = catFactory2D1.CreateLine(-breite, -laenge, -breite, laenge); catLine2D4.StartPoint = catPoint2D4; catLine2D4.EndPoint = catPoint2D1; // Skizzierer verlassen catiaSketch.CloseEdition(); // Part aktualisieren catiaPart.Part.Update(); skizzeerstellt = true; } return(skizzeerstellt); }
public void ErzeugeRechteckRohr(Double r_ah, Double r_ih, Double r_ab, Double r_ib) { hsp_catiaProfil.set_Name("RechteckRohr"); Factory2D catFactory2D1 = hsp_catiaProfil.OpenEdition(); Point2D catPoint2D1 = catFactory2D1.CreatePoint(0, r_ah); Point2D catPoint2D2 = catFactory2D1.CreatePoint(r_ab, r_ah); Point2D catPoint2D3 = catFactory2D1.CreatePoint(r_ab, 0); Point2D catPoint2D4 = catFactory2D1.CreatePoint(0, 0); Point2D catPoint2D5 = catFactory2D1.CreatePoint((r_ab - r_ib) / 2, r_ih + (r_ah - r_ih) / 2); Point2D catPoint2D6 = catFactory2D1.CreatePoint(r_ib + (r_ab - r_ib) / 2, r_ih + (r_ah - r_ih) / 2); Point2D catPoint2D7 = catFactory2D1.CreatePoint(r_ib + (r_ab - r_ib) / 2, (r_ah - r_ih) / 2); Point2D catPoint2D8 = catFactory2D1.CreatePoint((r_ab - r_ib) / 2, (r_ah - r_ih) / 2); Line2D catLine2D1 = catFactory2D1.CreateLine(0, r_ah, r_ab, r_ah); catLine2D1.StartPoint = catPoint2D1; catLine2D1.EndPoint = catPoint2D2; Line2D catLine2D2 = catFactory2D1.CreateLine(r_ab, r_ah, r_ab, 0); catLine2D2.StartPoint = catPoint2D2; catLine2D2.EndPoint = catPoint2D3; Line2D catLine2D3 = catFactory2D1.CreateLine(r_ab, 0, 0, 0); catLine2D3.StartPoint = catPoint2D3; catLine2D3.EndPoint = catPoint2D4; Line2D catLine2D4 = catFactory2D1.CreateLine(0, 0, 0, r_ah); catLine2D4.StartPoint = catPoint2D4; catLine2D4.EndPoint = catPoint2D1; Line2D catLine2D5 = catFactory2D1.CreateLine((r_ab - r_ib) / 2, r_ih + (r_ah - r_ih) / 2, r_ib + (r_ab - r_ib) / 2, r_ih + (r_ah - r_ih) / 2); catLine2D5.StartPoint = catPoint2D5; catLine2D5.EndPoint = catPoint2D6; Line2D catLine2D6 = catFactory2D1.CreateLine(r_ib + (r_ab - r_ib) / 2, r_ih + (r_ah - r_ih) / 2, r_ib + (r_ab - r_ib) / 2, (r_ah - r_ih) / 2); catLine2D6.StartPoint = catPoint2D6; catLine2D6.EndPoint = catPoint2D7; Line2D catLine2D7 = catFactory2D1.CreateLine(r_ib + (r_ab - r_ib) / 2, (r_ah - r_ih) / 2, (r_ab - r_ib) / 2, (r_ah - r_ih) / 2); catLine2D7.StartPoint = catPoint2D7; catLine2D7.EndPoint = catPoint2D8; Line2D catLine2D8 = catFactory2D1.CreateLine((r_ab - r_ib) / 2, (r_ah - r_ih) / 2, (r_ab - r_ib) / 2, r_ih + (r_ah - r_ih) / 2); catLine2D8.StartPoint = catPoint2D8; catLine2D8.EndPoint = catPoint2D5; hsp_catiaProfil.CloseEdition(); hsp_catiaPart.Part.Update(); }
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(); }
//Ende I Profil //Hier Enden die Formprofile!!! // Hier beginnen die runden Profile!!! //Anfang RundHohlProfil!! internal void ErzeugeProfilRundHohlProfil(RundHohlProfil rundHohlProfil) { hspB1_catia_Profil.set_Name("RundHohlProfil"); Factory2D factory2D = hspB1_catia_Profil.OpenEdition(); //Setzen der Punkte/Kreise Point2D catpoint2D1 = factory2D.CreatePoint(0, 0); Circle2D catCircle2D1 = factory2D.CreateCircle(0, 0, rundHohlProfil.Durchmesser / 2, 0, 0); catCircle2D1.CenterPoint = catpoint2D1; Circle2D catCircle2D2 = factory2D.CreateCircle(0, 0, (rundHohlProfil.Durchmesser / 2 - rundHohlProfil.Wandstärke), 0, 0); catCircle2D2.CenterPoint = catpoint2D1; // Skizzierer verlassen hspB1_catia_Profil.CloseEdition(); // Part aktualisieren hspB1_catiaPart.Part.Update(); }
public bool ErzeugeProfilRohr(Double aussendurchmesser) { if (aussendurchmesser > 0) { // Skizze umbenennen catiaSketch.set_Name("Rohr"); // Rechteck in Skizze einzeichnen // Skizze oeffnen Factory2D catFactory2D1 = catiaSketch.OpenEdition(); Circle2D circle2D1 = catFactory2D1.CreateClosedCircle(0.000000, 0.000000, aussendurchmesser / 2); Point2D catPoint2D1 = catFactory2D1.CreatePoint(0, 0); circle2D1.CenterPoint = catPoint2D1; catiaSketch.CloseEdition(); catiaPart.Part.Update(); skizzeerstellt = true; } else { MessageBox.Show("Fehler beim Erstellen des Profils:\rDie Werte dürfen nicht null sein!"); skizzeerstellt = false; } return(skizzeerstellt); }
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(); }
//사각형을 만든 method------------------------------------------------- private static void CreateRectangle(Factory2D fac, Part prt, Sketch skt, double x1, double y1, double x2, double y2) { Point2D p1 = fac.CreatePoint(x1, y1); Point2D p2 = fac.CreatePoint(x2, y1); Point2D p3 = fac.CreatePoint(x2, y2); Point2D p4 = fac.CreatePoint(x1, y2); Line2D lin1 = CreateLine(fac, p1, p2); Line2D lin2 = CreateLine(fac, p2, p3); Line2D lin3 = CreateLine(fac, p3, p4); Line2D lin4 = CreateLine(fac, p4, p1); CatConstraintType cntype = CatConstraintType.catCstTypeDistance; Constraint cnst1 = CreateCnst(prt, skt, cntype, lin1, lin3); Constraint cnst2 = CreateCnst(prt, skt, cntype, lin2, lin4); Constraint cnst3 = CreateCnst(prt, skt, cntype, lin1, skt.AbsoluteAxis.HorizontalReference); Constraint cnst4 = CreateCnst(prt, skt, cntype, lin2, skt.AbsoluteAxis.VerticalReference); }
public override void ErzeugeProfil(Double b, Double h, Double p, Double q) { // 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(0, 0); Point2D catPoint2D2 = catFactory2D1.CreatePoint(0, h); Point2D catPoint2D3 = catFactory2D1.CreatePoint(b, h); Point2D catPoint2D4 = catFactory2D1.CreatePoint(b, 0); // dann die Linien Line2D catLine2D1 = catFactory2D1.CreateLine(0, 0, 0, h); catLine2D1.StartPoint = catPoint2D1; catLine2D1.EndPoint = catPoint2D2; Line2D catLine2D2 = catFactory2D1.CreateLine(0, h, b, h); catLine2D2.StartPoint = catPoint2D2; catLine2D2.EndPoint = catPoint2D3; Line2D catLine2D3 = catFactory2D1.CreateLine(b, h, b, 0); catLine2D3.StartPoint = catPoint2D3; catLine2D3.EndPoint = catPoint2D4; Line2D catLine2D4 = catFactory2D1.CreateLine(b, 0, 0, 0); catLine2D4.StartPoint = catPoint2D4; catLine2D4.EndPoint = catPoint2D1; // Skizzierer verlassen hsp_catiaProfil.CloseEdition(); // Part aktualisieren hsp_catiaPart.Part.Update(); }
public void ErzeugeProfil(double breiterechteck, double hoeherechteck) { // 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(-breiterechteck / 2, hoeherechteck / 2); Point2D catPoint2D2 = catFactory2D1.CreatePoint(breiterechteck / 2, hoeherechteck / 2); Point2D catPoint2D3 = catFactory2D1.CreatePoint(breiterechteck / 2, -hoeherechteck / 2); Point2D catPoint2D4 = catFactory2D1.CreatePoint(-breiterechteck / 2, -hoeherechteck / 2); // dann die Linien Line2D catLine2D1 = catFactory2D1.CreateLine(-breiterechteck / 2, hoeherechteck / 2, breiterechteck / 2, hoeherechteck / 2); catLine2D1.StartPoint = catPoint2D1; catLine2D1.EndPoint = catPoint2D2; Line2D catLine2D2 = catFactory2D1.CreateLine(breiterechteck / 2, hoeherechteck / 2, breiterechteck / 2, -hoeherechteck / 2); catLine2D2.StartPoint = catPoint2D2; catLine2D2.EndPoint = catPoint2D3; Line2D catLine2D3 = catFactory2D1.CreateLine(breiterechteck / 2, -hoeherechteck / 2, -breiterechteck / 2, -hoeherechteck / 2); catLine2D3.StartPoint = catPoint2D3; catLine2D3.EndPoint = catPoint2D4; Line2D catLine2D4 = catFactory2D1.CreateLine(-breiterechteck / 2, -hoeherechteck / 2, -breiterechteck / 2, hoeherechteck / 2); catLine2D4.StartPoint = catPoint2D4; catLine2D4.EndPoint = catPoint2D1; // Skizzierer verlassen hsp_catiaProfil.CloseEdition(); // Part aktualisieren hsp_catiaPart.Part.Update(); }
//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 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(); }
public void erstelleDreieck(double dHoehe, double dBreite) { // Skizze umbenennen hsp_catiaProfil.set_Name("Dreieck"); // Rechteck in Skizze einzeichnen // Skizze oeffnen Factory2D catFactory2D1 = hsp_catiaProfil.OpenEdition(); // Rechteck erzeugen // erst die Punkte Point2D catPoint2D1 = catFactory2D1.CreatePoint(dHoehe, 0); Point2D catPoint2D2 = catFactory2D1.CreatePoint(0, dBreite / 2); Point2D catPoint2D3 = catFactory2D1.CreatePoint(0, -dBreite / 2); // dann die Linien Line2D catLine2D1 = catFactory2D1.CreateLine(dHoehe, 0, 0, dBreite / 2); catLine2D1.StartPoint = catPoint2D1; catLine2D1.EndPoint = catPoint2D2; Line2D catLine2D2 = catFactory2D1.CreateLine(0, dBreite / 2, 0, -dBreite / 2); catLine2D2.StartPoint = catPoint2D2; catLine2D2.EndPoint = catPoint2D3; Line2D catLine2D3 = catFactory2D1.CreateLine(0, -dBreite / 2, dHoehe, 0); catLine2D3.StartPoint = catPoint2D3; catLine2D3.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(); }
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(); }
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(); }
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(); }
public void ErzeugeRechteckProfil(double b, double h) { b /= 2; h /= 2; catiaProfil.set_Name("Rechteck "); Factory2D catFactory2D = catiaProfil.OpenEdition(); Point2D catP2D_1 = catFactory2D.CreatePoint(-b, h); Point2D catP2D_2 = catFactory2D.CreatePoint(b, h); Point2D catP2D_3 = catFactory2D.CreatePoint(b, -h); Point2D catP2D_4 = catFactory2D.CreatePoint(-b, -h); Line2D catL2D_1 = catFactory2D.CreateLine(-b, h, b, h); catL2D_1.StartPoint = catP2D_1; catL2D_1.EndPoint = catP2D_2; Line2D catL2D_2 = catFactory2D.CreateLine(b, h, b, -h); catL2D_2.StartPoint = catP2D_2; catL2D_2.EndPoint = catP2D_3; Line2D catL2D_3 = catFactory2D.CreateLine(b, -h, -b, -h); catL2D_3.StartPoint = catP2D_3; catL2D_3.EndPoint = catP2D_4; Line2D catL2D_4 = catFactory2D.CreateLine(-b, -h, -b, h); catL2D_4.StartPoint = catP2D_4; catL2D_4.EndPoint = catP2D_1; catiaProfil.CloseEdition(); catiaPart.Part.Update(); }
public void ErzeugeLProfil(Double Hoehe, Double Breite, Double Wandstaerke) { // Skizze umbenennen hsp_catiaProfil.set_Name("L-Profil"); // U-Profil in Skizze einzeichnen // Skizze oeffnen Factory2D catFactory2D1 = hsp_catiaProfil.OpenEdition(); // U-Profil erzeugen // erst die Punkte Point2D catPoint2D1 = catFactory2D1.CreatePoint(0, 0); Point2D catPoint2D2 = catFactory2D1.CreatePoint(Breite, 0); Point2D catPoint2D3 = catFactory2D1.CreatePoint(Breite, Wandstaerke); Point2D catPoint2D4 = catFactory2D1.CreatePoint(Wandstaerke, Wandstaerke); Point2D catPoint2D5 = catFactory2D1.CreatePoint(Wandstaerke, Hoehe); Point2D catPoint2D6 = catFactory2D1.CreatePoint(0, Hoehe); // dann die Linien Line2D catLine2D1 = catFactory2D1.CreateLine(0, 0, Breite, 0); catLine2D1.StartPoint = catPoint2D1; catLine2D1.EndPoint = catPoint2D2; Line2D catLine2D2 = catFactory2D1.CreateLine(Breite, 0, Breite, Wandstaerke); catLine2D2.StartPoint = catPoint2D2; catLine2D2.EndPoint = catPoint2D3; Line2D catLine2D3 = catFactory2D1.CreateLine(Breite, Wandstaerke, Wandstaerke, Wandstaerke); catLine2D3.StartPoint = catPoint2D3; catLine2D3.EndPoint = catPoint2D4; Line2D catLine2D4 = catFactory2D1.CreateLine(Wandstaerke, Wandstaerke, Wandstaerke, Hoehe); catLine2D4.StartPoint = catPoint2D4; catLine2D4.EndPoint = catPoint2D5; Line2D catLine2D5 = catFactory2D1.CreateLine(Wandstaerke, Hoehe, 0, Hoehe); catLine2D5.StartPoint = catPoint2D5; catLine2D5.EndPoint = catPoint2D6; Line2D catLine2D6 = catFactory2D1.CreateLine(0, Hoehe, 0, 0); catLine2D6.StartPoint = catPoint2D6; catLine2D6.EndPoint = catPoint2D1; // Skizzierer verlassen hsp_catiaProfil.CloseEdition(); // Part aktualisieren hsp_catiaPart.Part.Update(); }
public void ErzeugeKreisProfil(double d) { catiaProfil.set_Name("Kreis"); Factory2D catFactory2D = catiaProfil.OpenEdition(); Point2D center = catFactory2D.CreatePoint(0, 0); Circle2D circle = catFactory2D.CreateClosedCircle(0, 0, d / 2); circle.CenterPoint = center; catiaProfil.CloseEdition(); catiaPart.Part.Update(); }
//Ende RundVoll //Sechseck //Erzeugen der Geometrie Sechseck internal void ErzeugeSechseckVoll(SechseckVoll neuSechseckVoll) { hspB1_catia_Profil.set_Name("Sechseck"); Factory2D factory2D = hspB1_catia_Profil.OpenEdition(); //Setzen der Punkte Point2D catPoint2D1 = factory2D.CreatePoint(-neuSechseckVoll.Radius / 2, Math.Sqrt(neuSechseckVoll.Radius * neuSechseckVoll.Radius - ((neuSechseckVoll.Radius / 2) * (neuSechseckVoll.Radius / 2)))); Point2D catPoint2D2 = factory2D.CreatePoint(neuSechseckVoll.Radius / 2, Math.Sqrt(neuSechseckVoll.Radius * neuSechseckVoll.Radius - ((neuSechseckVoll.Radius / 2) * (neuSechseckVoll.Radius / 2)))); Point2D catPoint2D3 = factory2D.CreatePoint(neuSechseckVoll.Radius, 0); Point2D catPoint2D4 = factory2D.CreatePoint(neuSechseckVoll.Radius / 2, -Math.Sqrt(neuSechseckVoll.Radius * neuSechseckVoll.Radius - ((neuSechseckVoll.Radius / 2) * (neuSechseckVoll.Radius / 2)))); Point2D catPoint2D5 = factory2D.CreatePoint(-neuSechseckVoll.Radius / 2, -Math.Sqrt(neuSechseckVoll.Radius * neuSechseckVoll.Radius - ((neuSechseckVoll.Radius / 2) * (neuSechseckVoll.Radius / 2)))); Point2D catPoint2D6 = factory2D.CreatePoint(-neuSechseckVoll.Radius, 0); // Linien Line2D catLine2D1 = factory2D.CreateLine(-neuSechseckVoll.Radius / 2, Math.Sqrt(neuSechseckVoll.Radius * neuSechseckVoll.Radius - ((neuSechseckVoll.Radius / 2) * (neuSechseckVoll.Radius / 2))), neuSechseckVoll.Radius / 2, Math.Sqrt(neuSechseckVoll.Radius * neuSechseckVoll.Radius - ((neuSechseckVoll.Radius / 2) * (neuSechseckVoll.Radius / 2)))); catLine2D1.StartPoint = catPoint2D1; catLine2D1.EndPoint = catPoint2D2; Line2D catLine2D2 = factory2D.CreateLine(neuSechseckVoll.Radius / 2, Math.Sqrt(neuSechseckVoll.Radius * neuSechseckVoll.Radius - ((neuSechseckVoll.Radius / 2) * (neuSechseckVoll.Radius / 2))), neuSechseckVoll.Radius, 0); catLine2D2.StartPoint = catPoint2D2; catLine2D2.EndPoint = catPoint2D3; Line2D catLine2D3 = factory2D.CreateLine(neuSechseckVoll.Radius, 0, neuSechseckVoll.Radius / 2, -Math.Sqrt(neuSechseckVoll.Radius * neuSechseckVoll.Radius - ((neuSechseckVoll.Radius / 2) * (neuSechseckVoll.Radius / 2)))); catLine2D3.StartPoint = catPoint2D3; catLine2D3.EndPoint = catPoint2D4; Line2D catLine2D4 = factory2D.CreateLine(neuSechseckVoll.Radius / 2, -Math.Sqrt(neuSechseckVoll.Radius * neuSechseckVoll.Radius - ((neuSechseckVoll.Radius / 2) * (neuSechseckVoll.Radius / 2))), -neuSechseckVoll.Radius / 2, -Math.Sqrt(neuSechseckVoll.Radius * neuSechseckVoll.Radius - ((neuSechseckVoll.Radius / 2) * (neuSechseckVoll.Radius / 2)))); catLine2D4.StartPoint = catPoint2D4; catLine2D4.EndPoint = catPoint2D5; Line2D catLine2D5 = factory2D.CreateLine(-neuSechseckVoll.Radius / 2, -Math.Sqrt(neuSechseckVoll.Radius * neuSechseckVoll.Radius - ((neuSechseckVoll.Radius / 2) * (neuSechseckVoll.Radius / 2))), -neuSechseckVoll.Radius, 0); catLine2D5.StartPoint = catPoint2D5; catLine2D5.EndPoint = catPoint2D6; Line2D catLine2D6 = factory2D.CreateLine(-neuSechseckVoll.Radius, 0, -neuSechseckVoll.Radius / 2, Math.Sqrt(neuSechseckVoll.Radius * neuSechseckVoll.Radius - ((neuSechseckVoll.Radius / 2) * (neuSechseckVoll.Radius / 2)))); catLine2D6.StartPoint = catPoint2D6; catLine2D6.EndPoint = catPoint2D1; // Skizzierer verlassen hspB1_catia_Profil.CloseEdition(); // Part aktualisieren hspB1_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(); }
public void erstelleLprofilSkizze(double dL1, double dL2, double dL3, double dL4) { Factory2D fact2D = hsp_catiaProfil.OpenEdition(); // Skizze umbenennen hsp_catiaProfil.set_Name("L-Profil"); // Eckpunkte erstellen double dStartpunktx = 0; double dStartpunkty = 0; Point2D P1 = fact2D.CreatePoint(dStartpunktx, dStartpunkty); Point2D P2 = fact2D.CreatePoint(dStartpunktx, dL1); Point2D P3 = fact2D.CreatePoint(dL2 - dL4, dL1); Point2D P4 = fact2D.CreatePoint(dL2 - dL4, dL1 - dL3); Point2D P5 = fact2D.CreatePoint(dL2, dL1 - dL3); Point2D P6 = fact2D.CreatePoint(dL2, dStartpunkty); Line2D L1 = fact2D.CreateLine(dStartpunktx, dStartpunkty, dStartpunktx, dL1); Line2D L2 = fact2D.CreateLine(dStartpunktx, dL1, dL2 - dL4, dL1); Line2D L3 = fact2D.CreateLine(dL2 - dL4, dL1, dL2 - dL4, dL1 - dL3); Line2D L4 = fact2D.CreateLine(dL2 - dL4, dL1 - dL3, dL2, dL1 - dL3); Line2D L5 = fact2D.CreateLine(dL2, dL1 - dL3, dL2, dStartpunkty); Line2D L6 = fact2D.CreateLine(dL2, dStartpunkty, dStartpunktx, dStartpunkty); L1.StartPoint = P1; L1.EndPoint = P2; L2.StartPoint = P2; L2.EndPoint = P3; L3.StartPoint = P3; L3.EndPoint = P4; L4.StartPoint = P4; L4.EndPoint = P1; L5.StartPoint = P5; L5.EndPoint = P6; L6.StartPoint = P6; L6.EndPoint = P1; hsp_catiaProfil.CloseEdition(); hsp_catiaPart.Part.Update(); }
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; Sketch skt1 = skts.Add(xypln); Factory2D fac2d = skt1.OpenEdition(); //fac2d안에서 sketch가 이루어진다. fac2d cketch의 기능을 쓸수있다 Point2D p1 = fac2d.CreatePoint(10, 10); Point2D p2 = fac2d.CreatePoint(10, 30); Point2D p3 = fac2d.CreatePoint(40, 30); Point2D p4 = fac2d.CreatePoint(40, 10); //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); CatConstraintType cnstDis = CatConstraintType.catCstTypeDistance; MECMOD.Constraint d1 = createCnst(prt, skt1, cnstDis, lin1, lin3); MECMOD.Constraint d2 = createCnst(prt, skt1, cnstDis, lin2, lin4); MECMOD.Constraint d3 = createCnst(prt, skt1, cnstDis, skt1.AbsoluteAxis.HorizontalReference, lin4); MECMOD.Constraint d4 = createCnst(prt, skt1, cnstDis, skt1.AbsoluteAxis.VerticalReference, lin1); /* * 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(skt1.AbsoluteAxis.HorizontalReference); * INFITF.Reference rlineV = prt.CreateReferenceFromGeometry(skt1.AbsoluteAxis.VerticalReference); * * MECMOD.Constraint d1 = skt1.Constraints.AddBiEltCst(CatConstraintType.catCstTypeDistance, rline1, rline3); * MECMOD.Constraint d2 = skt1.Constraints.AddBiEltCst(CatConstraintType.catCstTypeDistance, rline2, rline4); * MECMOD.Constraint d3 = skt1.Constraints.AddBiEltCst(CatConstraintType.catCstTypeDistance, rlineH, rline4); * MECMOD.Constraint d4 = skt1.Constraints.AddBiEltCst(CatConstraintType.catCstTypeDistance, rlineV, rline1); */ skt1.CloseEdition(); //create a circlr Sketch skt2 = skts.Add(xypln); Factory2D fac2d1 = skt2.OpenEdition(); //fac2d = skt2.OpenEdition(); //이렇게 함녀 된다. INFITF.Reference H = prt.CreateReferenceFromGeometry(skt2.AbsoluteAxis.HorizontalReference); INFITF.Reference V = prt.CreateReferenceFromGeometry(skt2.AbsoluteAxis.VerticalReference); Circle2D c = fac2d1.CreateClosedCircle(40, 30, 10); c.CenterPoint = p3; // MECMOD.Constraint orPtH = skt2.Constraints.AddBiEltCst(CatConstraintType.catCstTypeDistance,H,(INFITF.Reference)c); //MECMOD.Constraint orPtV = skt2.Constraints.AddBiEltCst(CatConstraintType.catCstTypeDistance, V, (INFITF.Reference)c); MECMOD.Constraint r = skt2.Constraints.AddMonoEltCst(CatConstraintType.catCstTypeRadius, (INFITF.Reference)c); skt2.CloseEdition(); ShapeFactory ShpFac = (ShapeFactory)prt.ShapeFactory; //pad Pad pad = ShpFac.AddNewPad(skt1, 20); //poket Pocket pock = ShpFac.AddNewPocket(skt2, 20); pock.DirectionOrientation = CatPrismOrientation.catRegularOrientation; prt.Update(); }
public override void ErzeugeProfil(Double b, Double h, Double p, Double q) { // Skizze umbenennen hsp_catiaProfil.set_Name("Rechteckhohl"); // Rechteck in Skizze einzeichnen // Skizze oeffnen Factory2D catFactory2D1 = hsp_catiaProfil.OpenEdition(); // Rechteck erzeugen // Punkte außen Point2D catPoint2D1 = catFactory2D1.CreatePoint(0, 0); Point2D catPoint2D2 = catFactory2D1.CreatePoint(0, h); Point2D catPoint2D3 = catFactory2D1.CreatePoint(b, h); Point2D catPoint2D4 = catFactory2D1.CreatePoint(b, 0); // Punkte innen Point2D catPoint2D5 = catFactory2D1.CreatePoint(p, p); Point2D catPoint2D6 = catFactory2D1.CreatePoint(p, h - p); Point2D catPoint2D7 = catFactory2D1.CreatePoint(b - p, h - p); Point2D catPoint2D8 = catFactory2D1.CreatePoint(b - p, p); // Linien innen Line2D catLine2D5 = catFactory2D1.CreateLine(p, p, p, h - p); catLine2D5.StartPoint = catPoint2D5; catLine2D5.EndPoint = catPoint2D6; Line2D catLine2D6 = catFactory2D1.CreateLine(p, h - p, b - p, h - p); catLine2D6.StartPoint = catPoint2D6; catLine2D6.EndPoint = catPoint2D7; Line2D catLine2D7 = catFactory2D1.CreateLine(b - p, h - p, b - p, p); catLine2D7.StartPoint = catPoint2D7; catLine2D7.EndPoint = catPoint2D8; Line2D catLine2D8 = catFactory2D1.CreateLine(b - p, p, p, p); catLine2D8.StartPoint = catPoint2D8; catLine2D8.EndPoint = catPoint2D5; // Linien außen Line2D catLine2D1 = catFactory2D1.CreateLine(0, 0, 0, h); catLine2D1.StartPoint = catPoint2D1; catLine2D1.EndPoint = catPoint2D2; Line2D catLine2D2 = catFactory2D1.CreateLine(0, h, b, h); catLine2D2.StartPoint = catPoint2D2; catLine2D2.EndPoint = catPoint2D3; Line2D catLine2D3 = catFactory2D1.CreateLine(b, h, b, 0); catLine2D3.StartPoint = catPoint2D3; catLine2D3.EndPoint = catPoint2D4; Line2D catLine2D4 = catFactory2D1.CreateLine(b, 0, 0, 0); catLine2D4.StartPoint = catPoint2D4; catLine2D4.EndPoint = catPoint2D1; // Skizzierer verlassen hsp_catiaProfil.CloseEdition(); // Part aktualisieren hsp_catiaPart.Part.Update(); }