JPais
JPais

Reputation: 135

How to activate 3d view and save the revit model in design automation api for Revit

I am working on a task where I need to accept a template file (.rte) as input and save the resultant revit file in 3d view.

I understand that to activate 3d view, we need UIDocument which is not available when we work in DesignAutomation API.

In an addin project in the past I had implemented it in the following way:

FilteredElementCollector collector = new FilteredElementCollector(doc).OfClass(typeof(View3D));

foreach (View3D v in collector)
{
    if (!v.IsTemplate)
    {
        uiApp.ActiveUIDocument.ActiveView = v;
    }
}

So is there any other way to do this in DesignAutomation API.

Upvotes: 2

Views: 564

Answers (1)

Jeremy Tammik
Jeremy Tammik

Reputation: 8294

You definitely have no access whatsoever to the UIDocument in the Design Automation API. It does not even exist. I suggest you just go ahead and generate your Revit model as before and then see what view ends up being saved. Quite possibly it is the 3D view anyway.

Upvotes: 1

Related Questions