public Glulam GlulamFromCurveMesh(Curve crv, Mesh mesh, GlulamType type = GlulamType.DoubleCurved, Standards.Standard standard = Standards.Standard.None, double tolerance = 10.0) { double width, height; GlulamData data; Plane xform = new Plane(crv.PointAtStart, crv.PointAtEnd - crv.PointAtStart); Polyline convex_hull; if (crv.IsLinear()) { type = GlulamType.Straight; } else if (crv.IsPlanar()) { type = GlulamType.SingleCurved; } Beam beam; switch (type) { case GlulamType.Straight: var line_curve = new Line(crv.PointAtStart, crv.PointAtEnd); Plane plane = xform; mesh.FitToAxes(plane, out convex_hull, ref xform); height = convex_hull.BoundingBox.Max.Y - convex_hull.BoundingBox.Min.Y; width = convex_hull.BoundingBox.Max.X - convex_hull.BoundingBox.Min.X; data = new GlulamData(1, 1, width, height); var orientation = new VectorOrientation(xform.YAxis); return(Glulam.CreateGlulam(line_curve.ToNurbsCurve(), orientation, data)); case GlulamType.SingleCurved: crv.TryGetPlane(out Plane project, tolerance); mesh.FitToAxes(project, out convex_hull, ref xform); var cbb = crv.GetBoundingBox(project); height = (convex_hull.BoundingBox.Max.Y - convex_hull.BoundingBox.Min.Y) - (cbb.Max.Y - cbb.Min.Y); width = (convex_hull.BoundingBox.Max.X - convex_hull.BoundingBox.Min.X) - (cbb.Max.X - cbb.Min.X); beam = new Beam { Centreline = crv, Orientation = new PlanarOrientation(project), Width = width, Height = height }; return(Glulam.CreateGlulam(beam, beam.Orientation, standard)); case GlulamType.DoubleCurved: default: beam = new Beam { Centreline = crv, Orientation = new RmfOrientation() }; var gmesh = beam.ToBeamSpace(mesh); var bb = gmesh.GetBoundingBox(true); beam.Height = bb.Max.Y - bb.Min.Y; beam.Width = bb.Max.X - bb.Min.X; return(Glulam.CreateGlulam(beam, beam.Orientation, standard)); } }
static public Glulam CreateGlulam(Beam beam, CrossSectionOrientation orientation, Standards.Standard standard = Standards.Standard.None) { Glulam glulam; if (beam.Centreline.IsLinear(Tolerance)) { glulam = new StraightGlulam { Centreline = beam.Centreline.DuplicateCurve(), Orientation = orientation, Data = new GlulamData() }; glulam.Data.Compute(beam, standard); } else if (beam.Centreline.IsPlanar(Tolerance)) { glulam = new SingleCurvedGlulam { Centreline = beam.Centreline.DuplicateCurve(), Orientation = orientation, Data = new GlulamData() }; glulam.Data.Compute(beam, standard); } else { glulam = new DoubleCurvedGlulam { Centreline = beam.Centreline.DuplicateCurve(), Orientation = orientation, Data = new GlulamData() }; glulam.Data.Compute(beam, standard); } return(glulam); }