Ejemplo n.º 1
0
        public void writeSection2d(MeshVoxeliser mvox)
        {
            File3dm file = setupFile();

            foreach (StructuralSpan sp in mvox.structuralSpans)
            {
                Point3d location = new Point3d();
                foreach (StructuralBay sb in sp.structuralBays)
                {
                    location.X = sb.baynum * 40000;
                    addBaySection2d(file, sb, location);
                }
            }
            RhinoViewport viewport = new RhinoViewport();

            viewport.SetProjection(DefinedViewportProjection.Top, "2d sections", false);
            viewport.ZoomExtents();
            file.AllViews.Add(new ViewInfo(viewport));
            string section = mvox.parameters.sectionNum.ToString();

            if (mvox.parameters.sectionNum < 10)
            {
                section = "0" + section;
            }
            file.Write(@"C:\Users\r.hudson\Documents\WORK\projects\passageProjects\sections\section" + section + "_2d.3dm", 5);
        }
Ejemplo n.º 2
0
        public void moduleSchedule(MeshVoxeliser mvox)
        {
            int    bayNum               = 0;
            int    skinModuleCount      = 0;
            int    verticalModuleCount  = 0;
            int    perimeterModuleCount = 0;
            int    modulesCount         = 0;
            string cavepart             = mvox.parameters.sectionNum.ToString();

            if (mvox.parameters.sectionNum < 10)
            {
                cavepart = "0" + cavepart;
            }
            StreamWriter sw = new StreamWriter(@"C:\Users\r.hudson\Documents\WORK\projects\passageProjects\caveparts\cavepart" + cavepart + "modulesSchedule.csv");

            sw.WriteLine("module code, type, disjoint cave panel, cave panel area");
            foreach (StructuralSpan sp in mvox.structuralSpans)
            {
                foreach (StructuralBay sb in sp.structuralBays)
                {
                    foreach (List <StructuralCell> sc in sb.voxels)
                    {
                        foreach (StructuralCell c in sc)
                        {
                            string area = "";
                            string flag = "";
                            if (c.cellType == StructuralCell.CellType.SkinCell)
                            {
                                skinModuleCount++;
                                area = Math.Round(c.caveFaceArea, 3).ToString();
                                flag = (c.caveFace.DisjointMeshCount - 1).ToString();
                            }
                            if (c.cellType == StructuralCell.CellType.VerticalFillCell)
                            {
                                verticalModuleCount++;
                            }
                            if (c.cellType == StructuralCell.CellType.PerimeterCell)
                            {
                                perimeterModuleCount++;
                            }
                            if (c.cellType != StructuralCell.CellType.InsideCell && c.cellType != StructuralCell.CellType.Undefined)
                            {
                                sw.WriteLine(c.id + "," + c.cellType.ToString() + "," + flag + "," + area);
                                modulesCount++;
                            }
                        }
                    }
                    bayNum++;
                }
            }
            sw.Close();

            StreamWriter sw2 = new StreamWriter(@"C:\Users\r.hudson\Documents\WORK\projects\passageProjects\caveparts\allModulesSummary.csv", true);

            sw2.WriteLine("part" + cavepart + ",total bays:," + bayNum + ",total modules all types:," + modulesCount +
                          ",cavern intersection modules:," + skinModuleCount + ",perimeter modules:," + perimeterModuleCount +
                          ",vertical support modules:," + verticalModuleCount);
            sw2.Close();
        }
Ejemplo n.º 3
0
        private void getModules(MeshVoxeliser mvox, ref DataTree <StructuralCell> perimeterCells, ref DataTree <StructuralCell> trimCells,
                                ref DataTree <StructuralCell> verticalCells, ref DataTree <StructuralCell> undefinedCells)
        {
            int bay  = 0;
            int side = 0;
            int cell = 0;

            foreach (StructuralSpan sp in mvox.structuralSpans)
            {
                foreach (StructuralBay sb in sp.structuralBays)
                {
                    side = 0;
                    foreach (List <StructuralCell> sc in sb.voxels)
                    {
                        cell = 0;
                        foreach (StructuralCell c in sc)
                        {
                            if (c.cellType != StructuralCell.CellType.InsideCell)
                            {
                                GH_Path path = new GH_Path(new int[] { bay, side, cell });
                                switch (c.cellType)
                                {
                                case StructuralCell.CellType.SkinCell:
                                    trimCells.Add(c, path);
                                    break;

                                case StructuralCell.CellType.PerimeterCell:
                                    perimeterCells.Add(c, path);
                                    break;

                                case StructuralCell.CellType.VerticalFillCell:
                                    verticalCells.Add(c, path);
                                    break;

                                case StructuralCell.CellType.Undefined:
                                    undefinedCells.Add(c, path);
                                    break;
                                }

                                cell++;
                            }
                        }
                        side++;
                    }
                    bay++;
                }
            }
        }
