Beispiel #1
0
        //----------------------------------------------------------
        public void Get_Level_Bottom(Document doc, ComboBox level_bottom, TextBox elevation_bottom, All_Data myAll_Data)
        {
            try
            {
                my_level_data_bottom = new ObservableCollection <level_data>(new FilteredElementCollector(doc)
                                                                             .OfClass(typeof(Level)).Cast <Level>()
                                                                             .OrderBy(x => x.Elevation)
                                                                             .ToList().Select(x => new level_data()
                {
                    level        = x,
                    single_value = x.Name,
                    elevation    = x.Elevation
                }));

                level_bottom.ItemsSource = my_level_data_bottom;
                if (new FilteredElementCollector(doc).OfClass(typeof(View3D)).Cast <View3D>().Where(x => x.Name == doc.ActiveView.Name).ToList().Count() == 0)
                {
                    level_bottom.SelectedIndex = my_level_data_bottom.IndexOf(my_level_data_bottom.First(x => x.single_value == doc.ActiveView.get_Parameter(BuiltInParameter.PLAN_VIEW_LEVEL).AsString()));
                }
                else
                {
                    level_bottom.SelectedIndex = 0;
                }
                level_data item = (level_data)level_bottom.SelectedItem;
                elevation_bottom.Text = Math.Round(item.elevation * myAll_Data.list_unit_value_data[2], mySource.lam_tron).ToString();
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
 //--------------------------------------------------------------------------------------------------------------------------------------------------------------
 private void Select_Level_Top(object sender, EventArgs e)
 {
     try
     {
         level_data item = (level_data)level_top.SelectedItem;
         elevation_top.Text = Math.Round(item.elevation * myAll_Data.list_unit_value_data[2], mySource.lam_tron).ToString();
     }
     catch (Exception ex)
     {
         //MessageBox.Show(ex.Message);
     }
 }
Beispiel #3
0
        //----------------------------------------------------------
        public void Select_Level_Bottom(ComboBox level_bottom, TextBox elevation_bottom, All_Data myAll_Data,
                                        ComboBox type, ListView thong_tin_parameter)
        {
            try
            {
                level_data item = (level_data)level_bottom.SelectedItem;
                elevation_bottom.Text = Math.Round(item.elevation * myAll_Data.list_unit_value_data[2], mySource.lam_tron).ToString();

                Update_UK_MA(type, myAll_Data, elevation_bottom, thong_tin_parameter);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #4
0
        //----------------------------------------------------------
        public void Select_Update(UIDocument uidoc, Document doc,
                                  Button host, ComboBox level_bottom, ComboBox level_top, TextBox elevation_bottom, TextBox elevation_top, ComboBox material, TextBox search, ListView thong_tin_parameter,
                                  ComboBox category, ComboBox family, ComboBox type,
                                  All_Data myAll_Data)
        {
            try
            {
                Selection            selection     = uidoc.Selection;
                SelectElementsFilter conduitFilter = new SelectElementsFilter(myAll_Data.list_category_draw.ToList());
                element_update = doc.GetElement(selection.PickObject(ObjectType.Element, conduitFilter, "Please select element update"));
                if (element_update != null)
                {
                    selection.SetElementIds(new List <ElementId>()
                    {
                        element_update.Id
                    });
                    host_of_opening = null;
                    if (new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).Where(x => x.Name == element_update.get_Parameter(BuiltInParameter.ELEM_TYPE_PARAM).AsValueString()).ToList().Count() > 0)
                    {
                        FamilyInstance familyInstance = element_update as FamilyInstance;
                        if (familyInstance.Host != null)
                        {
                            host.ToolTip    = familyInstance.Host.Name;
                            host_of_opening = familyInstance.Host;
                        }
                    }

                    double offset_bottom = 0;
                    double offset_top    = 0;
                    if (element_update.Category.Name == myAll_Data.list_category_draw[3])
                    {
                        offset_bottom             = element_update.get_Parameter(BuiltInParameter.WALL_BASE_OFFSET).AsDouble();
                        level_bottom.SelectedItem = my_level_data_bottom.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.WALL_BASE_CONSTRAINT).AsValueString());

                        offset_top             = element_update.get_Parameter(BuiltInParameter.WALL_TOP_OFFSET).AsDouble();
                        level_top.SelectedItem = my_level_data_top.First(x => x.single_value == (doc.GetElement(element_update.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE).AsElementId()).Name));
                    }
                    else if (element_update.Category.Name == myAll_Data.list_category_draw[4])
                    {
                        offset_bottom             = element_update.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_OFFSET_PARAM).AsDouble();
                        level_bottom.SelectedItem = my_level_data_bottom.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_PARAM).AsValueString());

                        offset_top             = element_update.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_OFFSET_PARAM).AsDouble();
                        level_top.SelectedItem = my_level_data_top.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_PARAM).AsValueString());
                    }
                    else if (element_update.Category.Name == myAll_Data.list_category_draw[5])
                    {
                        offset_bottom             = element_update.get_Parameter(BuiltInParameter.STRUCTURAL_ELEVATION_AT_BOTTOM).AsDouble() - (doc.GetElement(element_update.get_Parameter(BuiltInParameter.INSTANCE_REFERENCE_LEVEL_PARAM).AsElementId()) as Level).Elevation;
                        level_bottom.SelectedItem = my_level_data_bottom.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.INSTANCE_REFERENCE_LEVEL_PARAM).AsValueString());

                        offset_top             = element_update.get_Parameter(BuiltInParameter.STRUCTURAL_ELEVATION_AT_TOP).AsDouble() - (doc.GetElement(element_update.get_Parameter(BuiltInParameter.INSTANCE_REFERENCE_LEVEL_PARAM).AsElementId()) as Level).Elevation;
                        level_top.SelectedItem = my_level_data_top.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.INSTANCE_REFERENCE_LEVEL_PARAM).AsValueString());
                    }
                    else if (element_update.Category.Name == myAll_Data.list_category_draw_host[0])
                    {
                        offset_bottom             = element_update.get_Parameter(BuiltInParameter.STRUCTURAL_ELEVATION_AT_BOTTOM).AsDouble() - (doc.GetElement(element_update.get_Parameter(BuiltInParameter.LEVEL_PARAM).AsElementId()) as Level).Elevation;
                        level_bottom.SelectedItem = my_level_data_bottom.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.LEVEL_PARAM).AsValueString());

                        offset_top             = element_update.get_Parameter(BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM).AsDouble();
                        level_top.SelectedItem = my_level_data_top.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.LEVEL_PARAM).AsValueString());
                    }
                    else
                    {
                        if (host_of_opening != null)
                        {
                            if (host_of_opening.Category.Name == myAll_Data.list_category_draw_host[0])
                            {
                                offset_bottom             = 0;
                                level_bottom.SelectedItem = my_level_data_bottom.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).AsValueString());

                                offset_top             = 0;
                                level_top.SelectedItem = my_level_data_top.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).AsValueString());
                            }
                            else if (host_of_opening.Category.Name == myAll_Data.list_category_draw_host[1])
                            {
                                offset_bottom             = element_update.get_Parameter(BuiltInParameter.INSTANCE_ELEVATION_PARAM).AsDouble();
                                level_bottom.SelectedItem = my_level_data_bottom.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).AsValueString()); // read-only

                                offset_top = 0;
                                level_top.SelectedIndex = my_level_data_top.IndexOf(my_level_data_top.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).AsValueString())) + 1;
                            }
                            else
                            {
                                if (element_update.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM) != null &&
                                    element_update.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).AsElementId().IntegerValue != -1)
                                {
                                    offset_bottom             = element_update.get_Parameter(BuiltInParameter.INSTANCE_ELEVATION_PARAM).AsDouble();
                                    level_bottom.SelectedItem = my_level_data_bottom.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).AsValueString()); // read-only

                                    offset_top = 0;
                                    level_top.SelectedIndex = my_level_data_top.IndexOf(my_level_data_top.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).AsValueString())) + 1;
                                }
                                else if (element_update.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM) != null &&
                                         element_update.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM).AsElementId().IntegerValue != -1)
                                {
                                    offset_bottom             = element_update.get_Parameter(BuiltInParameter.INSTANCE_ELEVATION_PARAM).AsDouble();
                                    level_bottom.SelectedItem = my_level_data_bottom.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM).AsValueString()); // read-only

                                    offset_top = 0;
                                    level_top.SelectedIndex = my_level_data_top.IndexOf(my_level_data_top.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM).AsValueString())) + 1;
                                }
                            }
                        }
                        else
                        {
                            if (element_update.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM) != null &&
                                element_update.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).AsElementId().IntegerValue != -1)
                            {
                                offset_bottom             = element_update.get_Parameter(BuiltInParameter.INSTANCE_ELEVATION_PARAM).AsDouble();
                                level_bottom.SelectedItem = my_level_data_bottom.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).AsValueString()); // read-only

                                offset_top = 0;
                                level_top.SelectedIndex = my_level_data_top.IndexOf(my_level_data_top.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).AsValueString())) + 1;
                            }
                            else if (element_update.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM) != null &&
                                     element_update.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM).AsElementId().IntegerValue != -1)
                            {
                                offset_bottom             = element_update.get_Parameter(BuiltInParameter.INSTANCE_ELEVATION_PARAM).AsDouble();
                                level_bottom.SelectedItem = my_level_data_bottom.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM).AsValueString()); // read-only

                                offset_top = 0;
                                level_top.SelectedIndex = my_level_data_top.IndexOf(my_level_data_top.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM).AsValueString())) + 1;
                            }
                        }
                    }

                    level_data item_bottom = (level_data)level_bottom.SelectedItem;
                    level_data item_top    = (level_data)level_top.SelectedItem;
                    elevation_bottom.Text = Math.Round((item_bottom.elevation + offset_bottom) * myAll_Data.list_unit_value_data[2], mySource.lam_tron).ToString();
                    elevation_top.Text    = Math.Round((item_top.elevation + offset_top) * myAll_Data.list_unit_value_data[2], mySource.lam_tron).ToString();

                    //------------------------------------------------------------------------------------------------------------------------------------------------
                    category.SelectedItem = my_category_data.First(x => x.single_value == element_update.Category.Name);

                    Get_Family(doc, category, family, myAll_Data);
                    family.SelectedItem = my_family_data.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.ELEM_FAMILY_PARAM).AsValueString());

                    Get_Type(doc, family, type, material, search, myAll_Data);
                    type.SelectedItem = my_type_data.First(x => x.single_value == element_update.get_Parameter(BuiltInParameter.ELEM_TYPE_PARAM).AsValueString());
                    type_data item_type = (type_data)type.SelectedItem;
                    if (item_type.type.get_Parameter(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM) != null)
                    {
                        material.SelectedItem = my_material_data.First(x => x.single_value == doc.GetElement(item_type.type.get_Parameter(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM).AsElementId()).Name);
                        material.ToolTip      = doc.GetElement(item_type.type.get_Parameter(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM).AsElementId()).Name;
                    }

                    Get_Parameter(element_update, doc, category, family, type, thong_tin_parameter, myAll_Data);

                    Update_UK_MA(type, myAll_Data, elevation_bottom, thong_tin_parameter);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #5
