/// <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) { HM.hMember member = null; List <Point3d> points = new List <Point3d>(); List <string> types = new List <string>(); if (!DA.GetData(0, ref member)) { return; } if (!DA.GetDataList(1, points)) { return; } if (!DA.GetDataList(2, types)) { return; } if (points.Count != types.Count) { return; } var newMember = new HM.hMember(member); for (int i = 0; i < points.Count; i++) { newMember.AddOperationByPointType(HMGHUtil.PointToTriple(points[i]), types[i]); } DA.SetData(0, newMember); }
/// <summary> /// Adds operations to a member by specifiying the operation types and the points along the axis of the member at which they occur /// </summary> /// <param name="member"></param> /// <param name="points"></param> /// <param name="types"></param> /// <returns name="hMember">></returns> public hMember AddOperationByPointType(List <Geo.Point> points, List <string> types) { hMember newMember = new hMember(this); for (int i = 0; i < points.Count; i++) { newMember.AddOperationByPointType(points[i], types[i]); } return(newMember); }
// ██████╗ ██╗ ██╗██████╗ // ██╔══██╗██║ ██║██╔══██╗ // ██████╔╝██║ ██║██████╔╝ // ██╔═══╝ ██║ ██║██╔══██╗ // ██║ ╚██████╔╝██████╔╝ // ╚═╝ ╚═════╝ ╚═════╝ // /// <summary> /// Adds operations to the member by specifying the locations and the types of operations /// </summary> /// <param name="member"></param> /// <param name="locations"></param> /// <param name="types"></param> /// <returns name="hMember"></returns> public hMember AddOperationByLocationType(List <double> locations, List <string> types) { hMember newMember = new hMember(this); for (int i = 0; i < locations.Count; i++) { hOperation op = new hOperation(locations[i], (Operation)System.Enum.Parse(typeof(Operation), types[i])); newMember.AddOperation(op); } return(newMember); }
private static bool OperationsOverhangEnd(hMember member) { var potentiallyOverhangingOps = member.Operations.Where(op => op._type == Operation.NOTCH || op._type == Operation.LIP_CUT); foreach (hOperation op in potentiallyOverhangingOps) { if (op._loc >= member.Length - 1) { return(true); } } return(false); }
internal hMember(hMember member) { _webAxis = member._webAxis; _webNormal = member._webNormal; _name = member._name; foreach (hConnection con in member.connections) { this.connections.Add(con); } foreach (hOperation op in member.operations) { this.operations.Add(op); } }
public static Dictionary <string, object> Draw(hMember member) { Geo.Point OP1 = member._webAxis.StartPoint; Geo.Point OP2 = member._webAxis.EndPoint; Geo.Vector webAxis = Geo.Vector.ByTwoPoints(OP1, OP2); Geo.Vector normal = member._webNormal; Geo.Vector lateral = webAxis.Cross(normal); lateral = lateral.Normalized(); lateral = lateral.Scale(1.75); normal = normal.Normalized(); normal = normal.Scale(1.5); Geo.Vector lateralR = Geo.Vector.ByCoordinates(lateral.X * -1, lateral.Y * -1, lateral.Z * -1); Geo.Point p0 = OP1.Add(normal.Add(lateral)); Geo.Point p1 = OP2.Add(normal.Add(lateral)); Geo.Point p2 = OP1.Add(lateral); Geo.Point p3 = OP2.Add(lateral); Geo.Point p6 = OP1.Add(normal.Add(lateralR)); Geo.Point p7 = OP2.Add(normal.Add(lateralR)); Geo.Point p4 = OP1.Add(lateralR); Geo.Point p5 = OP2.Add(lateralR); Geo.Point[] pts = { p0, p1, p2, p1, p2, p3, p2, p3, p4, p3, p4, p5, p4, p5, p6, p5, p6, p7 }; Geo.IndexGroup g0 = Geo.IndexGroup.ByIndices(0, 1, 2); Geo.IndexGroup g1 = Geo.IndexGroup.ByIndices(3, 4, 5); Geo.IndexGroup g2 = Geo.IndexGroup.ByIndices(6, 7, 8); Geo.IndexGroup g3 = Geo.IndexGroup.ByIndices(9, 10, 11); Geo.IndexGroup g4 = Geo.IndexGroup.ByIndices(12, 13, 14); Geo.IndexGroup g5 = Geo.IndexGroup.ByIndices(15, 16, 17); Geo.IndexGroup[] ig = { g0, g1, g2, g3, g4, g5 }; Geo.Mesh mesh = Geo.Mesh.ByPointsFaceIndices(pts, ig); var points = new List <Geo.Point>(); foreach (hOperation op in member.operations) { points.Add(member._webAxis.PointAtParameter(op._loc / member._webAxis.Length)); } return(new Dictionary <string, object> { { "member", mesh }, { "operations", points } }); }
/// <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) { // 1. Declare placeholder variables and assign initial invalid data. // This way, if the input parameters fail to supply valid data, we know when to abort. HM.hMember member = null; // 2. Retrieve input data. if (!DA.GetData(0, ref member)) { return; } var webNormal = member.WebNormal; DA.SetData(0, HMGHUtil.TripleToVector(webNormal)); }
/// <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) { // 1. Declare placeholder variables and assign initial invalid data. // This way, if the input parameters fail to supply valid data, we know when to abort. Line line = Line.Unset; Vector3d vector = Vector3d.Unset; string name = string.Empty; // 2. Retrieve input data. if (!DA.GetData(0, ref line)) { return; } if (!DA.GetData(1, ref vector)) { return; } if (!DA.GetData(2, ref name)) { name = "<name>"; } // 3. Abort on invalid inputs. if (!line.IsValid) { return; } if (!vector.IsValid) { return; } // 4. Build hMember. var mem = new HM.hMember(HMGHUtil.GHLineToHMLine(line), HMGHUtil.VectorToTriple(vector)); mem.Name = name; // 9. Assign output. DA.SetData(0, mem); }
/// <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) { // 1. Declare placeholder variables and assign initial invalid data. // This way, if the input parameters fail to supply valid data, we know when to abort. HM.hMember member = null; // 2. Retrieve input data. if (!DA.GetData(0, ref member)) { return; } // 3. Abort on invalid inputs. //if (!member.IsValid) { return; } var webAxisLine = member.WebAxis; var webNormal = member.WebNormal; var OP1 = webAxisLine.StartPoint; var OP2 = webAxisLine.EndPoint; var webAxis = HM.Triple.ByTwoPoints(OP1, OP2); var normal = webNormal; var lateral = webAxis.Cross(normal); lateral = lateral.Normalized(); lateral = lateral.Scale(1.75); normal = normal.Normalized(); normal = normal.Scale(1.5); var lateralR = new HM.Triple(lateral.X * -1, lateral.Y * -1, lateral.Z * -1); var webAxisR = new HM.Triple(webAxis.X * -1, webAxis.Y * -1, webAxis.Z * -1); var normalR = new HM.Triple(normal.X * -1, normal.Y * -1, normal.Z * -1); var p0 = HMGHUtil.TripleToPoint(OP1.Add(normal.Add(lateral))); var p1 = HMGHUtil.TripleToPoint(OP2.Add(normal.Add(lateral))); var p2 = HMGHUtil.TripleToPoint(OP1.Add(lateral)); var p3 = HMGHUtil.TripleToPoint(OP2.Add(lateral)); var p6 = HMGHUtil.TripleToPoint(OP1.Add(normal.Add(lateralR))); var p7 = HMGHUtil.TripleToPoint(OP2.Add(normal.Add(lateralR))); var p4 = HMGHUtil.TripleToPoint(OP1.Add(lateralR)); var p5 = HMGHUtil.TripleToPoint(OP2.Add(lateralR)); lateral = lateral.Normalized().Scale(1.25); lateralR = lateralR.Normalized().Scale(1.25); var p8 = HMGHUtil.TripleToPoint(OP1.Add(lateralR).Add(normal)); var p9 = HMGHUtil.TripleToPoint(OP2.Add(lateralR).Add(normal)); var p10 = HMGHUtil.TripleToPoint(OP1.Add(lateral).Add(normal)); var p11 = HMGHUtil.TripleToPoint(OP2.Add(lateral).Add(normal)); var flange1 = NurbsSurface.CreateFromCorners(p0, p1, p3, p2); var flange2 = NurbsSurface.CreateFromCorners(p4, p5, p7, p6); var web = NurbsSurface.CreateFromCorners(p2, p3, p5, p4); var lip1 = NurbsSurface.CreateFromCorners(p0, p1, p11, p10); var lip2 = NurbsSurface.CreateFromCorners(p6, p7, p9, p8); var memGeo = new List <Brep>() { Brep.CreateFromSurface(flange1), Brep.CreateFromSurface(flange2), Brep.CreateFromSurface(web), Brep.CreateFromSurface(lip1), Brep.CreateFromSurface(lip2) }; var brep = Brep.JoinBreps(memGeo, 0.001)[0]; DA.SetData(0, brep); }
/// <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) { // Get member from input HM.hMember member = null; if (!DA.GetData(0, ref member)) { return; } // Get member properties as Rhino Geometry var webAxisLine = HMGHUtil.HMLineToGHLine(member.WebAxis); var webAxisDirection = HMGHUtil.TripleToVector(member.WebAxis.Direction.Normalized()); var webNormal = HMGHUtil.TripleToVector(member.WebNormal.Normalized()); var flangeNormal = HMGHUtil.TripleToVector(member.WebNormal.Cross(member.WebAxis.Direction).Normalized()); // Get operations as curves var opCurves = new List <Curve>(); foreach (HM.hOperation op in member.Operations) { // Get centerpoints var centerTriples = member.GetOperationPunchCenterPoint(op); var centerPoints = new List <Point3d>(); foreach (HM.Triple t in centerTriples) { centerPoints.Add(HMGHUtil.TripleToPoint(t)); } switch (op._type) { case HM.Operation.BOLT: opCurves.Add(new Circle(new Plane(centerPoints[0], webNormal), 0.25).ToNurbsCurve()); break; case HM.Operation.SERVICE_HOLE: opCurves.Add(new Circle(new Plane(centerPoints[0], webNormal), 0.5).ToNurbsCurve()); break; case HM.Operation.WEB: foreach (Point3d p in centerPoints) { opCurves.Add(new Circle(new Plane(p, webNormal), 0.0625).ToNurbsCurve()); } break; case HM.Operation.DIMPLE: foreach (Point3d p in centerPoints) { opCurves.Add(new Circle(new Plane(p, flangeNormal), 0.0625).ToNurbsCurve()); } break; case HM.Operation.NOTCH: opCurves.Add(new Rectangle3d(new Plane(centerPoints[0], flangeNormal, webAxisDirection), new Interval(-1.75, 1.75), new Interval(-1.75 / 2, 1.75 / 2)).ToNurbsCurve()); break; case HM.Operation.END_TRUSS: var midPoint = member.WebAxis.PointAtParameter(0.5); var endPoint = member.WebAxis.PointAtParameter(member.WebAxis.ParameterAtPoint(centerTriples[0])); var endTrussDirection = HMGHUtil.TripleToVector(HM.Triple.ByTwoPoints(endPoint, midPoint).Normalized()); foreach (Point3d p in centerPoints) { var p1 = Point3d.Add(p, Vector3d.Multiply(0.25, webNormal)); var p2 = Point3d.Add(p, Vector3d.Multiply(0.75, webNormal)); var p3 = Point3d.Add(p2, Vector3d.Multiply(0.5, endTrussDirection)); opCurves.Add(new Polyline(new List <Point3d> { p1, p2, p3, p1 }).ToNurbsCurve()); var p4 = Point3d.Add(p, Vector3d.Multiply(-0.25, webNormal)); var p5 = Point3d.Add(p, Vector3d.Multiply(-0.75, webNormal)); var p6 = Point3d.Add(p5, Vector3d.Multiply(0.5, endTrussDirection)); opCurves.Add(new Polyline(new List <Point3d> { p4, p5, p6, p4 }).ToNurbsCurve()); } break; case HM.Operation.LIP_CUT: foreach (Point3d p in centerPoints) { opCurves.Add(new Rectangle3d(new Plane(p, flangeNormal, webAxisDirection), new Interval(-0.25, 0.25), new Interval(-1.75 / 2, 1.75 / 2)).ToNurbsCurve()); } break; case HM.Operation.SWAGE: var left = Vector3d.Multiply(1.25, flangeNormal); var right = Vector3d.Multiply(-1.25, flangeNormal); var up = Vector3d.Multiply(0.875, webAxisDirection); var down = Vector3d.Multiply(-0.875, webAxisDirection); var pt1 = Point3d.Add(Point3d.Add(centerPoints[0], left), up); var pt2 = Point3d.Add(Point3d.Add(centerPoints[0], left), down); var pt3 = Point3d.Add(Point3d.Add(centerPoints[0], right), up); var pt4 = Point3d.Add(Point3d.Add(centerPoints[0], right), down); opCurves.Add(new Line(pt1, pt2).ToNurbsCurve()); opCurves.Add(new Line(pt3, pt4).ToNurbsCurve()); break; } } DA.SetDataList(0, opCurves); }
/// <summary> /// Returns a string representing the hMember as a csv line to be produced on the Howick /// </summary> /// <param name="member"></param> /// <param name="normalLabel"></param> /// <returns></returns> public static string AsCSVLine(hMember member, bool normalLabel = true) { return(member.AsCSVLine(normalLabel)); }
// ██████╗ ██╗ ██╗██████╗ ██████╗███╗ ██╗███████╗████████╗██████╗ // ██╔══██╗██║ ██║██╔══██╗ ██╔════╝████╗ ██║██╔════╝╚══██╔══╝██╔══██╗ // ██████╔╝██║ ██║██████╔╝ ██║ ██╔██╗ ██║███████╗ ██║ ██████╔╝ // ██╔═══╝ ██║ ██║██╔══██╗ ██║ ██║╚██╗██║╚════██║ ██║ ██╔══██╗ // ██║ ╚██████╔╝██████╔╝ ╚██████╗██║ ╚████║███████║ ██║ ██║ ██║ // ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚═╝ ╚═╝ // /// <summary> /// Creates an hMember with its web lying along the webAxis, facing webNormal /// </summary> /// <param name="webAxis"></param> /// <param name="webNormal"></param> /// <param name="name"></param> /// <returns name="hMember"></returns> public static hMember ByLineVector(Geo.Line webAxis, Geo.Vector webNormal, string name = "0") { hMember member = new hMember(webAxis, webNormal.Normalized(), name); return(member); }