Viewport fails split operation and does not report error. however creates views on sheets has an unhandled exception.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am attempting to split a viewport just after i close a transaction to place on a sheet and the creation of viewsheets fails, probably because this operation is failing. Do I need to run this as a post operation or a seperate addin? Can the operation of splitting an elevation be performed on views as well as viewports from a sheet?
using (Transaction t = new Transaction(doc, "split"))
{
t.Start();
foreach (ElementId elementId in viewSheet.GetAllViewports())
{
View viewport = doc.GetElement(elementId) as View;
ViewCropRegionShapeManager cropManager = viewport.GetCropRegionShapeManager();
if (!cropManager.CanBeSplit) throw new Exception("Cannot Split!");
cropManager.SplitRegionHorizontally(0, 0.4999, 0.5001);
}
t.Commit();
}