Viewport fails split operation and does not report error. however creates views on sheets has an unhandled exception.

Viewport fails split operation and does not report error. however creates views on sheets has an unhandled exception.

FrankHolidaytoiling
Advocate Advocate
336 Views
2 Replies
Message 1 of 3

Viewport fails split operation and does not report error. however creates views on sheets has an unhandled exception.

FrankHolidaytoiling
Advocate
Advocate

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();
}

337 Views
2 Replies
Replies (2)
Message 2 of 3

moturi.magati.george
Autodesk
Autodesk

Hi @FrankHolidaytoiling,

 

I can see a similar question on the link below which tries to give a little bit of information of splitting a ViewPort.

https://forums.autodesk.com/t5/revit-api-forum/split-crop-already-with-splits-doesn-t-seem-to-work/t... 

 

You can also view the links below that describes how you can split your Views.

https://forums.autodesk.com/t5/revit-api-forum/ability-to-set-split-region-offset/td-p/10042996 

 

https://adndevblog.typepad.com/aec/2015/03/revitapi-how-to-resize-cropbox-of-view.html 

 

 

  Moturi George,     Developer Advocacy and Support,  ADN Open
Message 3 of 3

FrankHolidaytoiling
Advocate
Advocate

Thanx,

I found the first or top hyperlink already. I was not having success with basic splitting of view cropbox within a modeless form addin, so i am going to attempt it as a seperate addin.

0 Likes