Example #1
0
 public Boolean ErzeugePart()
 {
     INFITF.Documents catDocuments1 = hsp_catiaApp.Documents;
     hsp_catiaPart = catDocuments1.Add("Part") as MECMOD.PartDocument;
     // hsp_catiaPart.set_Name("Rechteckprofil");
     return(true);
 }
Example #2
0
        public bool InitCATIADrawing(bool bNewDrawing, string strDarwins)
        {
            if (bNewDrawing)
            {
                //初始化
                docCATIA    = CATIA.Documents;
                oDrawingDoc = (DrawingDocument)docCATIA.Add("Drawing");
            }
            else
            {
                if (strDarwins.Trim() == "")
                {
                    oDrawingDoc = (DrawingDocument)CATIA.ActiveDocument;
                    if (oDrawingDoc == null)
                    {
                        docCATIA    = CATIA.Documents;
                        oDrawingDoc = (DrawingDocument)docCATIA.Add("Drawing");
                    }
                }
                else
                {
                    if (System.IO.File.Exists(strDarwins)) //有文件
                    {
                        oDrawingDoc = (DrawingDocument)CATIA.Documents.Open(strDarwins);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Example #3
0
        public bool InitCATIAProduct(bool bNewProduct, string strProduct)
        {
            if (bNewProduct)
            {
                //初始化
                docCATIA    = CATIA.Documents;
                oProductDoc = (ProductDocument)docCATIA.Add("Product");
            }
            else
            {
                if (strProduct.Trim() == "")
                {
                    oProductDoc = (ProductDocument)CATIA.ActiveDocument;
                    if (oProductDoc == null)
                    {
                        docCATIA    = CATIA.Documents;
                        oProductDoc = (ProductDocument)docCATIA.Add("Product");
                    }
                }
                else
                {
                    if (System.IO.File.Exists(strProduct)) //有文件
                    {
                        oProductDoc = (ProductDocument)CATIA.Documents.Open(strProduct);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
        public Boolean ErzeugePart()
        {
            INFITF.Documents catDocuments1 = hsp_catiaApp.Documents;
            hsp_catiaPartDoc = catDocuments1.Add("Part") as MECMOD.PartDocument;
            myPart           = hsp_catiaPartDoc.Part;

            return(true);
        }
Example #5
0
        internal void ErzeugePart()
        {
            //Dokument erstellen
            catDokuments1 = hsp_catiaApp.Documents;

            //Part erstellen
            hsp_catiaPartDoc = (PartDocument)catDokuments1.Add("Part");
        }
Example #6
0
        public bool InitCATIAPart(bool bNewPart, string strPart)
        {
            if (bNewPart)
            {
                //初始化
                docCATIA = CATIA.Documents;
                oPartDoc = (MECMOD.PartDocument)docCATIA.Add("Part");
            }
            else
            {
                if (strPart.Trim() == "")
                {
                    oPartDoc = (MECMOD.PartDocument)CATIA.ActiveDocument;
                    if (oPartDoc == null)
                    {
                        docCATIA = CATIA.Documents;
                        oPartDoc = (MECMOD.PartDocument)docCATIA.Add("Part");
                    }
                }
                else
                {
                    if (System.IO.File.Exists(strPart)) //有文件
                    {
                        oPartDoc = (MECMOD.PartDocument)CATIA.Documents.Open(strPart);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            oPart    = oPartDoc.Part;
            oBodies  = oPart.Bodies;
            oBody    = oPart.MainBody;
            oHBodies = oPart.HybridBodies;

            oSF  = (ShapeFactory)oPart.ShapeFactory;
            oHSF = (HybridShapeFactory)oPart.HybridShapeFactory;

            return(true);
        }
Example #7
0
        public void ReadDocs()
        {
            INFITF.Documents docs = myCATIA.Documents;
            Console.WriteLine("Nbr of documents := " + docs.Count.ToString());
            Console.ReadLine();

            if (docs.Count == 0)
            {
                PartDocument partDoc  = (PartDocument)docs.Add("Part");
                Part         rootPart = partDoc.Part;
            }

            string temp = string.Empty;

            foreach (Document doc in docs)
            {
                temp += doc.FullName + '\n';
            }
            Console.WriteLine(" --- Components --- \n " + temp);
        }
        public Boolean ErzeugePart()
        {
            bool   abfrage = true;
            String inputBoxEingabe;

            INFITF.Documents catDocuments1 = catiaAnwendung.Documents;
            catiaPart = catDocuments1.Add("Part") as MECMOD.PartDocument;
            string partnummer1;

            try
            {
                catiaPart = (MECMOD.PartDocument)catiaAnwendung.ActiveDocument;
                product1  = catiaPart.Product;
            }
            catch
            {
                try
                {
                    activedocproduct = (ProductStructureTypeLib.ProductDocument)catiaAnwendung.ActiveDocument;
                    product1         = activedocproduct.Product;
                    abfrage          = true;
                }
                catch
                {
                    MessageBox.Show("Teilenummer konnte nicht ermittelt werden");
                    abfrage = false;
                }
            }


            partnummer1     = product1.get_PartNumber();
            inputBoxEingabe = Interaction.InputBox("Möchten Sie dem Part eine neue Teilenummer zuweisen?", "Zugriff auf Catia V5", partnummer1);
            if ((string)inputBoxEingabe == "")
            {
                inputBoxEingabe = partnummer1;
            }
            product1.set_PartNumber(ref inputBoxEingabe);
            return(abfrage);
        }
Example #9
0
 public void PartKreis_hohl()
 {
     INFITF.Documents Kreis_hohl_Part = CATIA_Kreis_hohl.Documents;
     CATIA_Kreis_hohl_Part = Kreis_hohl_Part.Add("Part") as MECMOD.PartDocument;
 }
Example #10
0
 public void PartSonderU()
 {
     INFITF.Documents SonderU_Part = CATIA_SonderU.Documents;
     CATIA_SonderU_Part = SonderU_Part.Add("Part") as MECMOD.PartDocument;
 }
Example #11
0
 //Methode zur erstellung eines neuen Parts
 internal void ErzeugePart()
 {
     INFITF.Documents catDocuments1 = hspB1_catiaApp.Documents;
     hspB1_catiaPart = (PartDocument)catDocuments1.Add("Part");
 }
 public void PartRechteck_hohl()
 {
     INFITF.Documents Rechteck_hohl_Part = CATIA_Rechteck_hohl.Documents;
     CATIA_Rechteck_hohl_Part = Rechteck_hohl_Part.Add("Part") as MECMOD.PartDocument;
 }
Example #13
0
        public CAD(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]);
            string Schraubenrichtung = Convert.ToString(ParameterListe[9]);
            bool   GewindeFeature    = Convert.ToBoolean(ParameterListe[10]);
            bool   GewindeHelix      = Convert.ToBoolean(ParameterListe[11]);

            //Hier wird das gesamte Modell erstellt, wenn nichts schief geht
            try
            {
                //Abfrage ob Catia geöffnet ist
                if (CatiaLaeuft())
                {
                    //Erstellt ein neues Part
                    INFITF.Documents catDocuments1 = hsp_catiaApp.Documents;
                    hsp_catiaPart = catDocuments1.Add("Part") as MECMOD.PartDocument;

                    //Erstellt alle Skizzen
                    ErstelleLeereSkizze();

                    //Erstellt ein Profil vom Kopf
                    ProfilKopf(ParameterListe);

                    //Erstellt einen Block für den Kopf
                    if (Kopf == 1 | Kopf == 2)
                    {
                        BlockKopfErstellen(ParameterListe);
                    }
                    else
                    {
                        RotationskörperErstellen();
                    }

                    //Erstellt ein Profil für den Schaft
                    ProfilSchaft(ParameterListe);

                    //Erstellt ein Block für den Schaft
                    BlockSchaftErstellen(ParameterListe);

                    if (Kopf == 2 | Kopf == 3)
                    {
                        ErstelleTascheProfil(ParameterListe);
                        ErstelleTasche(ParameterListe);
                    }


                    //Erstellt Gewinde am Schaft
                    if (GewindeFeature)
                    {
                        Gewindefeature(ParameterListe);
                    }

                    if (GewindeHelix)
                    {
                        //makeGewindeSkizze(ParameterListe);
                        ErzeugeGewindeHelix(ParameterListe);
                    }

                    ErstelleFaseProfil(ParameterListe);
                    ErstelleFase(ParameterListe);
                }

                else
                {
                    MessageBox.Show("Laufende Catia Application nicht gefunden");
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Exception aufgetreten");
            }
        }