public void Function_Dau_Vao() { try { my_width = new ObservableCollection <data_width>(); List <ElementType> data_type = new FilteredElementCollector(doc).WhereElementIsElementType().Cast <ElementType>().ToList(); F_GetWidth.get_width(my_width, data_width, data_type); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Execute(UIApplication uiapp) { UIDocument uidoc = uiapp.ActiveUIDocument; Document doc = uidoc.Document; try { Transaction transaction = new Transaction(doc); transaction.Start("Width"); update_width(uiapp, doc); transaction.Commit(); F_SetWidth.set_width(doc); List <ElementType> data_type = new FilteredElementCollector(doc).WhereElementIsElementType().Cast <ElementType>().ToList(); F_GetWidth.get_width(my_width, data_width, data_type); } catch (Exception ex) { MessageBox.Show(ex.Message); } return; }
private void select_Click(object sender, RoutedEventArgs e) { try { Selection selection = uidoc.Selection; var elements = selection.PickObjects(ObjectType.Element).Select(x => doc.GetElement(x)).ToList(); List <data_width> data_type_support = new List <data_width>(); foreach (Element element in elements) { ElementType type = doc.GetElement(element.get_Parameter(BuiltInParameter.ELEM_TYPE_PARAM).AsElementId()) as ElementType; data_type_support.Add(new data_width() { type = type, width = type.Name }); } F_GetWidth.get_width(my_width, data_width, data_type_support.GroupBy(x => new { x.width }).Select(x => x.First().type).ToList()); } catch (Exception ex) { MessageBox.Show(ex.Message); } }