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

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

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

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

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

dip.doc

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

            double[] matrix1 = { 1, 0, 0, 0, 1, 0, 0, 0, -1 };

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

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

            FeatureSigns Nullsing = FeatureSigns.Nullsign;

            FeatureSigns Negative = FeatureSigns.Negative;

 

            round2(taper_angle1, arc1_centerpt1, arc1_start_ang1, arc1_end_ang1, arc1_rad1,

            startheight1, height1, matrix1, ref_pt_extrude1, direction_extrude1, Nullsing);

 

            double arc1_rad2 = 25;

 

            round2(taper_angle1, arc1_centerpt1, arc1_start_ang1, arc1_end_ang1, arc1_rad2,

            startheight1, height1, matrix1, ref_pt_extrude1, direction_extrude1, Negative);

 

            if (comboBox1.Text == "2")

            {

                double arc1_rad3 = 17;

                double[] arc1_centerpt3 = { 0, length/2, 0 };

                double[] matrix3 = { 1, 0, 0, 0, 0, 1, 0, 1, 0 };

                double[] direction_extrude3 = { 0.0, 1.0, 0.0 };

                round2(taper_angle1, arc1_centerpt3, arc1_start_ang1, arc1_end_ang1, arc1_rad3,

                     startheight1, height1, matrix3, ref_pt_extrude1, direction_extrude3, Negative);

            }

        }

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

        void osnovan_niz()

        {

            Tag squares1;

            string name1 = "osnovan_niz";

            int units1 = 1;

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

            Tag[] body1;

            Tag[] body2;

            Tag[] body3;

            Tag[] body4;

            Tag[] body5;

            Tag[] body6;

            Tag[] body7;

            //прямоугольник1

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

            double[] point_B = { 0, 164, 0.0 };

            double[] point_C = { 164, 164, 0.0 };

            double[] point_D = { 164, 0, 0.0 };

            string taper_angle = "0.0";

            double startheight_rect = 0;

            double height_rect = 20;

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

            double[] direction_extrude0 = { 0.0, 0.0, 1.0 };

            FeatureSigns Operaciy_rect = FeatureSigns.Nullsign;

 

            body1 = rectangl(point_A, point_B, point_C, point_D, startheight_rect, height_rect, taper_angle,

                ref_pt_extrude0, direction_extrude0, Operaciy_rect);

 

 

 

            //круг1

            string taper_angle1 = "0.0";

            double[] arc1_centerpt1 = { 82, 82, 0 };

            double arc1_start_ang1 = 0.0;

            double arc1_end_ang1 = 3.14159265358979324 * 2;

            double arc1_rad1 = 30;

            double startheight1 = 0;

            double height1 = 12;

            double[] matrix1 = { 1, 0, 0, 0, 1, 0, 0, 0, -1 };

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

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

            FeatureSigns Nullsing = FeatureSigns.Nullsign;

            FeatureSigns Negative = FeatureSigns.Negative;

 

            body2 = round(taper_angle1, arc1_centerpt1, arc1_start_ang1, arc1_end_ang1, arc1_rad1,

            startheight1, height1, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body1);

 

 

            double height2 = 20;

 

            double arc1_rad3 = 15.4;

            double[] arc1_centerpt3 = { 19.5, 19.5, 0 };

            body3 = round(taper_angle1, arc1_centerpt3, arc1_start_ang1, arc1_end_ang1, arc1_rad3,

            startheight1, height2, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body2);

 

 

            double[] arc1_centerpt4 = { 144.5, 19.5, 0 };

            body4 = round(taper_angle1, arc1_centerpt4, arc1_start_ang1, arc1_end_ang1, arc1_rad3,

            startheight1, height2, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body3);

 

 

            double[] arc1_centerpt5 = { 19.5, 144.5, 0 };

            body5 = round(taper_angle1, arc1_centerpt5, arc1_start_ang1, arc1_end_ang1, arc1_rad3,

            startheight1, height2, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body4);

 

            double[] arc1_centerpt6 = { 144.5, 144.5, 0 };

            body6 = round(taper_angle1, arc1_centerpt6, arc1_start_ang1, arc1_end_ang1, arc1_rad3,

            startheight1, height2, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body5);

 

            double arc1_rad7 = 26;

            double startheight7 = 12;

            double height7 = 20;

            body7 = round(taper_angle1, arc1_centerpt1, arc1_start_ang1, arc1_end_ang1, arc1_rad7,

           startheight7, height7, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body6);

 

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

            Tag feat1 = body7[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 == 1) || (ii == 2) || (ii == 3) || (ii == 0))

                {

                    arrList1.Add(edge);

                }

 

            }

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

 

            int allow_smooth = 0;

            int allow_cliff = 0;

            int allow_notch = 0;

            double vrb_tol = 0.0;

            theUfSession.Modl.CreateBlend("9", list1, allow_smooth, allow_cliff, allow_notch, vrb_tol, out obj_id_camf);

        }

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

        void procladka_niz()

        {

            Tag squares1;

            string name1 = "procladka_niz";

            int units1 = 1;

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

            Tag[] body1;

            Tag[] body2;

            Tag[] body3;

            Tag[] body4;

            Tag[] body5;

            Tag[] body6;

            //прямоугольник1

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

            double[] point_B = { 0, 164, 0.0 };

            double[] point_C = { 164, 164, 0.0 };

            double[] point_D = { 164, 0, 0.0 };

            string taper_angle = "0.0";

            double startheight_rect = 0;

            double height_rect = 10;

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

            double[] direction_extrude0 = { 0.0, 0.0, 1.0 };

            FeatureSigns Operaciy_rect = FeatureSigns.Nullsign;

 

            body1 = rectangl(point_A, point_B, point_C, point_D, startheight_rect, height_rect, taper_angle,

                ref_pt_extrude0, direction_extrude0, Operaciy_rect);

 

 

 

            //круг1

            string taper_angle1 = "0.0";

            double[] arc1_centerpt1 = { 82, 82, 0 };

            double arc1_start_ang1 = 0.0;

            double arc1_end_ang1 = 3.14159265358979324 * 2;

            double arc1_rad1 = 30;

            double startheight1 = 0;

            double height1 = 10;

            double[] matrix1 = { 1, 0, 0, 0, 1, 0, 0, 0, -1 };

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

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

            FeatureSigns Nullsing = FeatureSigns.Nullsign;

            FeatureSigns Negative = FeatureSigns.Negative;

 

            body2 = round(taper_angle1, arc1_centerpt1, arc1_start_ang1, arc1_end_ang1, arc1_rad1,

            startheight1, height1, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body1);

 

 

            double arc1_rad3 = 15.4;

            double[] arc1_centerpt3 = { 19.5, 19.5, 0 };

            body3 = round(taper_angle1, arc1_centerpt3, arc1_start_ang1, arc1_end_ang1, arc1_rad3,

            startheight1, height1, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body2);

 

 

            double[] arc1_centerpt4 = { 144.5, 19.5, 0 };

            body4 = round(taper_angle1, arc1_centerpt4, arc1_start_ang1, arc1_end_ang1, arc1_rad3,

            startheight1, height1, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body3);

 

 

            double[] arc1_centerpt5 = { 19.5, 144.5, 0 };

            body5 = round(taper_angle1, arc1_centerpt5, arc1_start_ang1, arc1_end_ang1, arc1_rad3,

            startheight1, height1, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body4);

 

            double[] arc1_centerpt6 = { 144.5, 144.5, 0 };

            body6 = round(taper_angle1, arc1_centerpt6, arc1_start_ang1, arc1_end_ang1, arc1_rad3,

            startheight1, height1, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body5);

 

 

 

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

            Tag feat1 = body6[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 == 1) || (ii == 2) || (ii == 3) || (ii == 0))

                {

                    arrList1.Add(edge);

                }

 

            }

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

 

            int allow_smooth = 0;

            int allow_cliff = 0;

            int allow_notch = 0;

            double vrb_tol = 0.0;

            theUfSession.Modl.CreateBlend("9", list1, allow_smooth, allow_cliff, allow_notch, vrb_tol, out obj_id_camf);

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

 

        }

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

        void flanec(double length)

        {

            Tag squares1;

            string name1 = "flanec";

            int units1 = 1;

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

            Tag[] body1;

            Tag[] body2;

            Tag[] body3;

            Tag[] body4;

            Tag[] body5;

            Tag[] body6;

            Tag[] body7;

            Tag[] body8;

            Tag[] body9;

            //прямоугольник1

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

            double[] point_B = { 0, 164, 0.0 };

            double[] point_C = { 164, 164, 0.0 };

            double[] point_D = { 164, 0, 0.0 };

            string taper_angle = "0.0";

            double startheight_rect = 0;

            double height_rect = 30;

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

            double[] direction_extrude0 = { 0.0, 0.0, 1.0 };

            FeatureSigns Operaciy_rect = FeatureSigns.Nullsign;

 

            body1 = rectangl(point_A, point_B, point_C, point_D, startheight_rect, height_rect, taper_angle,

                ref_pt_extrude0, direction_extrude0, Operaciy_rect);

 

 

 

            //круг1

            string taper_angle1 = "0.0";

            double[] arc1_centerpt1 = { 82, 82, 0 };

            double arc1_start_ang1 = 0.0;

            double arc1_end_ang1 = 3.14159265358979324 * 2;

            double arc1_rad1 = 30;

            double startheight1 = 0;

            double height1 = 18;

            double[] matrix1 = { 1, 0, 0, 0, 1, 0, 0, 0, -1 };

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

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

            FeatureSigns Positiv = FeatureSigns.Positive;

            FeatureSigns Negative = FeatureSigns.Negative;

 

            body2 = round(taper_angle1, arc1_centerpt1, arc1_start_ang1, arc1_end_ang1, arc1_rad1,

            startheight1, height1, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body1);

 

 

            double height2 = 30;

 

            double arc1_rad3 = 15.4;

            double[] arc1_centerpt3 = { 19.5, 19.5, 0 };

            body3 = round(taper_angle1, arc1_centerpt3, arc1_start_ang1, arc1_end_ang1, arc1_rad3,

            startheight1, height2, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body2);

 

 

            double[] arc1_centerpt4 = { 144.5, 19.5, 0 };

            body4 = round(taper_angle1, arc1_centerpt4, arc1_start_ang1, arc1_end_ang1, arc1_rad3,

            startheight1, height2, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body3);

 

 

            double[] arc1_centerpt5 = { 19.5, 144.5, 0 };

            body5 = round(taper_angle1, arc1_centerpt5, arc1_start_ang1, arc1_end_ang1, arc1_rad3,

            startheight1, height2, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body4);

 

            double[] arc1_centerpt6 = { 144.5, 144.5, 0 };

            body6 = round(taper_angle1, arc1_centerpt6, arc1_start_ang1, arc1_end_ang1, arc1_rad3,

            startheight1, height2, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body5);

 

            double arc1_rad7 = 26;

            double startheight7 = 18;

            double height7 = 30;

            body7 = round(taper_angle1, arc1_centerpt1, arc1_start_ang1, arc1_end_ang1, arc1_rad7,

            startheight7, height7, matrix1, ref_pt_extrude1, direction_extrude1, Negative, body6);

 

 

            double arc1_rad8 = 40;

            double startheight8 = 0;

            double height8 = length;

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

            body8 = round(taper_angle1, arc1_centerpt1, arc1_start_ang1, arc1_end_ang1, arc1_rad8,

            startheight8, height8, matrix1, ref_pt_extrude1, direction_extrude8, Positiv, body7);

 

            double arc1_rad9 = 24;

 

            body9 = round(taper_angle1, arc1_centerpt1, arc1_start_ang1, arc1_end_ang1, arc1_rad9,

            startheight8, height8, matrix1, ref_pt_extrude1, direction_extrude8, Negative, body8);

 

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

            Tag feat1 = body9[0];

            Tag objTag1;

            Tag[] edgeArray1;

            int edgeCount;

            Tag obj_id_camf;

            Tag[] list1, list2, list3;

 

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

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

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

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

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

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

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

            {

                Tag edge;

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

                if ((ii == 1) || (ii == 2) || (ii == 3) || (ii == 4))

                {

                    arrList1.Add(edge);

                }

                if ((ii == 0))

                {

                    arrList3.Add(edge);

                }

                if ((ii == 25))

                {

                    arrList2.Add(edge);

                }

 

 

            }

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

            list2 = (Tag[])arrList2.ToArray(typeof(Tag));

            list3 = (Tag[])arrList3.ToArray(typeof(Tag));

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

            string offset1 = "1";

            string offset2 = "1";

 

 

            string ang = "45";

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

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

 

 

 

 

            int allow_smooth = 0;

            int allow_cliff = 0;

            int allow_notch = 0;

            double vrb_tol = 0.0;

            theUfSession.Modl.CreateBlend("9", list1, allow_smooth, allow_cliff, allow_notch, vrb_tol, out obj_id_camf);

            theUfSession.Modl.CreateBlend("4", list3, allow_smooth, allow_cliff, allow_notch, vrb_tol, out obj_id_camf);

 

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

 

        }

        /*-------------------------------------круг----------------------------------------------------------------------------------------*/

        Tag[] round(string taper_angle, double[] arc_centerpt, double arc_start_ang, double arc_end_ang, double arc_rad, double startheight,

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