Разработка прикладной библиотеки автоматизированного проектирования сборочной модели переходника

Автор работы: Пользователь скрыл имя, 05 Февраля 2015 в 18:11, курсовая работа

Краткое описание

На настоящий момент САПР становятся обязательной частью любой производственной экономической деятельности. Они помогают обеспечить жизнеспособность фирмы и дают ей возможность развиваться в нынешних условиях жесткой рыночной конкуренции. Основной вклад подобных систем состоит в следующем:
- повышение качества продукции за счет сокращения ошибок в конструкторских и технологических расчетах, удобства внесения инженерных изменений и контроля качества;

Прикрепленные файлы: 1 файл

dip.doc

— 1.74 Мб (Скачать документ)

            double[] origin15 = { 144.5, 19.5, 60 };

            double[] origin16 = { 32, 82, 98 + lengthcylk };

            double[] origin17 = { 132, 82, 98 + lengthcylk };

            double[] origin18 = { 82, 32, 98 + lengthcylk };

            double[] origin19 = { 82, 132, 98 + lengthcylk };

            double[] origin20 = { 32, 82, 138 };

            double[] origin21 = { 132, 82, 138 };

            double[] origin22 = { 82, 32, 138 };

            double[] origin23 = { 82, 132, 138 };

            double[] origin24 = { 32, 82, 38 + lengthcylk };

            double[] origin25 = { 132, 82, 38 + lengthcylk };

            double[] origin26 = { 82, 32, 38 + lengthcylk };

            double[] origin27 = { 82, 132, 38 + lengthcylk };

            double[] origin28 = { 32, 82, 48 + lengthcylk };

            double[] origin29 = { 132, 82, 48 + lengthcylk };

            double[] origin30 = { 82, 32, 48 + lengthcylk };

            double[] origin31 = { 82, 132, 48 + lengthcylk };

 

            theUfSession.Assem.AddPartToAssembly(parent_part, "flanec", null, null, origin1, matrix1, 0, out instance, out error_status);

            theUfSession.Assem.AddPartToAssembly(parent_part, "procladka_niz", null, null, origin2, matrix1, 0, out instance, out error_status);

            theUfSession.Assem.AddPartToAssembly(parent_part, "osnovan_niz", null, null, origin3, matrix2, 0, out instance, out error_status);

            theUfSession.Assem.AddPartToAssembly(parent_part, "cylk", null, null, origin4, matrix1, 0, out instance, out error_status);

            theUfSession.Assem.AddPartToAssembly(parent_part, "osnovan_verh", null, null, origin5, matrix2, 0, out instance, out error_status);

            theUfSession.Assem.AddPartToAssembly(parent_part, "procladka_verh", null, null, origin6, matrix1, 0, out instance, out error_status);

            theUfSession.Assem.AddPartToAssembly(parent_part, "zaglush", null, null, origin7, matrix2, 0, out instance, out error_status);

            theUfSession.Assem.AddPartToAssembly(parent_part, "bolt1", null, null, origin8, matrix3, 0, out instance, out error_status);

            theUfSession.Assem.AddPartToAssembly(parent_part, "bolt1", null, null, origin9, matrix3, 0, out instance, out error_status);

            theUfSession.Assem.AddPartToAssembly(parent_part, "bolt1", null, null, origin10, matrix3, 0, out instance, out error_status);

            theUfSession.Assem.AddPartToAssembly(parent_part, "bolt1", null, null, origin11, matrix3, 0, out instance, out error_status);

 

            theUfSession.Assem.AddPartToAssembly(parent_part, "gayka", null, null, origin12, matrix4, 0, out instance, out error_status);

            theUfSession.Assem.AddPartToAssembly(parent_part, "gayka", null, null, origin13, matrix4, 0, out instance, out error_status);

            theUfSession.Assem.AddPartToAssembly(parent_part, "gayka", null, null, origin14, matrix4, 0, out instance, out error_status);

            theUfSession.Assem.AddPartToAssembly(parent_part, "gayka", null, null, origin15, matrix4, 0, out instance, out error_status);

 

            theUfSession.Assem.AddPartToAssembly(parent_part, "gayka2", null, null, origin16, matrix4, 0, out instance, out error_status);

            theUfSession.Assem.AddPartToAssembly(parent_part, "gayka2", null, null, origin17, matrix4, 0, out instance, out error_status);

            theUfSession.Assem.AddPartToAssembly(parent_part, "gayka2", null, null, origin18, matrix4, 0, out instance, out error_status);

            theUfSession.Assem.AddPartToAssembly(parent_part, "gayka2", null, null, origin19, matrix4, 0, out instance, out error_status);

 

   

            if (comboBox1.Text == "3")

            {

                theUfSession.Assem.AddPartToAssembly(parent_part, "bolt2", null, null, origin28, matrix3, 0, out instance, out error_status);

                theUfSession.Assem.AddPartToAssembly(parent_part, "bolt2", null, null, origin29, matrix3, 0, out instance, out error_status);

                theUfSession.Assem.AddPartToAssembly(parent_part, "bolt2", null, null, origin30, matrix3, 0, out instance, out error_status);

                theUfSession.Assem.AddPartToAssembly(parent_part, "bolt2", null, null, origin31, matrix3, 0, out instance, out error_status);

            }

           

            if (comboBox1.Text == "1")

            {

                theUfSession.Assem.AddPartToAssembly(parent_part, "bolt2", null, null, origin20, matrix3, 0, out instance, out error_status);

                theUfSession.Assem.AddPartToAssembly(parent_part, "bolt2", null, null, origin21, matrix3, 0, out instance, out error_status);

                theUfSession.Assem.AddPartToAssembly(parent_part, "bolt2", null, null, origin22, matrix3, 0, out instance, out error_status);

                theUfSession.Assem.AddPartToAssembly(parent_part, "bolt2", null, null, origin23, matrix3, 0, out instance, out error_status);

 

            }

 

          

            if (comboBox1.Text == "2")

            {

                theUfSession.Assem.AddPartToAssembly(parent_part, "bolt3", null, null, origin24, matrix3, 0, out instance, out error_status);

                theUfSession.Assem.AddPartToAssembly(parent_part, "bolt3", null, null, origin25, matrix3, 0, out instance, out error_status);

                theUfSession.Assem.AddPartToAssembly(parent_part, "bolt3", null, null, origin26, matrix3, 0, out instance, out error_status);

                theUfSession.Assem.AddPartToAssembly(parent_part, "bolt3", null, null, origin27, matrix3, 0, out instance, out error_status);

            }

            theSession.DisplayManager.HideByType(DisplayManager.ShowHideType.Curves, DisplayManager.ShowHideScope.AnyInAssembly);

        }

 

        public void Dispose()

        {

           isDisposeCalled = true;

        }

       

       

        public static int GetUnloadOption(string arg)

        {

            return System.Convert.ToInt32(Session.LibraryUnloadOption.Immediately);

        }

 

        void bolt3()

        {

            Tag squares1;

            string name1 = "bolt3";

            int units1 = 1;

            theUfSession.Part.New(name1, units1, out squares1);

 

            double[] point_A1 = { 0.0, 0.0, 0.0 };

            double[] point_A2 = { 0.0, 13.0, 0.0 };

            double[] point_A3 = { 80.0, 13.0, 0.0 };

            double[] point_A4 = { 80.0, 0.0, 0.0 };

 

            double[] point_B1 = { 0.0, -18, 10.3923 };

            double[] point_B2 = { 0.0, 0.0, 20.7846 };

            double[] point_B3 = { 0.0, 18, 10.3923 };

            double[] point_B4 = { 0.0, 18, -10.3923 };

            double[] point_B5 = { 0.0, 0.0, -20.7846 };

            double[] point_B6 = { 0.0, -18, -10.3923 };

 

            double[] point_C1 = { -15.0, 18, 0.0 };

            double[] point_C2 = { -15.0, (18 + 5), 0.0 };

            double[] point_C3 = { -(15 - 3), (18 + 5), 0.0 };

 

            UFCurve.Line line_A1 = new UFCurve.Line();

           UFCurve.Line line_A2 = new UFCurve.Line();

            UFCurve.Line line_A3 = new UFCurve.Line();

            UFCurve.Line line_A4 = new UFCurve.Line();

 

            UFCurve.Line line_B1 = new UFCurve.Line();

            UFCurve.Line line_B2 = new UFCurve.Line();

            UFCurve.Line line_B3 = new UFCurve.Line();

            UFCurve.Line line_B4 = new UFCurve.Line();

            UFCurve.Line line_B5 = new UFCurve.Line();

            UFCurve.Line line_B6 = new UFCurve.Line();

 

            UFCurve.Line line_C1 = new UFCurve.Line();

            UFCurve.Line line_C2 = new UFCurve.Line();

            UFCurve.Line line_C3 = new UFCurve.Line();

 

            line_A1.start_point = new double[3];

            line_A1.end_point = new double[3];

            line_A2.start_point = new double[3];

            line_A2.end_point = new double[3];

            line_A3.start_point = new double[3];

            line_A3.end_point = new double[3];

            line_A4.start_point = new double[3];

            line_A4.end_point = new double[3];

 

            line_B1.start_point = new double[3];

            line_B1.end_point = new double[3];

            line_B2.start_point = new double[3];

            line_B2.end_point = new double[3];

            line_B3.start_point = new double[3];

            line_B3.end_point = new double[3];

            line_B4.start_point = new double[3];

            line_B4.end_point = new double[3];

            line_B5.start_point = new double[3];

            line_B5.end_point = new double[3];

            line_B6.start_point = new double[3];

            line_B6.end_point = new double[3];

 

            line_C1.start_point = new double[3];

            line_C1.end_point = new double[3];

            line_C2.start_point = new double[3];

            line_C2.end_point = new double[3];

            line_C3.start_point = new double[3];

            line_C3.end_point = new double[3];

 

            for (int i = 0; i < 3; i++)

            {

                line_A1.start_point[i] = point_A1[i];

                line_A1.end_point[i] = point_A2[i];

                line_A2.start_point[i] = point_A2[i];

                line_A2.end_point[i] = point_A3[i];

                line_A3.start_point[i] = point_A3[i];

                line_A3.end_point[i] = point_A4[i];

                line_A4.start_point[i] = point_A4[i];

                line_A4.end_point[i] = point_A1[i];

 

                line_B1.start_point[i] = point_B1[i];

                line_B1.end_point[i] = point_B2[i];

                line_B2.start_point[i] = point_B2[i];

                line_B2.end_point[i] = point_B3[i];

                line_B3.start_point[i] = point_B3[i];

                line_B3.end_point[i] = point_B4[i];

                line_B4.start_point[i] = point_B4[i];

                line_B4.end_point[i] = point_B5[i];

                line_B5.start_point[i] = point_B5[i];

                line_B5.end_point[i] = point_B6[i];

                line_B6.start_point[i] = point_B6[i];

                line_B6.end_point[i] = point_B1[i];

 

                line_C1.start_point[i] = point_C1[i];

                line_C1.end_point[i] = point_C2[i];

                line_C2.start_point[i] = point_C2[i];

                line_C2.end_point[i] = point_C3[i];

                line_C3.start_point[i] = point_C3[i];

                line_C3.end_point[i] = point_C1[i];

            }

 

            Tag[] sketch1 = new Tag[4];

            theUfSession.Curve.CreateLine(ref line_A1, out sketch1[0]);

            theUfSession.Curve.CreateLine(ref line_A2, out sketch1[1]);

            theUfSession.Curve.CreateLine(ref line_A3, out sketch1[2]);

            theUfSession.Curve.CreateLine(ref line_A4, out sketch1[3]);

 

            Tag[] sketch2 = new Tag[6];

            theUfSession.Curve.CreateLine(ref line_B1, out sketch2[0]);

            theUfSession.Curve.CreateLine(ref line_B2, out sketch2[1]);

            theUfSession.Curve.CreateLine(ref line_B3, out sketch2[2]);

            theUfSession.Curve.CreateLine(ref line_B4, out sketch2[3]);

            theUfSession.Curve.CreateLine(ref line_B5, out sketch2[4]);

            theUfSession.Curve.CreateLine(ref line_B6, out sketch2[5]);

 

            Tag[] sketch3 = new Tag[3];

            theUfSession.Curve.CreateLine(ref line_C1, out sketch3[0]);

            theUfSession.Curve.CreateLine(ref line_C2, out sketch3[1]);

            theUfSession.Curve.CreateLine(ref line_C3, out sketch3[2]);

 

            double[] ref_pt1 = new double[3];

            ref_pt1[0] = 0.00;

            ref_pt1[1] = 0.00;

            ref_pt1[2] = 0.00;

            double[] direction1 = { 1.00, 0.00, 0.00 };

            string[] limit1 = { "0", "360" };

            Tag[] body1;

            theUfSession.Modl.CreateRevolved(sketch1, limit1, ref_pt1, direction1, FeatureSigns.Nullsign, out body1);

 

            string taper_angle = "0.0";

            string[] limit_extrude1 = { "0", "15" };

            double[] ref_pt_extrude = { 0.0, 0.0, 0.0 };

            double[] direction_extrude1 = { -1.0, 0.0, 0.0 };

 

            theUfSession.Modl.CreateExtruded(

            sketch2/*Массив объектов выдавливания*/,

            taper_angle/*Угол уклона*/,

            limit_extrude1/*Начало и конец выдавливания*/,

            ref_pt_extrude /*базовая точка*/,

            direction_extrude1/*Направление выдавливания*/,

            FeatureSigns.Positive/*Буревая операция (ВЫЧИТАНИЕ)*/,

            out body1);

            theUfSession.Modl.CreateRevolved(sketch3, limit1, ref_pt1, direction1, FeatureSigns.Negative, out body1);

 

            theSession.DisplayManager.HideByType(DisplayManager.ShowHideType.Curves, DisplayManager.ShowHideScope.AnyInAssembly);

 

            //СОЗДАНИЕ ФАСОК И СКРУГЛЕНИЙ

 

            Tag feat1 = body1[0];

            Tag objTag1;

            Tag[] edgeArray1;

            int edgeCount;

            Tag obj_id_camf;

            Tag[] list1;

 

            theUfSession.Modl.AskFeatBody(feat1, out objTag1);// Выделение объектов детали из ее тела.

            theUfSession.Modl.AskBodyEdges(objTag1, out edgeArray1);// Выделение ребер объектов детали.

            theUfSession.Modl.AskListCount(edgeArray1, out edgeCount);// Подсчет количества ребер детали.

            ArrayList arrList1 = new ArrayList();// Массивы ребер для создания скруглений и фасок:

            for (int ii = 0; ii < edgeCount; ii++)// Перебор ребер детали:

            {

                Tag edge;

                theUfSession.Modl.AskListItem(edgeArray1, ii, out edge);

                if (ii == 5)

                {

                    arrList1.Add(edge);

                }

            }

            list1 = (Tag[])arrList1.ToArray(typeof(Tag));

 

            // Параметры фаски:

            string offset1 = "1";

            string offset2 = "1";

            string ang = "45";

            // Создание фаски.

            theUfSession.Modl.CreateChamfer(3, offset1, offset2, ang, list1, out obj_id_camf);

        }

        /*---------------------------------------------------------------------------------------------------------------------------------*/

        void bolt2()

        {

            Tag squares1;

            string name1 = "bolt2";

            int units1 = 1;

            theUfSession.Part.New(name1, units1, out squares1);

 

            double[] point_A1 = { 0.0, 0.0, 0.0 };

            double[] point_A2 = { 0.0, 13.0, 0.0 };

            double[] point_A3 = { 70.0, 13.0, 0.0 };

            double[] point_A4 = { 70.0, 0.0, 0.0 };

 

            /*double[] point_B1 = { 0.0, -18, 10.3923 };

            double[] point_B2 = { 0.0, 0.0, 20.7846 };

            double[] point_B3 = { 0.0, 18, 10.3923 };

            double[] point_B4 = { 0.0, 18, -10.3923 };

            double[] point_B5 = { 0.0, 0.0, -20.7846 };

            double[] point_B6 = { 0.0, -18, -10.3923 };*/

 

           /* double[] point_C1 = { -15.0, 18, 0.0 };

            double[] point_C2 = { -15.0, (18 + 5), 0.0 };

            double[] point_C3 = { -(15 - 3), (18 + 5), 0.0 };*/

 

            UFCurve.Line line_A1 = new UFCurve.Line();

            UFCurve.Line line_A2 = new UFCurve.Line();

            UFCurve.Line line_A3 = new UFCurve.Line();

            UFCurve.Line line_A4 = new UFCurve.Line();

 

            UFCurve.Line line_B1 = new UFCurve.Line();

            UFCurve.Line line_B2 = new UFCurve.Line();

            UFCurve.Line line_B3 = new UFCurve.Line();

            UFCurve.Line line_B4 = new UFCurve.Line();

            UFCurve.Line line_B5 = new UFCurve.Line();

            UFCurve.Line line_B6 = new UFCurve.Line();

 

            UFCurve.Line line_C1 = new UFCurve.Line();

            UFCurve.Line line_C2 = new UFCurve.Line();

            UFCurve.Line line_C3 = new UFCurve.Line();

 

            line_A1.start_point = new double[3];

            line_A1.end_point = new double[3];

            line_A2.start_point = new double[3];

            line_A2.end_point = new double[3];

            line_A3.start_point = new double[3];

            line_A3.end_point = new double[3];

            line_A4.start_point = new double[3];

            line_A4.end_point = new double[3];

 

            line_B1.start_point = new double[3];

            line_B1.end_point = new double[3];

            line_B2.start_point = new double[3];

            line_B2.end_point = new double[3];

            line_B3.start_point = new double[3];

            line_B3.end_point = new double[3];

            line_B4.start_point = new double[3];

            line_B4.end_point = new double[3];

            line_B5.start_point = new double[3];

            line_B5.end_point = new double[3];

            line_B6.start_point = new double[3];

            line_B6.end_point = new double[3];

 

            line_C1.start_point = new double[3];

            line_C1.end_point = new double[3];

            line_C2.start_point = new double[3];

            line_C2.end_point = new double[3];

            line_C3.start_point = new double[3];

            line_C3.end_point = new double[3];

 

            for (int i = 0; i < 3; i++)

            {

                line_A1.start_point[i] = point_A1[i];

                line_A1.end_point[i] = point_A2[i];

                line_A2.start_point[i] = point_A2[i];

                line_A2.end_point[i] = point_A3[i];

                line_A3.start_point[i] = point_A3[i];

                line_A3.end_point[i] = point_A4[i];

                line_A4.start_point[i] = point_A4[i];

                line_A4.end_point[i] = point_A1[i];

 

                /*line_B1.start_point[i] = point_B1[i];

                line_B1.end_point[i] = point_B2[i];

                line_B2.start_point[i] = point_B2[i];

Информация о работе Разработка прикладной библиотеки автоматизированного проектирования сборочной модели переходника