Exemple #1
0
        //----------------------------------------------------------
        public void Function_Dau_Vao()
        {
            try
            {
                mySupport_All.Default_Image(myAll_Data, new List <Image>()
                {
                    logo_image, select_image, modify_image, duplicate_image, revit_image, select_host_image
                });

                my_material_data     = new ObservableCollection <material_data>();
                my_level_data_bottom = new ObservableCollection <level_data>();
                my_level_data_top    = new ObservableCollection <level_data>();
                my_category_data     = new ObservableCollection <category_data>();
                my_family_data       = new ObservableCollection <family_data>();
                my_type_data         = new ObservableCollection <type_data>();
                my_parameter_data    = new ObservableCollection <parameter_data>();
                data_point           = new geometry_data();

                my_view_plan_name_data_apply = new ObservableCollection <view_plan_name_data>();
                my_view_plan_name_data_tem   = new ObservableCollection <view_plan_name_data>();

                mySupport_Draw.Add_Category(doc, category, myAll_Data);
                mySupport_Draw.Get_Location_Line(location_line);
                mySupport_Draw.Get_Material(doc, material);

                mySupport_Draw.Get_Level_Bottom(doc, level_bottom, elevation_bottom, myAll_Data);
                mySupport_Draw.Get_Level_Top(doc, level_top, elevation_top, myAll_Data);
                mySupport_Draw.Get_Family(doc, category, family, myAll_Data);
                mySupport_Draw.Get_Type(doc, family, type, material, search, myAll_Data);

                mySupport_Draw.Get_Parameter(null, doc, category, family, type, thong_tin_parameter, myAll_Data);
                mySupport_Draw.Update_UK_MA(type, myAll_Data, elevation_bottom, thong_tin_parameter);

                mySupport_Crop.Get_View_Data(view_tem, view_apply, doc);

                Function_Dau_Vao_Section_Sort();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
        //----------------------------------------------------------
        public void Data_Pick_Element(UIDocument uidoc, Document doc,
                                      RadioButton center_mid_point, RadioButton line, RadioButton arc, RadioButton ellipse, RadioButton pick)
        {
            mySource = new ListSource();

            Selection selection = uidoc.Selection;

            if (center_mid_point.IsChecked == true && center_mid_point.IsEnabled == true)
            {
                List <XYZ> support = new List <XYZ>();
                support.Add(selection.PickPoint(ObjectSnapTypes.Endpoints | ObjectSnapTypes.Midpoints | ObjectSnapTypes.Centers | ObjectSnapTypes.Intersections | ObjectSnapTypes.Perpendicular | ObjectSnapTypes.Nearest | ObjectSnapTypes.Quadrants, "Select center point"));
                data_point = new geometry_data()
                {
                    name       = mySource.list_option_selection_name[0],
                    list_point = support
                };
            }
            if (line.IsChecked == true)
            {
                List <XYZ> support = new List <XYZ>();
                support.Add(selection.PickPoint(ObjectSnapTypes.Endpoints | ObjectSnapTypes.Midpoints | ObjectSnapTypes.Centers | ObjectSnapTypes.Intersections | ObjectSnapTypes.Perpendicular | ObjectSnapTypes.Nearest | ObjectSnapTypes.Quadrants, "Select start point"));
                support.Add(selection.PickPoint(ObjectSnapTypes.Endpoints | ObjectSnapTypes.Midpoints | ObjectSnapTypes.Centers | ObjectSnapTypes.Intersections | ObjectSnapTypes.Perpendicular | ObjectSnapTypes.Nearest | ObjectSnapTypes.Quadrants, "Select end point"));
                data_point = new geometry_data()
                {
                    name       = mySource.list_option_selection_name[1],
                    list_point = support
                };
            }
            if (arc.IsChecked == true && arc.IsEnabled == true)
            {
                List <XYZ> support = new List <XYZ>();
                support.Add(selection.PickPoint(ObjectSnapTypes.Endpoints | ObjectSnapTypes.Midpoints | ObjectSnapTypes.Centers | ObjectSnapTypes.Intersections | ObjectSnapTypes.Perpendicular | ObjectSnapTypes.Nearest | ObjectSnapTypes.Quadrants, "Select center point"));
                support.Add(selection.PickPoint(ObjectSnapTypes.Endpoints | ObjectSnapTypes.Midpoints | ObjectSnapTypes.Centers | ObjectSnapTypes.Intersections | ObjectSnapTypes.Perpendicular | ObjectSnapTypes.Nearest | ObjectSnapTypes.Quadrants, "Select start point"));
                support.Add(selection.PickPoint(ObjectSnapTypes.Endpoints | ObjectSnapTypes.Midpoints | ObjectSnapTypes.Centers | ObjectSnapTypes.Intersections | ObjectSnapTypes.Perpendicular | ObjectSnapTypes.Nearest | ObjectSnapTypes.Quadrants, "Select end point, not same start point"));
                data_point = new geometry_data()
                {
                    name       = mySource.list_option_selection_name[2],
                    list_point = support
                };
            }
            if (ellipse.IsChecked == true && ellipse.IsEnabled == true)
            {
                List <XYZ> support = new List <XYZ>();
                support.Add(selection.PickPoint(ObjectSnapTypes.Endpoints | ObjectSnapTypes.Midpoints | ObjectSnapTypes.Centers | ObjectSnapTypes.Intersections | ObjectSnapTypes.Perpendicular | ObjectSnapTypes.Nearest | ObjectSnapTypes.Quadrants, "Select start point define radius x"));
                support.Add(selection.PickPoint(ObjectSnapTypes.Endpoints | ObjectSnapTypes.Midpoints | ObjectSnapTypes.Centers | ObjectSnapTypes.Intersections | ObjectSnapTypes.Perpendicular | ObjectSnapTypes.Nearest | ObjectSnapTypes.Quadrants, "Select end point define radius x"));
                support.Add(selection.PickPoint(ObjectSnapTypes.Endpoints | ObjectSnapTypes.Midpoints | ObjectSnapTypes.Centers | ObjectSnapTypes.Intersections | ObjectSnapTypes.Perpendicular | ObjectSnapTypes.Nearest | ObjectSnapTypes.Quadrants, "Select start point define radius y"));
                support.Add(selection.PickPoint(ObjectSnapTypes.Endpoints | ObjectSnapTypes.Midpoints | ObjectSnapTypes.Centers | ObjectSnapTypes.Intersections | ObjectSnapTypes.Perpendicular | ObjectSnapTypes.Nearest | ObjectSnapTypes.Quadrants, "Select end point define radius y"));
                data_point = new geometry_data()
                {
                    name       = mySource.list_option_selection_name[3],
                    list_point = support
                };
            }
            if (pick.IsChecked == true)
            {
                var            refe     = selection.PickObject(ObjectType.PointOnElement, "Select reference of element");
                Element        element  = doc.GetElement(refe);
                GeometryObject geometry = element.GetGeometryObjectFromReference(refe);

                List <string> my_cad_link = new FilteredElementCollector(doc).OfClass(typeof(CADLinkType)).Cast <CADLinkType>().Select(x => x.Name).ToList();
                if (my_cad_link.Count() > 0 && my_cad_link.Contains(doc.GetElement(element.UniqueId).Category.Name))
                {
                    GeometryElement elem = element.get_Geometry(new Options());
                    if (elem != null)
                    {
                        foreach (GeometryObject geometryObject in elem)
                        {
                            GeometryInstance gInstance = geometryObject as GeometryInstance;
                            if (null != gInstance)
                            {
                                origin = gInstance.Transform.Origin;
                            }
                        }
                    }
                }

                if (geometry is Line)
                {
                    Line polyLine = geometry as Line;

                    data_point = new geometry_data()
                    {
                        name = mySource.list_option_selection_name[4],
                        line = polyLine
                    };
                }
                else if (geometry is PolyLine)
                {
                    PolyLine polyLine = geometry as PolyLine;
                    data_point = new geometry_data()
                    {
                        name     = mySource.list_option_selection_name[5],
                        polyLine = polyLine
                    };
                }
                else if (geometry is Arc)
                {
                    Arc polyLine = geometry as Arc;

                    data_point = new geometry_data()
                    {
                        name = mySource.list_option_selection_name[6],
                        arc  = polyLine
                    };
                }
                else if (geometry is Ellipse)
                {
                    Ellipse polyLine = geometry as Ellipse;

                    data_point = new geometry_data()
                    {
                        name    = mySource.list_option_selection_name[6],
                        ellipse = polyLine
                    };
                }
            }
        }