0
        public void Select_Host(UIDocument uidoc, Document doc,
                                Button host, ComboBox level_bottom, ComboBox level_top, TextBox elevation_bottom, TextBox elevation_top,
                                All_Data myAll_Data,
                                ComboBox type, ListView thong_tin_parameter)
        {
            try
            {
                Selection            selection     = uidoc.Selection;
                SelectElementsFilter conduitFilter = new SelectElementsFilter(myAll_Data.list_category_draw_host.ToList());
                var element = doc.GetElement(selection.PickObject(ObjectType.Element, conduitFilter, "Please select floor or wall element"));
                if (element != null)
                {
                    host.ToolTip    = element.Name;
                    host_of_opening = element;

                    double offset_bottom = 0;
                    double offset_top    = 0;
                    if (element.Category.Name == myAll_Data.list_category_draw[3])
                    {
                        offset_bottom             = element.get_Parameter(BuiltInParameter.WALL_BASE_OFFSET).AsDouble();
                        level_bottom.SelectedItem = my_level_data_bottom.First(x => x.single_value == element.get_Parameter(BuiltInParameter.WALL_BASE_CONSTRAINT).AsValueString());

                        offset_top             = element.get_Parameter(BuiltInParameter.WALL_TOP_OFFSET).AsDouble();
                        level_top.SelectedItem = my_level_data_top.First(x => x.single_value == (doc.GetElement(element.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE).AsElementId()).Name));
                    }
                    else if (element.Category.Name == myAll_Data.list_category_draw[4])
                    {
                        offset_bottom             = element.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_OFFSET_PARAM).AsDouble();
                        level_bottom.SelectedItem = my_level_data_bottom.First(x => x.single_value == element.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_PARAM).AsValueString());

                        offset_top             = element.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_OFFSET_PARAM).AsDouble();
                        level_top.SelectedItem = my_level_data_top.First(x => x.single_value == element.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_PARAM).AsValueString());
                    }
                    else if (element.Category.Name == myAll_Data.list_category_draw[5])
                    {
                        offset_bottom             = element.get_Parameter(BuiltInParameter.STRUCTURAL_ELEVATION_AT_BOTTOM).AsDouble() - (doc.GetElement(element.get_Parameter(BuiltInParameter.INSTANCE_REFERENCE_LEVEL_PARAM).AsElementId()) as Level).Elevation;
                        level_bottom.SelectedItem = my_level_data_bottom.First(x => x.single_value == element.get_Parameter(BuiltInParameter.INSTANCE_REFERENCE_LEVEL_PARAM).AsValueString());

                        offset_top             = element.get_Parameter(BuiltInParameter.STRUCTURAL_ELEVATION_AT_TOP).AsDouble() - (doc.GetElement(element.get_Parameter(BuiltInParameter.INSTANCE_REFERENCE_LEVEL_PARAM).AsElementId()) as Level).Elevation;
                        level_top.SelectedItem = my_level_data_top.First(x => x.single_value == element.get_Parameter(BuiltInParameter.INSTANCE_REFERENCE_LEVEL_PARAM).AsValueString());
                    }
                    else if (element.Category.Name == myAll_Data.list_category_draw_host[0])
                    {
                        offset_bottom             = element.get_Parameter(BuiltInParameter.STRUCTURAL_ELEVATION_AT_BOTTOM).AsDouble() - (doc.GetElement(element.get_Parameter(BuiltInParameter.LEVEL_PARAM).AsElementId()) as Level).Elevation;
                        level_bottom.SelectedItem = my_level_data_bottom.First(x => x.single_value == element.get_Parameter(BuiltInParameter.LEVEL_PARAM).AsValueString());

                        offset_top             = element.get_Parameter(BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM).AsDouble();
                        level_top.SelectedItem = my_level_data_top.First(x => x.single_value == element.get_Parameter(BuiltInParameter.LEVEL_PARAM).AsValueString());
                    }

                    level_data item_bottom = (level_data)level_bottom.SelectedItem;
                    level_data item_top    = (level_data)level_top.SelectedItem;
                    elevation_bottom.Text = Math.Round((item_bottom.elevation + offset_bottom) * myAll_Data.list_unit_value_data[2], mySource.lam_tron).ToString();
                    elevation_top.Text    = Math.Round((item_top.elevation + offset_top) * myAll_Data.list_unit_value_data[2], mySource.lam_tron).ToString();

                    Update_UK_MA(type, myAll_Data, elevation_bottom, thong_tin_parameter);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #6
