Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 66683

Assigning View Titles to Newly Created Viewports

$
0
0

I am working on an addin to batch the creation of my firms templates. One of the steps is to import sheets with views from our detail library, in essence re-creating The Insert views from File command in Revit.  Currently I can duplicate across files the sheets and the drafting views and schedules placed on the sheets.  I am currently trying to assign the same view titles to the newly placed viewports on the newly created sheets.

 

When I create the new vieports and place the views in the new template file, I am looping through all the viewports in the detail library file.  While looping through them, I can access the the view title by viewPort.get_Parameter(BuiltInParameter.ELEM_FAMILY_AND_TYPE_PARAM).AsElementId(). I then get the element as Element Type with the retrieved element ID.  I thought that I could then use the type name, and look up tthe same type name in the new template file.  This is where I am running into issuse.  How should I be retrieving the ID of a view title to assign to the viewport?

 

 

I tried a filtered Element Collector of category OST_Viewports, and then matching the name of the viewport to the viewport in the detail library.  From there I thought I could assign the matching viewports ID to the newly created viewport.  This is causing an unhandled exception.

 

Any suggestion on findinding and assigning the corespond ViewTitle from 1 file to Another?


Viewing all articles
Browse latest Browse all 66683

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>