Zoom out in a view3D or expanding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone!
This post is regarding about a previous post https://forums.autodesk.com/t5/revit-api-forum/create-a-view-camera-or-3d-view-with-boundering/td-p/...
This post was solved but I have a new doubt about this issue, I changed a bit my code respect the solution. Concretely in the orientation. Placing the eye in the top of the wall, and with an angle not perpendicular to the Z-axis. But I need to have zoom out or change the size of the box, and this is my problem, I don't know how I could do it!
I tried it, changing the boundingBox but it didn't change...
My code is the next:
private static ViewOrientation3D GetOrientation(Room room, Wall wall3DView, UIDocument uiDoc) { var calculator = new SpatialElementGeometryCalculator(room.Document, new SpatialElementBoundaryOptions { SpatialElementBoundaryLocation = SpatialElementBoundaryLocation.Finish }); IList<Reference> sideFaces = HostObjectUtils.GetSideFaces(wall3DView, ShellLayerType.Interior); Face face = uiDoc.Document.GetElement(sideFaces[0]) .GetGeometryObjectFromReference(sideFaces[0]) as Face; var faceBox = face.GetBoundingBox(); var faceCenter = face.Evaluate(0.5 * (faceBox.Min + faceBox.Max)); var dist = 0.5; var h = 0.15; XYZ heightFace = new XYZ(0, 0, h); var eye = faceCenter + heightFace; var angulo = -1 * face.ComputeNormal(UV.Zero) - heightFace / dist; var up = XYZ.BasisZ - 1 * face.ComputeNormal(UV.Zero) * h / dist; return new ViewOrientation3D(eye, up, angulo); }
In the next code, bounding is the bounding of the room...
public static View3D Create3DView(Room room, Wall wall3DView, UIDocument uiDoc,BoundingBoxXYZ bounding) { var document = room.Document; using (var transaction = new Transaction(document, "create 3d view")) { transaction.Start(); var view = View3D.CreatePerspective(document, document.GetDefaultElementTypeId(ElementTypeGroup.ViewType3D));
//------------------------------------------
//this is the part which is not working in a good way. BoundingBoxXYZ bb = view.CropBox; bb.Max = bounding.Max; bb.Min = bounding.Min; view.CropBox = bb;
//--------------------------------------------- view.SetOrientation(GetOrientation(room, wall3DView, uiDoc)); transaction.Commit(); return view; } }
Do you know where is the mistake? Or do you know how could I make zoom out?
If I don't use the bounding the solution will be:
And I want a solution like the next picture:
Thank you and best regards
Lorena