This post covers how we can use the Revit API to create views of type EngineeringPlan.
EngineeringPlan can be created in Revit Structure (RST) and Revit 2013 only. We can confirm this by launching either Revit Structure or Revit 2013 and we can see Structural Plan listed under View Tab, in Plan Views drop down list. You can check that this view type is not available in Revit Architecture nor Revit MEP. Thus, attempting creation of this view type in RAC or RME using the API will throw an exception too (since it is not supported).
On the API front, StructuralPlan in ViewFamilyType is the same as EngineeringPlan in ViewType. This implies that we have to create a view plan of StructuralPlan type and that should create a view of ViewType, EngineeringPlan. With this ViewFamilyType, we can use the new ViewPlan.Create() API in Revit 2013 to create the EngineeringPlan we wish to create.
This probably has already given you enough leads on how to use the API to create this view type yourself. Nevertheless, here is the complete code that illustrates the above described approach. This code was provided by the Development team during a discussion on this topic.
public class Command : IExternalCommand
public Result Execute(ExternalCommandData commandData,
ref string message,
UIApplication uiApp = commandData.Application;
Document doc = uiApp.ActiveUIDocument.Document;
// Find view family type
FilteredElementCollector vftCollector =
ViewFamilyType vft =
vftype => vftype.ViewFamily == ViewFamily.StructuralPlan);
// Find level 1
FilteredElementCollector lvlCollector = new FilteredElementCollector(doc);
Level level1 =
lvl => lvl.Name == "Level 1");
using (Transaction t =
new Transaction(doc, "Create engineering plan"))
ViewPlan vp = ViewPlan.Create(doc, vft.Id, level1.Id);