internal void ErstelleFase(object[] ParameterListe) { bool GewindeFeature = Convert.ToBoolean(ParameterListe[10]); bool GewindeHelix = Convert.ToBoolean(ParameterListe[11]); myBody = hsp_catiaPart.Part.MainBody; hsp_catiaPart.Part.InWorkObject = myBody; if (GewindeHelix) { HybridShapeDirection HelixDir = HSF.AddNewDirectionByCoord(1, 0, 0); Reference RefHelixDir = hsp_catiaPart.Part.CreateReferenceFromObject(HelixDir); Groove myChamfer = SF.AddNewGroove(hsp_catiaProfil_Fase); myChamfer.RevoluteAxis = RefHelixDir; } else { Groove grooveFase = SF.AddNewGroove(hsp_catiaProfil_Fase); GeometricElements element1 = hsp_catiaProfil_Gewinde.GeometricElements; Axis2D axis2D1 = (Axis2D)element1.Item("Absolute Achse"); Reference reference3 = (Reference)axis2D1.GetItem("V-Richtung"); grooveFase.RevoluteAxis = reference3; } hsp_catiaPart.Part.Update(); }
internal void ErzeugeGewindeHelix(Schraube s) { Double P = s.metrischeGewindegroesse.steigung; Double Ri = s.metrischeGewindegroesse.bezeichnung / 2; HybridShapeFactory HSF = (HybridShapeFactory)hsp_catiaPart.Part.HybridShapeFactory; Sketch myGewinde = makeGewindeSkizze(s); HybridShapeDirection HelixDir = HSF.AddNewDirectionByCoord(1, 0, 0); Reference RefHelixDir = hsp_catiaPart.Part.CreateReferenceFromObject(HelixDir); HybridShapePointCoord HelixStartpunkt = HSF.AddNewPointCoord(s.schaftLaenge.schaftlaenge, 0, Ri); Reference RefHelixStartpunkt = hsp_catiaPart.Part.CreateReferenceFromObject(HelixStartpunkt); Boolean DrehrichtungLinks; if (s.gewinderichtung == Gewinderichtung.Rechtsgewinde) { DrehrichtungLinks = false; } else { DrehrichtungLinks = true; } HybridShapeHelix Helix = HSF.AddNewHelix(RefHelixDir, true, RefHelixStartpunkt, P, s.gewindeLaenge.gewindeLaenge, DrehrichtungLinks, 0, 0, false); Reference RefHelix = hsp_catiaPart.Part.CreateReferenceFromObject(Helix); Reference RefmyGewinde = hsp_catiaPart.Part.CreateReferenceFromObject(myGewinde); hsp_catiaPart.Part.Update(); hsp_catiaPart.Part.InWorkObject = hsp_catiaPart.Part.MainBody; OriginElements catOriginElements = this.hsp_catiaPart.Part.OriginElements; Reference RefmyPlaneZX = (Reference)catOriginElements.PlaneZX; Sketches catSketchesChamferHelix = catHybridBody1.HybridSketches; Sketch ChamferSkizze = catSketchesChamferHelix.Add(RefmyPlaneZX); hsp_catiaPart.Part.InWorkObject = ChamferSkizze; ChamferSkizze.set_Name("Fase"); double H_links = Ri; double V_links = s.schaftLaenge.schaftlaenge - 0.65 * P; double H_rechts = Ri; double V_rechts = s.schaftLaenge.schaftlaenge; double H_unten = Ri - 0.65 * P; double V_unten = s.schaftLaenge.schaftlaenge; Factory2D catFactory2D3 = ChamferSkizze.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; ChamferSkizze.CloseEdition(); hsp_catiaPart.Part.InWorkObject = hsp_catiaPart.Part.MainBody; hsp_catiaPart.Part.Update(); ShapeFactory catshapeFactoryHelix = (ShapeFactory)hsp_catiaPart.Part.ShapeFactory; Groove myChamfer = catshapeFactoryHelix.AddNewGroove(ChamferSkizze); myChamfer.RevoluteAxis = RefHelixDir; hsp_catiaPart.Part.Update(); Slot GewindeRille = catshapeFactoryHelix.AddNewSlotFromRef(RefmyGewinde, RefHelix); Reference RefmyPad = hsp_catiaPart.Part.CreateReferenceFromObject(SchaftPad); HybridShapeSurfaceExplicit GewindestangenSurface = HSF.AddNewSurfaceDatum(RefmyPad); Reference RefGewindestangenSurface = hsp_catiaPart.Part.CreateReferenceFromObject(GewindestangenSurface); GewindeRille.ReferenceSurfaceElement = RefGewindestangenSurface; Reference RefGewindeRille = hsp_catiaPart.Part.CreateReferenceFromObject(GewindeRille); hsp_catiaPart.Part.Update(); }