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

Viewport.Create() returns null for drafting view

$
0
0

I'm working on an addin that creates multiple drafting views (each one containing a TextNote) before placing them on a ViewSheet through the Viewport.Create() method. 

I only call Viewport.Create() under the condition that Viewport.CanAddViewToSheet(Document, ViewSheet.Id, ViewDrafting.Id) returns true for the ViewSheet and a given ViewDrafting element in my list; this method returns true for all of them. 

Strangely enough, the list's first ViewDrafting element (which I should be able to add to the sheet according to the above method) creates a null Viewport when passed into the Viewport.Create() method; the remaining ViewDrafting elements create successful Viewports as expected.

 

I read the documentation for the Viewport class, but have yet to find anything suggesting how a Viewport could be null when the ViewDrafting element and ViewSheet element meet the criteria of the CanAddViewToSheet() method. 

Is there an undocumented condition where the Viewport.Create() method returns null?


Viewing all articles
Browse latest Browse all 66848

Trending Articles



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