public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { var uiDel = new ThreadStart(() => { var window = new CancelWindow(); var outputCallBack = new OutputCallback(window.RecordOutput); RevitContext.BindOutput(outputCallBack); window.ShowDialog(); }); var t = new Thread(uiDel); t.SetApartmentState(ApartmentState.STA); t.Start(); return(Result.Succeeded); }
public void DoWork() { RevitContext.Application.WriteJournalComment("Looping", false); using (var transaction = new Transaction(RevitContext.Document)) { transaction.Start("looping"); var fec = new FilteredElementCollector(RevitContext.Document).WhereElementIsNotElementType().OfClass(typeof(Wall)); var idx = 1; foreach (Wall element in fec) { RevitContext.Output("Wall number " + idx); idx++; Thread.Sleep(50); } transaction.RollBack(); } }
private void CloseClick(object sender, RoutedEventArgs e) { RevitContext.BindOutput(new RevitContext.DummyCallback()); Close(); }