Hi,
I am trying to copy views from one sheet into another, and place them in the exact location as in the original one (using c# - Revit architecture 2014).
I can copy the views into the new sheet, but the position of them is nowhere near the correct position.
I have tested and confirmed that the views in the original and new sheet have the same values in CropBox.Max, CropBox.Min, Outline.Max and Outline.Min, but apparently these are not the values stating should the view should be placed in the sheet.
I would appreciate any help or resource regarding this.
Thank you very much.
Have you tried Viewport.getBoxCenter() yet?
XYZ = ViewCenter = Viewport.getBoxCenter();
then when creating your new viewport:
Viewport.Create(doc,MyNewSheet.Id, newView.Id, ViewCentre);
Where newView is your duplicate from
newView = doc.GetElement(v.Duplicate(ViewDuplicateOption.WithDetailing)) as Autodesk.Revit.DB.View;
This worked quite well for my instantSheetduplicator tool.
Dear lio2,
are you sure that you use Viewports and not Views ?
The Element that represents a View placed on a Sheet is a Viewport.
Views have an Outline property while a Viewport's Outline can be got by its GetBoxOutline() method.
If you just compare the referenced Views, they will have identical values since they belong to the same View Element.
On your Sheets, the View is represented by different Viewport Elements.
Best regards,
Revitalizer
Hi David,
Thank you for the solution. Trying it out, I get the message saying that in Viewport.getBoxCenter(), .getBoxCenter() is not known. Am I overlooking something here?
Thank you.
Thank you very much Revitalizer.
A combination of your solution with David's solved the problem.
I was indeed trying to get the coordinates from the View, not the Viewport.
I created a list of Viewports, and when creating the new viewport I used the coordinates information of the Viewport information.
Regards.