コード例 #1
0
        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);
        }
コード例 #2
0
 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();
     }
 }
コード例 #3
0
 private void CloseClick(object sender, RoutedEventArgs e)
 {
     RevitContext.BindOutput(new RevitContext.DummyCallback());
     Close();
 }