/***************************************************/ // Constructors. public Panel(Brep surface, double thickness, Material material, int id = -1, Element2D.Element2DType feType = Element2D.Element2DType.Unknown) { this._surface = surface; this._thickness = thickness; this._feType = feType; this._material = material; this._elements = new List <Element>(); // Set the local coordinate system. IEnumerable <Point3d> vertices = surface.Vertices.Select(p => p.Location); PlaneFitResult pfr = Plane.FitPlaneToPoints(vertices, out this._lcs); if (pfr != PlaneFitResult.Success) { throw new Exception("Geometry of the panel seems to be faulty!"); } this._lcs.Origin = GeometryUtil.Average(vertices); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { Brep surface = null; double thickness = double.NaN; Material material = null; Element2D.Element2DType feType = Element2D.Element2DType.Unknown; DA.GetData(0, ref surface); DA.GetData(1, ref thickness); DA.GetData(2, ref material); DA.GetData(3, ref feType); List <Panel> panels = new List <Panel>(); for (int i = 0; i < surface.Faces.Count; i++) { panels.Add(new Panel(surface.Faces.ExtractFace(i), thickness, material, -1, feType)); } DA.SetDataList(0, panels); }