View a simple API implementation of the Shop Drawing command.
IShopDrawingOptions options = new ShopDrawingSampleOptions(); IShopDrawingCreator creator = ShopDrawingCreatorFactory.Get(assemblyInstance); // use the creator to create a shop drawing. // the creator is bound to the assembly used to get it. ElementId createdSheetId; creator.Create(options, out createdSheetId);
class ShopDrawingSampleOptions : ShopDrawingDefaultOptions
   {
      public override bool GetOutlineName(out string outlineName)
      {
         outlineName = "Sample Outline";
         return true;
      }
      public override bool GetExtentsName(out string extentsName)
      {
         extentsName = "Sample Extents";
         return true;
      }
   }
ShopDrawingEvents.TaggingView += OnTaggingView; // called before a view is tagged
ShopDrawingEvents.DetailedViews += OnDetailedViews; // called when the detailing for all views is finished
void OnTaggingView(object sender, ITaggingViewEventArgs eventArgs)
{
   // As an example, prevent all Precast tagging from happening
   eventArgs.Cancel = true;
}
void OnDetailedViews(object sender, IDetailedViewsEventArgs eventArgs)
{
   // After the detailing is done, create sample tagging,
   // by adding a tag to the AssemblyInstance, but only in some views
   IEnumerable<IViewportData> viewPorts = eventArgs.Viewports.Where(IsFrontOrBackView);
   foreach (IViewportData viewport in viewPorts)
   {
      // when this event handler is called, a transaction is already opened,
      // so no need to start one
      CreateExampleTagInView(eventArgs.Document, viewport);
   }
}