public void ApplyPointLoadsByPattern(string patternName) { foreach (sNode sn in this.nodes) { StatNode stn = sn.extraData as StatNode; if (stn != null) { if (sn.pointLoads != null && sn.pointLoads.Count > 0) { sXYZ load = sXYZ.Zero(); //sXYZ moment = sXYZ.Zero(); foreach (sPointLoad pl in sn.pointLoads) { if (pl.loadPatternName == patternName) { load += pl.forceVector; //moment += pl.momentVector; //currently StatSystem cannot do moment load } } if (load.GetLength() > 0.0) { stn.AddLoad(load.X, load.Y, load.Z); } } } } }
public void ApplyLineLoadsByPattern(string patternName) { foreach (StatBeam stb in this.FEsystem.Beams) { sFrame sb = stb.ExtraData as sFrame; if (sb != null) { if (sb.lineLoads != null && sb.lineLoads.Count > 0) { sXYZ load = sXYZ.Zero(); //sXYZ moment = sXYZ.Zero(); //double scalar = 0.0; foreach (sLineLoad ll in sb.lineLoads) { if (ll.loadPatternName == patternName) { load += ll.load_Force; //moment += ll.load_Moment; //scalar += ll.load_Scalar; } } if (load.GetLength() > 0.0) { stb.AppliedLinearLoad = new C_vector(load.X, load.Y, load.Z); } } } } }
public void AwareLocalPlane(sXYZ upVec) { sXYZ beamDir = this.axis.direction; beamDir.Unitize(); double dot = Math.Abs(beamDir * sXYZ.Zaxis()); bool isVertical = false; if (dot > 0.9) { isVertical = true; } this.upVector = upVec; if (isVertical) { this.upVector = sXYZ.Xaxis(); } sXYZ lx = this.axis.direction; lx.Unitize(); sXYZ lz = this.upVector; lz.Unitize(); sXYZ ly = sXYZ.CrossProduct(lx, lz); ly.Unitize(); this.localPlane = new sPlane(this.node0.location, lx, ly); }
public bool AwareExistingNode(sXYZ location, out sNode existingNode) { sNode exn = null; if (this.nodes != null && this.nodes.Count > 0) { foreach (sNode sn in this.nodes) { double dis = location.DistanceTo(sn.location); if (dis < 0.001) { exn = sn; break; } } } if (exn != null) { existingNode = exn; return(true); } else { existingNode = null; return(false); } }
public sFrame(sNode n0, sNode n1, sXYZ upVec) { this.node0 = n0; this.node1 = n1; this.axis = new sLine(n0.location, n1.location); this.AwareLocalPlane(upVec); }
public sFrame(sLine axln, sXYZ upVec) { this.node0 = new sNode(); this.node0.location = axln.startPoint; this.node1 = new sNode(); this.node1.location = axln.endPoint; this.axis = axln; this.AwareLocalPlane(upVec); }
public bool IsOnLocation(sXYZ loc, double tol) { bool isOn = false; if (loc != null) { if (this.location.DistanceTo(loc) < tol) { isOn = true; } } return(isOn); }
public sLineLoad(string pattern, eLoadType type, bool IsGlobal, sXYZ forceVec = null, sXYZ momentVec = null, double loadScalar = 0.0) { this.loadPatternName = pattern; this.loadType = type; this.AsGlobalCorSys = IsGlobal; if (loadScalar > 0.0) { this.load_Scalar = loadScalar; } if (forceVec != null) { this.load_Force = forceVec; } if (momentVec != null) { this.load_Moment = momentVec; } }
public void AddBeamElement(sLine sln, sXYZ upvec, int id) { sFrame sb = new sFrame(sln, upvec.DuplicatesXYZ()); sb.parentGuid = this.objectGUID; sb.frameName = this.frameSetName + "_" + this.setId + "_" + id; sb.frameID = id; sb.crossSection = this.crossSection; //load if (this.lineLoads != null) { sb.lineLoads = new List <sLineLoad>(); foreach (sLineLoad ll in this.lineLoads) { sb.lineLoads.Add(ll.DuplicatesLineLoad()); } } this.frames.Add(sb); }
public static object sPointSupport(List <Dyn.Point> points, int supportType, string nodeName = "") { List <sPointSupport> nodes = new List <sPointSupport>(); sDynamoConverter rhcon = new sDynamoConverter("Feet", "Meters"); if (supportType == 0 || supportType == 1) { for (int i = 0; i < points.Count; ++i) { Dyn.Point dp = rhcon.EnsureUnit(points[i]) as Dyn.Point; sXYZ sp = rhcon.TosXYZ(dp); sPointSupport n = new sPointSupport(); n.location = sp; if (supportType == 0) { n.supportType = eSupportType.FIXED; } else if (supportType == 1) { n.supportType = eSupportType.PINNED; } nodes.Add(n); dp.Dispose(); } } return(new Dictionary <string, object> { { "sPointSupport", nodes } }); }
public Vector3d ToRhinoVector3d(sXYZ sxyz) { return(new Vector3d(sxyz.X, sxyz.Y, sxyz.Z)); }
public Point3d ToRhinoPoint3d(sXYZ sxyz) { return(new Point3d(sxyz.X, sxyz.Y, sxyz.Z)); }
public C_vector ToCVector(sXYZ jxyz) { return(new C_vector(jxyz.X, jxyz.Y, jxyz.Z)); }
protected override void SolveInstance(IGH_DataAccess DA) { List <IFrameSet> beamsets = new List <IFrameSet>(); List <Vector3d> upvectors = new List <Vector3d>(); if (!DA.GetDataList(0, beamsets)) { return; } if (!DA.GetDataList(1, upvectors)) { return; } string modelUnit = Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem.ToString(); sRhinoConverter rhcon = new sRhinoConverter(modelUnit, "Meters"); sRhinoConverter rhcon_ToRhinoModel = new sRhinoConverter("Meters", modelUnit); List <IFrameSet> duplicated = new List <IFrameSet>(); List <Point3d> pts = new List <Point3d>(); List <Vector3d> vecs = new List <Vector3d>(); this.Message = ""; int nonSegCount = 0; if (upvectors.Count == beamsets.Count) { for (int i = 0; i < beamsets.Count; ++i) { if (beamsets[i].frames.Count > 0) { sXYZ upvecThis = rhcon.TosXYZ(upvectors[i]); IFrameSet dubs = beamsets[i].DuplicatesFrameSet(); dubs.EnsureBeamElement(); foreach (sFrame sb in dubs.frames) { sb.AwareLocalPlane(upvecThis); pts.Add(rhcon_ToRhinoModel.EnsureUnit(rhcon.ToRhinoPoint3d(sb.axis.PointAt(0.5)))); vecs.Add(rhcon.ToRhinoVector3d(sb.upVector)); } duplicated.Add(dubs); } else { nonSegCount++; } } } else if (upvectors.Count == 1) { foreach (IFrameSet bs in beamsets) { if (bs.frames.Count > 0) { IFrameSet dubs = bs.DuplicatesFrameSet(); dubs.EnsureBeamElement(); foreach (sFrame sb in dubs.frames) { sb.AwareLocalPlane(rhcon.TosXYZ(upvectors[0])); pts.Add(rhcon_ToRhinoModel.EnsureUnit(rhcon.ToRhinoPoint3d(sb.axis.PointAt(0.5)))); vecs.Add(rhcon.ToRhinoVector3d(sb.upVector)); } duplicated.Add(dubs); } else { nonSegCount++; } } } else { this.Message = ""; return; } if (nonSegCount == 0) { DA.SetDataList(0, duplicated); DA.SetDataList(1, pts); DA.SetDataList(2, vecs); } else { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Segmentize Beam Set First To Assign Upvectors"); //this.Message = "Segmentize Beam Set First To Assign Upvectors"; } }
public sMesh ConstructBeamColorMesh(sRange dataRange, eColorMode colorMode, sRange threshold, double du) { sMesh sm = new sMesh(); int vertexID = 0; for (int i = 0; i < this.results.Count; ++i) { sFrameResult br = this.results[i]; for (int j = 0; j < br.sectionResults.Count; ++j) { sFrameSectionResult sr = br.sectionResults[j]; sColor vcol = this.GetBeamResultColor(dataRange, colorMode, i, j, 255, threshold); sXYZ deflectionVec = du * (sr.deflection_mm * 0.001); sXYZ deflectedPt = sr.location + deflectionVec; sm.SetVertex(vertexID, deflectedPt, vcol); //or //sm.SetVertex(vertexID, sr.point, vcol); sr.ID = vertexID; vertexID++; } } int vertexCountPerFace = this.results[0].sectionResults.Count; int faceIndex = 0; for (int i = 0; i < this.results.Count - 1; ++i) { sFrameResult br_this = this.results[i]; sFrameResult br_next = this.results[i + 1]; for (int j = 0; j < br_this.sectionResults.Count; ++j) { int id0 = 0; int id1 = 0; int id2 = 0; int id3 = 0; if (j < br_this.sectionResults.Count - 1) { id0 = br_this.sectionResults[j].ID; id1 = br_next.sectionResults[j].ID; id2 = br_next.sectionResults[j + 1].ID; id3 = br_this.sectionResults[j + 1].ID; } else { id0 = br_this.sectionResults[j].ID; id1 = br_next.sectionResults[j].ID; id2 = br_next.sectionResults[0].ID; id3 = br_this.sectionResults[0].ID; } sm.SetFace(faceIndex, faceIndex + 1, id0, id1, id2, id3); faceIndex += 2; } } sm.ComputeNormals(); return(sm); }
internal Dyn.Point ToDynamoPoint(sXYZ sxyz) { return(Dyn.Point.ByCoordinates(sxyz.X, sxyz.Y, sxyz.Z)); }
private void AwaresBeamResult(sFrame sb, ref sResultRange bsRe, double dataLenTol) { StatBeamResults br = new StatBeamResults(); sStatConverter conv = new sStatConverter(); StatBeam b = sb.extraData as StatBeam; b.RecoverForces(); sb.beamWeight = b.Weight; sb.results = new List <sFrameResult>(); double len = sb.axis.length; int count = (int)(len / dataLenTol); if (count < 1) { count = 1; } double step = 1.0 / (double)(count); for (int i = 0; i < count + 1; ++i) { double tNow = step * i; br.t = tNow; b.GetInterpolatedResultsAt(new C_vector(0, 0, -1), this.FEsystem.DeadLoadFactor, br); sFrameResult bre = new sFrameResult(); bre.moment = new sXYZ(br.MomentL.x, br.MomentL.y, br.MomentL.z); bre.force = new sXYZ(-br.ForceL.x, br.ForceL.y, br.ForceL.z); /// force X negate????????? bre.deflection_mm = conv.TosXYZ(b.Csys.LocalToGlobalVector(br.DeflL * 1000)); bre.deflectionLocal_mm = conv.TosXYZ(br.DeflL * 1000); bre.parameterAt = tNow; sPlane secPlane = new sPlane(sb.axis.PointAt(tNow), sb.localPlane.Xaxis, sb.localPlane.Yaxis); List <sXYZ> secVertices = new List <sXYZ>(); if (sb.crossSection.sectionType == eSectionType.AISC_I_BEAM) { secVertices = sb.crossSection.GetWbeamFaceVertices(secPlane).ToList(); } else if (sb.crossSection.sectionType == eSectionType.HSS_REC) { secVertices = sb.crossSection.GetHSSRecFaceVertices_Simple(secPlane).ToList(); } else if (sb.crossSection.sectionType == eSectionType.HSS_ROUND) { secVertices = sb.crossSection.GetHSSRoundFaceVertices_Simple(secPlane).ToList(); } else if (sb.crossSection.sectionType == eSectionType.SQUARE) { secVertices = sb.crossSection.GetSquareFaceVertices_Simple(secPlane).ToList(); } else if (sb.crossSection.sectionType == eSectionType.RECTANGLAR) { secVertices = sb.crossSection.GetRecFaceVertices_Simple(secPlane).ToList(); } else if (sb.crossSection.sectionType == eSectionType.ROUND) { secVertices = sb.crossSection.GetRoundFaceVertices_Simple(secPlane).ToList(); } if (secVertices != null) { for (int j = 0; j < secVertices.Count; ++j) { sXYZ svp = secVertices[j]; sXYZ localDir = svp - sb.axis.PointAt(tNow); sXYZ ToLocalZ = localDir.ProjectTo(secPlane.Zaxis); sXYZ ToLocalY = localDir.ProjectTo(secPlane.Yaxis); double len_ToLocalZ = ToLocalZ.Z; // vertical like double len_ToLocalY = ToLocalY.Y; // horizontal like br.zL = len_ToLocalZ; // vertical like br.yL = len_ToLocalY; // horizontal like double axialStress_X = (br.ForceL.x / b.CrossSection.Area); //double axialStress_Y = ??; //double axialStress_Z = ??; double MyStress = ((br.MomentL.y * br.zL) / b.CrossSection.Iyy); double MzStress = ((br.MomentL.z * br.yL) / b.CrossSection.Izz); //double MxStress = ?? double stressTest = axialStress_X + MyStress - MzStress; //why negate?...(StatBeamResult does this) //do I need? //b.GetSectionPointResult(br); sFrameSectionResult secRe = new sFrameSectionResult(); secRe.location = svp; secRe.deflection_mm = conv.TosXYZ(b.Csys.LocalToGlobalVector(br.DeflL * 1000)); secRe.stress_Combined = Math.Abs(stressTest); secRe.stress_Axial_X = axialStress_X; secRe.stress_Moment_Y = MyStress; secRe.stress_Moment_Z = MzStress; bre.sectionResults.Add(secRe); } } bsRe.UpdateMaxValues(bre); sb.results.Add(bre); } }
public sNode(sXYZ loc) { this.location = loc; }
public sLocationVectorPair(sXYZ loc, sXYZ vec) { this.location = loc; this.vector = vec; }
internal Dyn.Vector ToDynamoVector(sXYZ sxyz) { return(Dyn.Vector.ByCoordinates(sxyz.X, sxyz.Y, sxyz.Z)); }
protected override void SolveInstance(IGH_DataAccess DA) { List <Point3d> points = new List <Point3d>(); if (!DA.GetDataList(0, points)) { return; } List <sPointSupport> nodes = new List <sPointSupport>(); string modelUnit = Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem.ToString(); sRhinoConverter rhcon = new sRhinoConverter(modelUnit, "Meters"); if (supType == eSupportType.FIXED || supType == eSupportType.PINNED) { for (int i = 0; i < points.Count; ++i) { sXYZ sp = rhcon.TosXYZ((Point3d)rhcon.EnsureUnit(points[i])); sPointSupport n = new sPointSupport(); n.location = sp; n.supportType = supType; nodes.Add(n); } } else { bool xx = true; bool yy = true; bool zz = true; bool rxx = true; bool ryy = true; bool rzz = true; if (!DA.GetData(1, ref xx)) { return; } if (!DA.GetData(2, ref yy)) { return; } if (!DA.GetData(3, ref zz)) { return; } if (!DA.GetData(4, ref rxx)) { return; } if (!DA.GetData(5, ref ryy)) { return; } if (!DA.GetData(6, ref rzz)) { return; } foreach (Point3d p in points) { sXYZ sp = rhcon.TosXYZ((Point3d)rhcon.EnsureUnit(p)); sPointSupport n = new sPointSupport(); n.location = sp; n.supportType = supType; n.constraints = new bool[6] { xx, yy, zz, rxx, ryy, rzz }; nodes.Add(n); } } if (supType == eSupportType.FIXED) { this.Message = "ALL FIXED"; } else if (supType == eSupportType.PINNED) { this.Message = "ALL PINNED"; } else { this.Message = "By Constraints"; } DA.SetDataList(0, nodes); }