0
        //----------------------------------------------------------
        public string Draw_By_Revit(UIApplication uiapp, Document doc)
        {
            string result = "F";

            try
            {
                level_data  item_level_bottom = (level_data)level_bottom.SelectedItem;
                level_data  item_level_top    = (level_data)level_top.SelectedItem;
                family_data item_family       = (family_data)family.SelectedItem;
                type_data   item_type         = (type_data)type.SelectedItem;

                Draw_Data(item_type, item_family, doc);

                Level level_element_bottom = item_level_bottom.level;
                Level level_element_top    = item_level_top.level;

                double elevation_bottom_value = Convert.ToDouble(elevation_bottom.Text) / myAll_Data.list_unit_value_data[2] - item_level_bottom.elevation;
                double elevation_top_value    = Convert.ToDouble(elevation_top.Text) / myAll_Data.list_unit_value_data[2] - item_level_top.elevation;

                if (new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).Where(x => x.Name == item_type.type.Name).ToList().Count() > 0)
                {
                    FamilyInstance instance     = null;
                    FamilySymbol   familySymbol = item_type.type as FamilySymbol;
                    if (familySymbol.IsActive == false)
                    {
                        familySymbol.Activate();
                    }

                    if (item_type.type.Category.Name == myAll_Data.list_category_draw[4])
                    {
                        instance = doc.Create.NewFamilyInstance(my_draw_data.center, familySymbol, level_element_bottom, StructuralType.Column) as FamilyInstance;

                        instance.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_PARAM).Set(level_element_bottom.Id);
                        instance.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_OFFSET_PARAM).Set(elevation_bottom_value);
                        instance.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_PARAM).Set(level_element_top.Id);
                        instance.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_OFFSET_PARAM).Set(elevation_top_value);
                    }
                    else if (item_type.type.Category.Name == myAll_Data.list_category_draw[5])
                    {
                        instance = doc.Create.NewFamilyInstance(my_draw_data.curve, familySymbol, level_element_top, StructuralType.Beam) as FamilyInstance;

                        instance.get_Parameter(BuiltInParameter.STRUCTURAL_BEAM_END0_ELEVATION).Set(0.1);
                        instance.get_Parameter(BuiltInParameter.STRUCTURAL_BEAM_END1_ELEVATION).Set(0.1);

                        instance.get_Parameter(BuiltInParameter.INSTANCE_REFERENCE_LEVEL_PARAM).Set(level_element_top.Id);
                        instance.get_Parameter(BuiltInParameter.Z_OFFSET_VALUE).Set(elevation_top_value);
                        instance.get_Parameter(BuiltInParameter.STRUCTURAL_BEAM_END0_ELEVATION).Set(0);
                        instance.get_Parameter(BuiltInParameter.STRUCTURAL_BEAM_END1_ELEVATION).Set(0);

                        StructuralFramingUtils.DisallowJoinAtEnd(instance, 0);
                        StructuralFramingUtils.DisallowJoinAtEnd(instance, 1);
                    }
                    else
                    {
                        instance = doc.Create.NewFamilyInstance(my_draw_data.center, familySymbol, host_of_opening, level_element_bottom, StructuralType.NonStructural);
                        if (instance.Host != null)
                        {
                            if (host_of_opening.Category.Name == myAll_Data.list_category_draw_host[0])
                            {
                                instance.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).Set(level_element_top.Id);
                            }
                            else if (host_of_opening.Category.Name == myAll_Data.list_category_draw_host[1])
                            {
                                instance.get_Parameter(BuiltInParameter.INSTANCE_ELEVATION_PARAM).Set(elevation_bottom_value);
                                if (instance.LookupParameter(myAll_Data.list_parameter_tag[4]) != null)
                                {
                                    instance.LookupParameter(myAll_Data.list_parameter_tag[4]).Set(Convert.ToDouble(elevation_bottom.Text) / myAll_Data.list_unit_value_data[2]);
                                }
                                if (instance.LookupParameter(myAll_Data.list_parameter_tag[0]) != null)
                                {
                                    instance.LookupParameter(myAll_Data.list_parameter_tag[0]).Set(0);
                                }
                            }
                            else
                            {
                                if (instance.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM) != null &&
                                    instance.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).AsElementId().IntegerValue != -1 &&
                                    instance.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).IsReadOnly == false)
                                {
                                    instance.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).Set(level_element_bottom.Id);
                                    instance.get_Parameter(BuiltInParameter.INSTANCE_ELEVATION_PARAM).Set(elevation_bottom_value);
                                }
                                else if (instance.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM) != null &&
                                         instance.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM).AsElementId().IntegerValue != -1 &&
                                         instance.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM).IsReadOnly == false)
                                {
                                    instance.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM).Set(level_element_bottom.Id);
                                    instance.get_Parameter(BuiltInParameter.INSTANCE_ELEVATION_PARAM).Set(elevation_bottom_value);
                                }
                            }
                        }
                        else
                        {
                            if (instance.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM) != null &&
                                instance.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).AsElementId().IntegerValue != -1 &&
                                instance.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).IsReadOnly == false)
                            {
                                instance.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).Set(level_element_bottom.Id);
                                instance.get_Parameter(BuiltInParameter.INSTANCE_ELEVATION_PARAM).Set(elevation_bottom_value);
                            }
                            else if (instance.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM) != null &&
                                     instance.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM).AsElementId().IntegerValue != -1 &&
                                     instance.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM).IsReadOnly == false)
                            {
                                instance.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM).Set(level_element_bottom.Id);
                                instance.get_Parameter(BuiltInParameter.INSTANCE_ELEVATION_PARAM).Set(elevation_bottom_value);
                            }
                        }
                    }

                    if (my_draw_data.point1 != null)
                    {
                        Move_Element(my_draw_data.point1, my_draw_data.point2, doc, instance, item_type, item_family);
                    }

                    foreach (parameter_data data in my_parameter_data)
                    {
                        if (instance.LookupParameter(data.parameter_name).IsReadOnly == false)
                        {
                            if (data.parameter_value == "True")
                            {
                                instance.LookupParameter(data.parameter_name).Set(1);
                            }
                            else if (data.parameter_value == "False")
                            {
                                instance.LookupParameter(data.parameter_name).Set(0);
                            }
                            else
                            {
                                instance.LookupParameter(data.parameter_name).Set(Convert.ToDouble(data.parameter_value) / myAll_Data.list_unit_value_data[2]);
                            }
                        }
                    }

                    if (host_of_opening == null)
                    {
                        Join_Element(doc, instance);
                    }
                }
                else
                {
                    WallType wallType = item_type.type as WallType;
                    Wall     instance = Wall.Create(doc, my_draw_data.curve, wallType.Id, level_element_bottom.Id, 10, 0, true, true);

                    instance.get_Parameter(BuiltInParameter.WALL_BASE_CONSTRAINT).Set(level_element_bottom.Id);
                    instance.get_Parameter(BuiltInParameter.WALL_BASE_OFFSET).Set(elevation_bottom_value);
                    instance.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE).Set(level_element_top.Id);
                    instance.get_Parameter(BuiltInParameter.WALL_TOP_OFFSET).Set(elevation_top_value);

                    WallUtils.DisallowWallJoinAtEnd(instance, 0);
                    WallUtils.DisallowWallJoinAtEnd(instance, 1);
                    instance.get_Parameter(BuiltInParameter.WALL_KEY_REF_PARAM).Set(0);

                    if (my_draw_data.point1 != null)
                    {
                        Move_Element(my_draw_data.point1, my_draw_data.point2, doc, instance, item_type, item_family);
                    }
                    Join_Element(doc, instance);
                }

                result = "S";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(result);
        }