I have a non-aligned bounding box of a 3D scene (building). I wish to create 6 camera views (which I will later save as screen captures). The camera views will represent the 6 (4+2) side views of the bounding box that covers the building. Here is what I have tried out:
Brep box = x.ToBrep();
int excludedId = -1;
double min = 10e8;
foreach(var bf in box.Faces.Select((value, index) => new {value, index})){
Curve bf_outline = Curve.JoinCurves(bf.value.ToBrep().DuplicateEdgeCurves())[0];
Point3d c = AreaMassProperties.Compute(bf_outline).Centroid;
if (c.Z < min){
excludedId = bf.index;
min = c.Z;
}
}
foreach(var bf in box.Faces.Select((value, index) => new {value, index})){
if (bf.index != excludedId){
Curve bf_outline = Curve.JoinCurves(bf.value.ToBrep().DuplicateEdgeCurves())[0];
Plane pl = new Plane(AreaMassProperties.Compute(bf_outline).Centroid, bf.value.NormalAt(0, 0));
planes.Add(pl);
}
}
Rhino.DocObjects.Tables.ViewTable viewTable = doc.Views;
Rhino.Display.RhinoView[] views = viewTable.GetStandardRhinoViews();
for(int i = 0; i < 5; i++){
Rhino.Display.RhinoViewport view = views[0].MainViewport;
view.SetCameraTarget(planes[i].Origin, true);
view.SetCameraDirection(planes[i].Normal, true);
}
Any smarter idea out there? This solution does not “zoom extend” the bounding box side.
Thanks!