Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Duplicate views in different sheet with exact same location

4 REPLIES 4
Reply
Message 1 of 5
lio2
1343 Views, 4 Replies

Duplicate views in different sheet with exact same location

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.

4 REPLIES 4
Message 2 of 5
DavidIntVeld
in reply to: lio2

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.

 

 

Message 3 of 5
Revitalizer
in reply to: lio2

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

 




Rudolf Honke
Software Developer
Mensch und Maschine





Message 4 of 5
lio2
in reply to: DavidIntVeld

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.

Message 5 of 5
lio2
in reply to: Revitalizer

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community