private void makeBayView(File3dm file, StructuralBay bay) { //File3dm file = setupFile(); RhinoViewport viewport = new RhinoViewport(); //shift to mid point of module Point3d origin = new Point3d(bay.minPlane.Origin); Plane plnA = new Plane(origin + bay.minPlane.YAxis * bay.parameters.yCell / 2, bay.minPlane.XAxis, Vector3d.ZAxis); //shift to end of module Plane plnB = new Plane(origin + bay.minPlane.YAxis * bay.parameters.yCell, bay.minPlane.XAxis, Vector3d.ZAxis); plnA.Flip(); viewport.SetProjection(DefinedViewportProjection.Perspective, "bay_" + bay.baynum.ToString() + "section", false); viewport.ChangeToParallelProjection(true); //set camera and target Vector3d shiftTarget = bay.maxPlane.Origin - bay.minPlane.Origin; viewport.SetCameraTarget(bay.minPlane.Origin + shiftTarget / 2, false); viewport.SetCameraLocation(viewport.CameraTarget + bay.minPlane.YAxis * -50000, false); viewport.SetCameraDirection(viewport.CameraTarget - viewport.CameraTarget, false); viewport.CameraUp = Vector3d.ZAxis; //viewport.ZoomExtents(); viewport.PushViewProjection(); file.AllViews.Add(new ViewInfo(viewport)); //Clip plane A file.Objects.AddClippingPlane(plnA, bay.parameters.width, bay.parameters.height, viewport.Id); //Clip plane B file.Objects.AddClippingPlane(plnB, bay.parameters.width, bay.parameters.height, viewport.Id); }
public StructuralBay(StructuralBay previous) { voxels.Add(new List <StructuralCell>()); voxels.Add(new List <StructuralCell>()); leader = false; slice = previous.slice; parameters = previous.parameters; baynum = previous.baynum + 1; minPlane = previous.minPlane; maxPlane = previous.maxPlane; //shift in the y direction minPlane.Origin = minPlane.Origin + (minPlane.YAxis * parameters.yCell); maxPlane.Origin = maxPlane.Origin + (maxPlane.YAxis * parameters.yCell); if (!parameters.explore) { voxelise(); } }
private void addBaySection2d(File3dm file, StructuralBay bay, Point3d location) { int pWidth = 35000; Point3d origin = new Point3d(bay.minPlane.Origin); Plane plnA = new Plane(origin + bay.minPlane.YAxis * bay.parameters.yCell / 2, bay.minPlane.XAxis, Vector3d.ZAxis); Vector3d shift = new Vector3d(location); Vector3d panelShift = new Vector3d(location.X + pWidth, location.Y, location.Z); Plane titlepln = Plane.WorldXY; titlepln.Transform(Transform.Translation(shift)); string baytitle = bay.baynum.ToString(); if (bay.baynum < 10) { baytitle = "0" + baytitle; } Text3d title = new Text3d("bay_" + baytitle, titlepln, 300); var id = file.Objects.AddText(title); int col = 0; int row = 0; foreach (List <StructuralCell> scs in bay.voxels) { foreach (StructuralCell sc in scs) { //intersect the cave face with the plan if (sc.cellType != StructuralCell.CellType.InsideCell && sc.cellType != StructuralCell.CellType.Undefined) { if (sc.cellType == StructuralCell.CellType.SkinCell) { attCavepanels.ObjectColor = sc.displayColor; var intersect = Rhino.Geometry.Intersect.Intersection.MeshPlane(sc.caveFace, plnA); if (intersect != null) { foreach (Polyline pl in intersect) { Polyline mapped = new Polyline(mapAndTranslatePts(plnA, pl.ToList(), shift)); file.Objects.AddPolyline(mapped, attCavepanels); } panelShift = new Vector3d(col * 2500, row * 2500, 0); panelShift.X = panelShift.X + pWidth / 2; Plane txtpln = Plane.WorldXY; txtpln.Transform(Transform.Translation(shift + panelShift)); Text3d modulecode = new Text3d(sc.id, txtpln, 100); var g = file.Objects.AddText(modulecode, attAnnotation); Mesh cavepanel2d = new Mesh(); cavepanel2d.Vertices.AddVertices(mapAndTranslatePts(sc.midPlane, sc.caveFace.Vertices.ToPoint3dArray().ToList(), shift + panelShift)); cavepanel2d.Faces.AddFaces(sc.caveFace.Faces); file.Objects.AddMesh(cavepanel2d, attCavepanels); col++; if (col > 5) { col = 0; row++; } } } //diagonals addCurves(file, sc.diagonals, plnA, attDiagonals, shift); //centrelines addCurves(file, sc.centreLines, plnA, attCentrelines, shift); } } } }