Exemplo n.º 1
0
        internal void ErzeugeGewindehelix(Schraube arr)
        {
            hybridshapefac = (HybridShapeFactory)part_Schraube.HybridShapeFactory;

            // Skizze für Gewindeprofiel
            Sketch gewinde = Gewindeskizze(arr);

            // "Rotationsachse" festlegen
            HybridShapeDirection HelixDir   = hybridshapefac.AddNewDirectionByCoord(1, 0, 0);
            Reference            RefHelxDir = part_Schraube.CreateReferenceFromObject(HelixDir);

            //Startpunkt festlegen
            HybridShapePointCoord Helixstartpunkt    = hybridshapefac.AddNewPointCoord(0, 0, 0.5 * arr.durchmesser);
            Reference             RefHelixstartpunkt = part_Schraube.CreateReferenceFromObject(Helixstartpunkt);

            //Helix Erstellen
            HybridShapeHelix Helix = hybridshapefac.AddNewHelix(RefHelxDir, false, RefHelixstartpunkt, arr.gewindesteigung, arr.gewindelaenge - 1, false, 0, 0, false);

            // Drehrichtung, Startpunkt             Steigung                Höhe             Drehrichtung  Anfangswinkel ...
            Reference RefHelix   = part_Schraube.CreateReferenceFromObject(Helix);
            Reference RefGewinde = part_Schraube.CreateReferenceFromObject(gewinde);

            part_Schraube.Update();

            part_Schraube.InWorkObject = body_Schraube;

            OriginElements catoriginElements = this.part_Schraube.OriginElements;
            Reference      RefPlanezx        = (Reference)catoriginElements.PlaneZX;

            //Rille erzeugen
            Slot GewindeRille = shapefac.AddNewSlotFromRef(RefGewinde, RefHelix);

            Reference RefmyPad = part_Schraube.CreateReferenceFromObject(schaft);
            HybridShapeSurfaceExplicit GewindestangenSurface = hybridshapefac.AddNewSurfaceDatum(RefmyPad);
            Reference RefGewindestangenSurface = part_Schraube.CreateReferenceFromObject(GewindestangenSurface);

            GewindeRille.ReferenceSurfaceElement = RefGewindestangenSurface;

            Reference RefGewindeRille = part_Schraube.CreateReferenceFromObject(GewindeRille);

            part_Schraube.Update();
        }
Exemplo n.º 2
0
        internal void ErzeugeGewindeHelix(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 helixAchseStart = Gewindelänge + Schaftlänge + Kopfhöhe;
            Double P  = Steigung;
            Double Ri = Durchmesser / 2;

            myPart = hsp_catiaPart.Part;
            myBody = myPart.MainBody;

            HSF = (HybridShapeFactory)myPart.HybridShapeFactory;

            myGewinde = makeGewindeSkizze(ParameterListe);

            HybridShapeDirection HelixDir    = HSF.AddNewDirectionByCoord(1, 0, 0);
            Reference            RefHelixDir = myPart.CreateReferenceFromObject(HelixDir);

            HybridShapePointCoord HelixStartpunkt    = HSF.AddNewPointCoord(helixAchseStart, 0, Ri);
            Reference             RefHelixStartpunkt = myPart.CreateReferenceFromObject(HelixStartpunkt);

            if (SchraubenrichtungInt == 0)
            {
                Helix = HSF.AddNewHelix(RefHelixDir, true, RefHelixStartpunkt, P, Gewindelänge, false, 0, 0, true);
            }

            if (SchraubenrichtungInt == 1)
            {
                Helix = HSF.AddNewHelix(RefHelixDir, true, RefHelixStartpunkt, P, Gewindelänge, true, 0, 0, true);
            }



            Reference RefHelix     = myPart.CreateReferenceFromObject(Helix);
            Reference RefmyGewinde = myPart.CreateReferenceFromObject(myGewinde);

            hsp_catiaPart.Part.Update();

            myPart.InWorkObject = myBody;

            OriginElements catOriginElements = this.hsp_catiaPart.Part.OriginElements;
            Reference      RefmyPlaneZX      = (Reference)catOriginElements.PlaneZX;



            Slot GewindeRille = SF.AddNewSlotFromRef(RefmyGewinde, RefHelix);

            Reference RefmyPad = myPart.CreateReferenceFromBRepName(
                "RSur:(Face:(Brp:(Pad.2;0:(Brp:(Sketch.2;1)));None:();Cf11:());WithTemporaryBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", Schaft);



            if (Kopf == 1 || Kopf == 2)
            {
                HybridShapeSurfaceExplicit GewindestangenSurface = HSF.AddNewSurfaceDatum(RefmyPad);
                Reference RefGewindestangenSurface = myPart.CreateReferenceFromBRepName(
                    "FSur:(Face:(Brp:(Pad.2;0:(Brp:(Sketch.2;1)));None:();Cf12:());WithTemporaryBody;WithoutBuildError;WithInitialFeatureSupport;MFBRepVersion_CXR29)", Schaft);
                GewindeRille.ReferenceSurfaceElement = RefGewindestangenSurface;
            }

            if (Kopf == 3)
            {
                //HybridShapeSurfaceExplicit GewindestangenSurface = HSF.AddNewSurfaceDatum(RefmyPad);
                Reference RefGewindestangenSurface = myPart.CreateReferenceFromBRepName(
                    "FSur:(Face:(Brp:(Pad.1;0:(Brp:(Sketch.2;1)));None:();Cf12:());WithTemporaryBody;WithoutBuildError;WithInitialFeatureSupport;MFBRepVersion_CXR29)", Schaft);
                GewindeRille.ReferenceSurfaceElement = RefGewindestangenSurface;
            }
            myPart.Update();



            Reference RefGewindeRille = myPart.CreateReferenceFromObject(GewindeRille);

            myPart.Update();
        }
Exemplo n.º 3
0
        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();
        }