public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { var uiapp = commandData.Application; var uidoc = uiapp.ActiveUIDocument; var doc = uidoc.Document; var sel = uidoc.Selection; AboutForm form = new AboutForm(); form.Show(RevitWindowHelper.GetRevitWindow()); return(Result.Succeeded); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { var uiapp = commandData.Application; var uidoc = uiapp.ActiveUIDocument; var doc = uidoc.Document; DragForm toolform = DragForm.Instance; toolform.Show(RevitWindowHelper.GetRevitWindow()); return(Result.Succeeded); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { var uiapp = commandData.Application; var uidoc = uiapp.ActiveUIDocument; var doc = uidoc.Document; var sel = uidoc.Selection; var acview = doc.ActiveView; //filter target columntypes ElementFilter architectureColumnFilter = new ElementCategoryFilter(BuiltInCategory.OST_Columns); ElementFilter structuralColumnFilter = new ElementCategoryFilter(BuiltInCategory.OST_StructuralColumns); ElementFilter orfilter = new LogicalOrFilter(architectureColumnFilter, structuralColumnFilter); var collector = new FilteredElementCollector(doc); var columnstypes = collector.WhereElementIsElementType().WherePasses(orfilter).ToElements(); ColumnTypesForm typesform = ColumnTypesForm.Getinstance(columnstypes.ToList());//new ColumnTypesForm(columnstypes.ToList()); typesform.ShowDialog(RevitWindowHelper.GetRevitWindow()); //get selected familysymbol of combobox in columntypesForm var familysymbol = typesform.symbolCombo.SelectedItem as FamilySymbol; //varient for setting bottom and top /*for learners self modifing*/ var bottomlevel = default(Level); var bottomoffset = default(double); var toplevel = default(Level); var topoffset = default(double); var grids = doc.TCollector <Grid>(); var points = new List <XYZ>(); foreach (var grid in grids) { foreach (var grid1 in grids) { if (grid.Id == grid1.Id) { continue; } var curve1 = grid.Curve; var curve2 = grid1.Curve; var res = new IntersectionResultArray(); var intersecRes = curve1.Intersect(curve2, out res); if (intersecRes != SetComparisonResult.Disjoint) { if (res != null) { points.Add(res.get_Item(0).XYZPoint); } } } } //distinct points on same location points = points.Where((m, i) => points.FindIndex(n => n.IsAlmostEqualTo(m)) == i).ToList(); //MessageBox.Show(points.Count.ToString()); //CreateColumns as intersection point TransactionGroup tsg = new TransactionGroup(doc); tsg.Start("统一创建柱子"); foreach (var point in points) { doc.Invoke(m => { if (!familysymbol.IsActive) { familysymbol.Activate(); } var instance = doc.Create.NewFamilyInstance(point, familysymbol, acview.GenLevel, StructuralType.NonStructural); }, "创建柱子"); } tsg.Assimilate(); return(Result.Succeeded); }