Ejemplo n.º 4
0
 private void getSlices(MeshVoxeliser mvox, ref GH_Structure <GH_Mesh> caveslices, ref GH_Structure <GH_Mesh> sectionboxes, ref GH_Structure <GH_Curve> grid, ref GH_Structure <GH_Curve> links)
 {
     foreach (Mesh b in mvox.spanBoxes)
     {
         sectionboxes.Append(new GH_Mesh(b));
     }
     foreach (StructuralSpan sp in mvox.structuralSpans)
     {
         caveslices.Append(new GH_Mesh(sp.slice));
         foreach (Line l in sp.xGrid)
         {
             grid.Append(new GH_Curve(l.ToNurbsCurve()));
         }
         foreach (Line l in sp.yGrid)
         {
             grid.Append(new GH_Curve(l.ToNurbsCurve()));
         }
         foreach (Line l in sp.linkElements)
         {
             links.Append(new GH_Curve(l.ToNurbsCurve()));
         }
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object can be used to retrieve data from input parameters and
        /// to store data in output parameters.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            List <Mesh>  meshes      = new List <Mesh>();
            List <Curve> bldGrid     = new List <Curve>();
            List <Brep>  slabs       = new List <Brep>();
            List <Brep>  roof        = new List <Brep>();
            double       xcell       = 0;
            double       ycell       = 0;
            double       zcell       = 0;
            double       memberT     = 0;
            int          numBays     = 0;
            int          startBay    = 0;
            bool         exploreMode = true;
            List <Brep>  walls       = new List <Brep>();
            Plane        refPlane    = new Plane();

            if (!DA.GetDataList(0, meshes))
            {
                return;
            }
            if (!DA.GetData(1, ref xcell))
            {
                return;
            }
            if (!DA.GetData(2, ref ycell))
            {
                return;
            }
            if (!DA.GetData(3, ref zcell))
            {
                return;
            }
            if (!DA.GetData(4, ref memberT))
            {
                return;
            }
            if (!DA.GetData(5, ref numBays))
            {
                return;
            }
            if (!DA.GetData(6, ref startBay))
            {
                return;
            }
            if (!DA.GetData(7, ref exploreMode))
            {
                return;
            }
            DA.GetData(8, ref refPlane);
            if (!DA.GetDataList(9, bldGrid))
            {
                return;
            }
            if (!DA.GetDataList(10, slabs))
            {
                return;
            }
            if (!DA.GetDataList(11, walls))
            {
                return;
            }
            if (!DA.GetDataList(12, roof))
            {
                return;
            }

            VoxelParameters parameters = new VoxelParameters(startBay, xcell, ycell, zcell, memberT, exploreMode, startBay, slabs, walls, roof);
            MeshVoxeliser   mvox       = new MeshVoxeliser(meshes, numBays, refPlane, parameters);
            VoxelDocumenter vDoc       = new VoxelDocumenter();

            vDoc.writeSection3d(mvox, bldGrid);
            vDoc.moduleSchedule(mvox);
            vDoc.map3dToWorldXY(mvox);
            DataTree <StructuralCell> perimeterCells       = new DataTree <StructuralCell>();
            DataTree <StructuralCell> skinCells            = new DataTree <StructuralCell>();
            DataTree <StructuralCell> verticalSupportCells = new DataTree <StructuralCell>();
            DataTree <StructuralCell> undefinedCells       = new DataTree <StructuralCell>();
            GH_Structure <GH_Mesh>    caveSlices           = new GH_Structure <GH_Mesh>();
            GH_Structure <GH_Mesh>    sectionBoxes         = new GH_Structure <GH_Mesh>();
            GH_Structure <GH_Curve>   grid  = new GH_Structure <GH_Curve>();
            GH_Structure <GH_Curve>   links = new GH_Structure <GH_Curve>();

            getSlices(mvox, ref caveSlices, ref sectionBoxes, ref grid, ref links);
            getModules(mvox, ref perimeterCells, ref skinCells, ref verticalSupportCells, ref undefinedCells);


            DA.SetDataTree(0, skinCells);
            DA.SetDataTree(1, perimeterCells);
            DA.SetDataTree(2, verticalSupportCells);
            DA.SetDataTree(3, caveSlices);
            DA.SetDataTree(4, sectionBoxes);
            DA.SetDataTree(5, grid);
            DA.SetDataTree(6, links);
            DA.SetDataTree(7, undefinedCells);
        }
Ejemplo n.º 6
0
        public void writeSection3d(MeshVoxeliser mvox, List <Curve> curvesToAdd)
        {
            File3dm file = setupFile();

            foreach (Curve c in curvesToAdd)
            {
                file.Objects.AddCurve(c, attBuildingGrid);
            }
            file.Objects.AddText(mvox.sectionNum, attAnnotation);
            foreach (StructuralSpan sp in mvox.structuralSpans)
            {
                foreach (Line xg in sp.xGrid)
                {
                    file.Objects.AddLine(xg, attGrid);
                }
                foreach (Line yg in sp.yGrid)
                {
                    file.Objects.AddLine(yg, attGrid);
                }
                foreach (Line bg in sp.baseGrid)
                {
                    file.Objects.AddLine(bg, attBasegrid);
                }
                foreach (Text3d text in sp.txt)
                {
                    file.Objects.AddText(text, attAnnotation);
                }
                foreach (StructuralBay sb in sp.structuralBays)
                {
                    foreach (List <StructuralCell> sc in sb.voxels)
                    {
                        foreach (StructuralCell c in sc)
                        {
                            if (c.cellType != StructuralCell.CellType.InsideCell && c.cellType != StructuralCell.CellType.Undefined)
                            {
                                attCavepanels.ObjectColor = c.displayColor;
                                if (c.caveFace != null)
                                {
                                    file.Objects.AddMesh(c.caveFace, attCavepanels);
                                }
                                foreach (Curve cl in c.centreLines)
                                {
                                    file.Objects.AddCurve(cl, attCentrelines);
                                }
                                foreach (Curve d in c.diagonals)
                                {
                                    file.Objects.AddCurve(d, attDiagonals);
                                }
                                if (c.GSAmesh != null)
                                {
                                    file.Objects.AddMesh(c.GSAmesh, attGsamesh);
                                }
                            }
                        }
                    }
                }
            }


            RhinoViewport viewport = new RhinoViewport();

            viewport.SetProjection(DefinedViewportProjection.Perspective, "cavern view", false);
            viewport.ZoomExtents();
            file.AllViews.Add(new ViewInfo(viewport));
            string cavepart = mvox.parameters.sectionNum.ToString();

            if (mvox.parameters.sectionNum < 10)
            {
                cavepart = "0" + cavepart;
            }
            file.Write(@"C:\Users\r.hudson\Documents\WORK\projects\passageProjects\caveparts\cavepart" + cavepart + "_3d.3dm", 5);
        }
Ejemplo n.º 7
0
        public void map3dToWorldXY(MeshVoxeliser mvox)
        {
            File3dm   file      = setupFile();
            Plane     mapFrom   = new Plane(mvox.structuralSpans[0].minPlane.Origin, mvox.structuralSpans[0].minPlane.XAxis, Vector3d.ZAxis);
            Transform transform = Transform.PlaneToPlane(mapFrom, Plane.WorldXY);

            foreach (StructuralSpan sp in mvox.structuralSpans)
            {
                foreach (StructuralBay sb in sp.structuralBays)
                {
                    double  maxX   = 0.0;
                    Point3d origin = new Point3d(sb.minPlane.Origin);
                    Plane   plnA   = new Plane(origin + sb.minPlane.YAxis * mvox.parameters.memberSize, sb.minPlane.XAxis, Vector3d.ZAxis);
                    //shift to end of module
                    Plane plnB = new Plane(origin + sb.minPlane.YAxis * sb.parameters.yCell, sb.minPlane.XAxis, Vector3d.ZAxis);
                    plnA.Flip();
                    plnA.Transform(transform);
                    plnB.Transform(transform);
                    string baytitle = sb.baynum.ToString();
                    if (sb.baynum < 10)
                    {
                        baytitle = "0" + baytitle;
                    }
                    setClippingPlanes(plnA, plnB, file, "bay_" + baytitle, sb.parameters.width, sb.parameters.height);
                    Text3d title = new Text3d("bay_" + baytitle, new Plane(plnA.Origin, Vector3d.ZAxis), 500);
                    file.Objects.AddText(title, attAnnotation);


                    foreach (List <StructuralCell> sc in sb.voxels)
                    {
                        foreach (StructuralCell c in sc)
                        {
                            if (c.cellType != StructuralCell.CellType.InsideCell && c.cellType != StructuralCell.CellType.Undefined)
                            {
                                attCavepanels.ObjectColor = c.displayColor;
                                if (c.id == "06_00_0_17_0")
                                {
                                    int g = 0;
                                }
                                if (c.caveFace != null)
                                {
                                    c.caveFace.Transform(transform);
                                    c.midPlane.Transform(transform);
                                    file.Objects.AddMesh(c.caveFace, attCavepanels);
                                }
                                foreach (Curve cl in c.centreLines)
                                {
                                    cl.Transform(transform);
                                    if (cl.PointAtStart.X > maxX)
                                    {
                                        maxX = cl.PointAtStart.X;
                                    }
                                    file.Objects.AddCurve(cl, attCentrelines);
                                }
                                foreach (Curve d in c.diagonals)
                                {
                                    d.Transform(transform);
                                    file.Objects.AddCurve(d, attDiagonals);
                                }
                                //if (c.GSAmesh != null)
                                //{
                                //    c.GSAmesh.Transform(transform);
                                //    file.Objects.AddMesh(c.GSAmesh, attGsamesh);
                                //}
                            }
                        }
                    }
                    addcavepanels2d(sb.voxels.SelectMany(x => x).ToList(), file, plnA, maxX);
                }
            }
            string cavepart = mvox.parameters.sectionNum.ToString();

            if (mvox.parameters.sectionNum < 10)
            {
                cavepart = "0" + cavepart;
            }
            file.Write(@"C:\Users\r.hudson\Documents\WORK\projects\passageProjects\caveparts\cavepart" + cavepart + "_BaySections.3dm", 5);
        }