Mirroring 3d views

Hello guys,
We have been asked to mirror a project, we are ok mirroring plans, RCPs sections and elevations but do you know if there is a way to mirror 3d views and cameras???

Any help on this please? is it possible???

Hi @BIMadmin,

I didn’t try to mirror a 3D view but you could try something like in the picture.
I’m not sure for the node boundingbox.Scale. Maybe you need to invert the bounding box in an another way.

Let me know if it works.

Hello Alban, I am going to give it a go, if -1 works then the whole logic should.
I will let you know.

Many thanks

Not working, I think what I need to do is mirror the camera positionHome.dyn (13.5 KB)


If in Revit we select the camera and mirror it works so that is what we need however I dont know how to access to the camera position of every 3dview…

Hello,
I guess this is how…?

private void Getinfo_View3D(View3D view3D)
{
string message = "View3D: ";
// The position of the camera.
XYZ eyePosition = view3D.GetOrientation().EyePosition;
message += “\nCamera position: (” + eyePosition.X + ", " +
eyePosition.Y + ", " + eyePosition.Z + “)”;

// Identifies whether this is a perspective view. 
if (view3D.IsPerspective)
{
    message += "\nThe view is a perspective.";
}

// The section box of the 3D view cuts the model by its bounds.
BoundingBoxXYZ sectionBox = view3D.GetSectionBox();
XYZ max = sectionBox.Max; //Maximum coordinates (upper-right-front corner of the box).
XYZ min = sectionBox.Min; //Minimum coordinates (lower-left-rear corner of the box).
message += "\nSection Box: ";
message += "\nMaximum coordinates: (" + max.X + ", " + max.Y + ", " + max.Z + ")";
message += "\nMinimum coordinates: (" + min.X + ", " + min.Y + ", " + min.Z + ")";

TaskDialog.Show("Revit",message);

}

Not sure how to implement this though and mirror.

Hi @BIMadmin,

Boundingbox wasn’t the good clue.
With the package Syntetic, you can do it.
You will have to manage the vectors with your mirror axis.

2 Likes

Thanks Alban,

That looks amazing, this mirror the view orientation (Vectors), but do you know how can I move the camera to the new position???

Did you try the graph above ?
It moves also the camera. (the eye position)

The -1 value is probaly not the value for your mirror axis. It makes a rotation at 180° and invert the camera and target.
You need to determine the correct values.

Hello Alban,
The vectors do change the orientation but the camera does not move at all.

What I need to mirror is camera not its orientation.

Hi Francisco,

The camera doesn’t refresh quickly after the run but it works for me.
The node Vector.Rotate will probably help you with your axis.

Before the run :

After the run :

Nor sure what you mean refresh quickly, shall I closed Revit and open to see the update?
If on the other hand I duplicate the view it does work for me.c3

Maybe with a node to close the transaction (Transaction.End) ?
It’s strange because you can’t cancel the dynamo run with these particular nodes.
Cancel

i checked it doesn’t work on my end, only if i duplicate the view

Hi @BIMadmin,

In fact, the solution is really obvious.
The camera can be rotated or symmetrized like other elements.

1 Like

This easy???
I am going to give it a go right now!!!

Thank you very much for your support Alban, this works!!!
Mirror an element duplicate views, it would be amazing if I could retrieve the existing names and populate the new elements with the old names, the problem is that the node Mirror an element does not return objects so I dont know how to automate this.
I have included in the definition a filter for only mirroring perspective views because axo views do nothing and another node for deleting the original views.
Many thanks again.c1Mirror perspective views.dyn (9.1 KB)

You can retrieve the newly created 3D views like this :

Get 3D views script:

#inspired from Cesare Caoduro

import sys
import clr

pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
import os

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitAPIUI')
from  Autodesk.Revit.UI import *

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.Creation import *

clr.AddReference('RevitNodes')
import Revit

clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

#Access the active document#
doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#Start a transaction on the active document#
TransactionManager.Instance.EnsureInTransaction(doc)

toggleForRefresh = IN[0]
output = []
tredView = []
tot = 0

col = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Views)

for c in col:
	if c.get_Parameter(BuiltInParameter.VIEW_TYPE_SCHEDULES).AsString() == '3D View':
		tredView.append(c.ToDSType(True))
		tot += 1

#Dispose the active transaction
TransactionManager.Instance.TransactionTaskDone()

#List outputs#
OUT = tredView

For your information, the axonometries own also cameras :

I had fun exploring the caracteristics of 3d views ! :grinning:

Mirror perspective and axono views-Rename and delete.dyn (18.6 KB)

1 Like