Precast API Shop Drawing Command

Learn about API for the precast shop drawing command

The precast Shop Drawing command creates drawing for a precast element based on type specific settings specified in the precast Configuration. It is not uncommon to need more than one shop drawing for a single element, such as one for the formwork, and one for reinforcement. Different needs for tagging and dimensioning the shop drawings is also a factor.

The shop drawing API thus makes two things public:
  1. Start the ShopDrawing creation via an API call
  2. Register for events launched during the ShopDrawing creation to observe or modify the results.

Every part of the Precast API is implemented in a single dll and users of the API will not need to reference anything from precast but this single dll. Precast itself does not rely on anything in the Precast API in any way, not even on the existence of the API dll itself.

Starting shop drawing creation. When the API calls the shop drawing creation, it can supply the same settings used from the Precast Configuration. Settings not specified to the API are used from the Precast Configuration. To achieve this, the create method requires an instance of an IShopDrawingOptions interface. The caller can implement it on any class and have it indicate which options it does define and which it does not. The API does not need or have access to the Precast Configuration. The internal code will read the configuration if a setting is not defined by the API caller. The Precast Configuration is only accessible for the user through the UI tools.

In Revit Precast, the class that creates a shop drawing is specialized for the each kind of element. For example, there is a Hollow Core Shop Drawing Creator and a Solid Wall Shop Drawing Creator. Any of which inherit from a common base class. The API exposes classes using a Factory class and a public interface implemented by those classes that defines the parts of the classes that will be visible to the public API.

Events of the shop drawing creation. The shop drawing creation process consists of the steps to create, detail, and move views and viewports. Detailing views consists of dimensioning and tagging views. Each step has an associated pre-event and a post-event where the pre-event can be cancelled by an event handler. The handler can do the work itself or not at all, if so desired.

When an event handler is registered, the Precast API registers itself for internal events that are not visible to the public API. It will then forward to the registered third party event handlers, safeguarding every event handler in its own sub-transaction.

Here, the event handlers parameters are defined as interfaces, effectively decoupling the Precast API from internal affairs, making it easier to change the internal code in the future without affecting the Precast API.