@@ -334,8 +334,8 @@ List of available environment properties:
334334
335335- Context.Application;
336336- Context.UiApplication;
337- - Context.Document ;
338- - Context.UiDocument ;
337+ - Context.ActiveDocument ;
338+ - Context.ActiveUiDocument ;
339339- Context.ActiveView;
340340- Context.ActiveGraphicalView;
341341- Context.IsRevitInApiMode;
@@ -345,7 +345,7 @@ List of available environment properties:
345345``` C#
346346public void Execute ()
347347{
348- Context .Document .Delete (elementId );
348+ Context .ActiveDocument .Delete (elementId );
349349 Context .ActiveView = view ;
350350}
351351```
@@ -445,7 +445,7 @@ Contains an implementation for **ISaveSharedCoordinatesCallback**.
445445Provides a handler for control Revit when trying to unload or reload a Revit link with changes in shared coordinates.
446446
447447``` c#
448- var linkType = elementId .ToElement <RevitLinkType >(Context .Document );
448+ var linkType = elementId .ToElement <RevitLinkType >(Context .ActiveDocument );
449449linkType .Unload (new SaveSharedCoordinatesCallback ());
450450linkType .Unload (new SaveSharedCoordinatesCallback (SaveModifiedLinksOptions .DoNotSaveLinks ));
451451linkType .Unload (new SaveSharedCoordinatesCallback (type =>
@@ -651,7 +651,7 @@ public class Command : ExternalCommand
651651 // Action
652652 var selectedIds = UiDocument .Selection .GetElementIds ();
653653
654- using var transaction = new Transaction (Context .Document );
654+ using var transaction = new Transaction (Context .ActiveDocument );
655655 transaction .Start (" Delete elements" );
656656 Document .Delete (selectedIds );
657657 transaction .Commit ();
@@ -679,7 +679,7 @@ public class Command : ExternalCommand
679679 try
680680 {
681681 // Action
682- using var transaction = new Transaction (Context .Document );
682+ using var transaction = new Transaction (Context .ActiveDocument );
683683 transaction .Start (" Delete elements" );
684684 Document .Delete (selectedIds );
685685 transaction .Commit ();
0 commit comments