public MeshVoxeliser(List <Mesh> meshes, int endBay, Plane refPlane, VoxelParameters prms) { parameters = prms; meshesToVoxelise = meshes; meshesToVoxelise.ForEach(m => m.Normals.ComputeNormals()); meshesToVoxelise.ForEach(m => m.FaceNormals.ComputeFaceNormals()); gridPlane = refPlane; setText(parameters.partNumber); //findBBox(); setupSpans(endBay); }
public StructuralBay(Mesh sliceToVoxelise, Plane minpln, Plane maxpln, VoxelParameters voxelParameters, bool firstBay, int num) { voxels.Add(new List <StructuralCell>()); voxels.Add(new List <StructuralCell>()); slice = sliceToVoxelise; minPlane = minpln; maxPlane = maxpln; parameters = voxelParameters; leader = firstBay; baynum = num; if (!parameters.explore) { voxelise(); } }
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(); } }
public StructuralSpan(VoxelParameters vParams, Mesh m, Plane plane, int firstBay, Brep container) { parameters = vParams; slice = m; referencePlane = plane; bayNum = firstBay; setBaseGrid(); if (parameters.hanging) { } else { findVerticalFit(); findHorizFit(); } structuralBays.Add(new StructuralBay(slice, minPlane, maxPlane, parameters, true, firstBay)); //structuralBays.Add(new StructuralBay(structuralBays[0])); setLinkElements(); setGrid(); }
/// <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); }