internal void ToDynamoToolKitMeshData(sSystem ssys, eColorMode colorMode, out List <List <Dyn.Point> > vpts, out List <List <int> > findice, out List <List <int> > colorsR, out List <List <int> > colorsG, out List <List <int> > colorsB, double du = 0.0, sRange th = null) { List <sMesh> sms = new List <sMesh>(); sRange dataRange; ssys.ConstructBeamResultMesh(colorMode, ref sms, out dataRange, th, du); List <List <Dyn.Point> > ppp = new List <List <Dyn.Point> >(); List <List <int> > iii = new List <List <int> >(); List <List <int> > rrr = new List <List <int> >(); List <List <int> > ggg = new List <List <int> >(); List <List <int> > bbb = new List <List <int> >(); foreach (sMesh sm in sms) { List <int> ii = new List <int>(); List <int> rr = new List <int>(); List <int> gg = new List <int>(); List <int> bb = new List <int>(); List <Dyn.Point> pp = new List <Autodesk.DesignScript.Geometry.Point>(); ToDynamoToolKitMeshData(sm, ref pp, ref ii, ref rr, ref gg, ref bb); ppp.Add(pp); iii.Add(ii); rrr.Add(rr); ggg.Add(gg); bbb.Add(bb); } vpts = ppp; findice = iii; colorsR = rrr; colorsG = ggg; colorsB = bbb; }
public void ConstructBeamResultMesh(eColorMode colorMode, ref List <sMesh> meshes, out sRange dataRange, sRange threshold = null, double du = 0.0) { if (colorMode != eColorMode.NONE) { sRange resultRange = GetSystemBeamResultRange(colorMode); foreach (IFrameSet bs in this.frameSets) { foreach (sFrame b in bs.frames) { sMesh sm = b.ConstructBeamColorMesh(resultRange, colorMode, threshold, du); meshes.Add(sm); } } dataRange = resultRange; } else { foreach (IFrameSet bs in this.frameSets) { foreach (sFrame b in bs.frames) { sMesh sm = b.ConstructBeamColorMesh(new sRange(0.0, 0.0), colorMode, new sRange(0.0, 0.0), 0.0); meshes.Add(sm); } } dataRange = null; } }
public double GetForceDataByMode(eColorMode colorMode) { double data = 0.0; if (colorMode == eColorMode.Force_X) { data = this.force.X; } else if (colorMode == eColorMode.Force_Y) { data = this.force.Y; } else if (colorMode == eColorMode.Force_Z) { data = this.force.Z; } else if (colorMode == eColorMode.Moment_X) { data = this.moment.X; } else if (colorMode == eColorMode.Moment_Y) { data = this.moment.Y; } else if (colorMode == eColorMode.Moment_Z) { data = this.moment.Z; } return(data); }
public double GetFrameSetDemand(eColorMode forceType, int round = -2) { double maxDemand = 0.0; sRange dataRange = this.GetFrameSetResultRange(forceType); maxDemand = Math.Max(Math.Abs(dataRange.min), Math.Abs(dataRange.max)); //Here everything should be SI Unit!!! //if ((int)forceType > 6) //{ // if (forceType.ToString().Contains("Moment")) // { // //N.m > kip.in // maxDemand *= 0.28476439306; // } // else if (forceType.ToString().Contains("Force")) // { // // } // else if (forceType.ToString().Contains("Deflection")) // { // //mm to in // maxDemand *= 0.0393701; // } //} if (round > -1) { maxDemand = Math.Round(maxDemand, round); } return(maxDemand); }
public double GetStressDataByMode(eColorMode colorMode) { double data = 0.0; if (colorMode == eColorMode.Stress_Combined_Absolute) { data = Math.Abs(this.stress_Combined); } else if (colorMode == eColorMode.Stress_Axial_X) { data = this.stress_Axial_X; } else if (colorMode == eColorMode.Stress_Moment_Y) { data = this.stress_Moment_Y; } else if (colorMode == eColorMode.Stress_Moment_Z) { data = this.stress_Moment_Z; } else if (colorMode == eColorMode.Deflection) { data = this.deflection_mm.GetLength(); } return(data); }
public double GetFlexuralStrength_Vertical(sCrossSection section, eColorMode forceType, IFrameSet fs) { sKodeStructConverter kcon = new sKodeStructConverter(); SteelMaterial mat = kcon.ToKodeStructMaterial_Steel(section); string Code = "AISC360-10"; double phiM_n = 0; double b_eff = this.GetBeamEffectiveSlabWidth(fs); double SumQ_n = this.GetSumOfStudsStrength(fs); // assuming, // Shear Stud Anchor // Light Weight Concrete : 4ksi // solid concrete thickness = 2.5" // rib thickness = 3" // double h_solid = 2.5; double h_rib = 3.0; double F_y = mat.YieldStress; //?? unit ?? F_y of what?? double fc_prime = 4.0; //?? unit ?? MomentAxis Axis = kcon.ToKodeStructMomentAxis(forceType); //?? just this for composite? ISection shape = kcon.ToKodeStructCrossSection(section); if (shape is ISliceableShapeProvider) { ISliceableShapeProvider prov = shape as ISliceableShapeProvider; ISliceableSection sec = prov.GetSliceableShape(); CompositeBeamSection cs = new CompositeBeamSection(sec, b_eff, h_solid, h_rib, F_y, fc_prime); phiM_n = cs.GetFlexuralStrength(SumQ_n); } else { if (shape is ISliceableSection) { ISliceableSection sec = shape as ISliceableSection; CompositeBeamSection cs = new CompositeBeamSection(sec, b_eff, h_solid, h_rib, F_y, fc_prime); phiM_n = cs.GetFlexuralStrength(SumQ_n); } else { throw new Exception("Shape type not supported. Please provide a shape object of standard geometry"); } } return(phiM_n); }
internal List <Dyn.Mesh> ToDynamoMesh(sSystem ssys, eColorMode colorMode, out List <List <Color> > verticeColor, double du = 0.0, sRange th = null) { List <sMesh> sms = new List <sMesh>(); sRange dataRange; ssys.ConstructBeamResultMesh(colorMode, ref sms, out dataRange, th, du); List <List <Color> > allcols = new List <List <Color> >(); List <Dyn.Mesh> dms = new List <Autodesk.DesignScript.Geometry.Mesh>(); foreach (sMesh sm in sms) { List <Color> cols; dms.Add(ToDynamoMesh(sm, out cols)); allcols.Add(cols); } verticeColor = allcols; return(dms); }
public sRange GetSystemBeamResultRange(eColorMode colorMode) { double minV = double.MaxValue; double maxV = double.MinValue; foreach (IFrameSet bs in this.frameSets) { foreach (sFrame b in bs.frames) { sRange bRange = b.GetBeamResultRange(colorMode); if (bRange.min < minV) { minV = bRange.min; } if (bRange.max > maxV) { maxV = bRange.max; } } } return(new sRange(minV, maxV)); }
public double GetFlexuralStrength_Vertical(sCrossSection section, eColorMode forceType) { sKodeStructConverter kcon = new sKodeStructConverter(); SteelMaterial mat = kcon.ToKodeStructMaterial_Steel(section); string flexuralCompressional = "Top"; string Code = "AISC360-10"; bool IsRolledMember = true; double phiM_n = 0; MomentAxis Axis = kcon.ToKodeStructMomentAxis(forceType); FlexuralCompressionFiberPosition FlexuralCompression; bool IsValidStringCompressionLoc = Enum.TryParse(flexuralCompressional, true, out FlexuralCompression); if (IsValidStringCompressionLoc == false) { throw new Exception("Flexural compression location selection not recognized. Check input string."); } ISection shape = kcon.ToKodeStructCrossSection(section); FlexuralMemberFactory factory = new FlexuralMemberFactory(); ISteelBeamFlexure beam = factory.GetBeam(shape, mat, null, Axis, FlexuralCompression, IsRolledMember); SteelLimitStateValue Y = beam.GetFlexuralYieldingStrength(FlexuralCompression); phiM_n = Y.Value; if (Y.IsApplicable) { return(phiM_n); } else { return(-1); } }
public MomentAxis ToKodeStructMomentAxis(eColorMode dataType) { string ax = ""; if (dataType.ToString().Contains("_Y")) { ax = "XAxis"; } else if (dataType.ToString().Contains("_Z")) { ax = "YAxis"; } MomentAxis Axis; bool IsValidStringAxis = Enum.TryParse(ax, true, out Axis); if (IsValidStringAxis == false) { throw new Exception("Axis selection not recognized. Check input string."); } return(Axis); }
void SetColorMode(eColorMode cmode) { colMode = cmode; if (colMode == eColorMode.Stress_Combined_Absolute) { paramName = "colorThreshold(MPa|Ksi)"; } else if (colMode == eColorMode.Deflection) { paramName = "colorThreshold(mm|in)"; } else if (colMode == eColorMode.Force_X) { paramName = "colorThreshold(N|lbs)"; } else if (colMode == eColorMode.Force_Y) { paramName = "colorThreshold(N|lbs)"; } else if (colMode == eColorMode.Force_Z) { paramName = "colorThreshold(N|lbs)"; } else if (colMode == eColorMode.Moment_X) { paramName = "colorThreshold(N.m|lb.ft)"; } else if (colMode == eColorMode.Moment_Y) { paramName = "colorThreshold(N.m|lb.ft)"; } else if (colMode == eColorMode.Moment_Z) { paramName = "colorThreshold(N.m|lb.ft)"; } //else if (colMode == eColorMode.Stress_Axial_X) //{ // paramName = "colorThreshold(N.m|lb.ft)"; //} // else if (colMode == "Stress_Axial_Y") // { // colMode = eColorMode.Stress_Axial_Y; // } // else if (colMode == "Stress_Axial_Z") // { // colMode = eColorMode.Stress_Axial_Z; // } // else if (colMode == "Stress_Moment_X") // { // colMode = eColorMode.Stress_Moment_X; // } else if (colMode == eColorMode.Stress_Moment_Y) { paramName = "colorThreshold(MPa|Ksi)"; } else if (colMode == eColorMode.Stress_Moment_Z) { paramName = "colorThreshold(MPa|Ksi)"; } Params.Input[2].NickName = paramName; Params.Input[2].Name = paramName; this.ExpireSolution(true); }
public Interval EnsureUnit_DataRange(Interval ran, eColorMode colMode, bool MPaConvert = false) { Interval urn = new Interval(EnsureUnit(ran.Min, colMode, MPaConvert), EnsureUnit(ran.Max, colMode, MPaConvert)); //if(colMode == eColorMode.Deflection) //{ // urn = new Interval(EnsureUnit_Deflection(ran.Min), EnsureUnit_Deflection(ran.Max)); //} //else if(colMode == eColorMode.Force_X) //{ // urn = new Interval(EnsureUnit_Force(ran.Min), EnsureUnit_Force(ran.Max)); //} //else if (colMode == eColorMode.Force_Y) //{ // urn = new Interval(EnsureUnit_Force(ran.Min), EnsureUnit_Force(ran.Max)); //} //else if (colMode == eColorMode.Force_Z) //{ // urn = new Interval(EnsureUnit_Force(ran.Min), EnsureUnit_Force(ran.Max)); //} //else if (colMode == eColorMode.Moment_X) //{ // urn = new Interval(EnsureUnit_Moment(ran.Min), EnsureUnit_Moment(ran.Max)); //} //else if (colMode == eColorMode.Moment_Y) //{ // urn = new Interval(EnsureUnit_Moment(ran.Min), EnsureUnit_Moment(ran.Max)); //} //else if (colMode == eColorMode.Moment_Z) //{ // urn = new Interval(EnsureUnit_Moment(ran.Min), EnsureUnit_Moment(ran.Max)); //} // //else if (colMode == eColorMode.Stress_Axial_X) //{ // urn = new Interval(EnsureUnit_Stress(ran.Min), EnsureUnit_Stress(ran.Max)); //} //else if (colMode == eColorMode.Stress_Axial_Y) //{ // urn = new Interval(EnsureUnit_Stress(ran.Min), EnsureUnit_Stress(ran.Max)); //} //else if (colMode == eColorMode.Stress_Axial_Z) //{ // urn = new Interval(EnsureUnit_Stress(ran.Min), EnsureUnit_Stress(ran.Max)); //} //else if (colMode == eColorMode.Stress_Moment_X) //{ // urn = new Interval(EnsureUnit_Stress(ran.Min), EnsureUnit_Stress(ran.Max)); //} //else if (colMode == eColorMode.Stress_Moment_Y) //{ // urn = new Interval(EnsureUnit_Stress(ran.Min), EnsureUnit_Stress(ran.Max)); //} //else if (colMode == eColorMode.Stress_Moment_Z) //{ // urn = new Interval(EnsureUnit_Stress(ran.Min), EnsureUnit_Stress(ran.Max)); //} //else if (colMode == eColorMode.Stress_Combined_Absolute) //{ // urn = new Interval(EnsureUnit_Stress(ran.Min), EnsureUnit_Stress(ran.Max)); //} return(urn); }
public double EnsureUnit(double val, eColorMode dataType, bool MPaConvert = false) { double valEnsured = val; switch (dataType) { case eColorMode.Deflection: valEnsured = EnsureUnit_Deflection(val); break; case eColorMode.Force_X: valEnsured = EnsureUnit_Force(val); break; case eColorMode.Force_Y: valEnsured = EnsureUnit_Force(val); break; case eColorMode.Force_Z: valEnsured = EnsureUnit_Force(val); break; case eColorMode.Moment_X: valEnsured = EnsureUnit_Moment(val); break; case eColorMode.Moment_Y: valEnsured = EnsureUnit_Moment(val); break; case eColorMode.Moment_Z: valEnsured = EnsureUnit_Moment(val); break; case eColorMode.Stress_Axial_X: valEnsured = EnsureUnit_Stress(val, MPaConvert); break; case eColorMode.Stress_Axial_Y: valEnsured = EnsureUnit_Stress(val, MPaConvert); break; case eColorMode.Stress_Axial_Z: valEnsured = EnsureUnit_Stress(val, MPaConvert); break; case eColorMode.Stress_Moment_X: valEnsured = EnsureUnit_Stress(val, MPaConvert); break; case eColorMode.Stress_Moment_Y: valEnsured = EnsureUnit_Stress(val, MPaConvert); break; case eColorMode.Stress_Moment_Z: valEnsured = EnsureUnit_Stress(val, MPaConvert); break; case eColorMode.Stress_Combined_Absolute: valEnsured = EnsureUnit_Stress(val, MPaConvert); break; } return(valEnsured); }
void SetColorMode(eColorMode cmode) { colMode = cmode; this.ExpireSolution(true); }
public sRange GetFrameSetResultRange(eColorMode colMode) { /// // Deflection_Local is Z only?????????????? /// sRange ran = new sRange(); if (colMode == eColorMode.Deflection_Local) { ran.min = 0.0; ran.max = this.results_Max.deflectionLocalMax_Abs_mm.Z; } else if (colMode == eColorMode.Deflection) { ran.min = 0.0; ran.max = this.results_Max.deflectionMax_Abs_mm.GetLength(); } else if (colMode == eColorMode.Force_X) { ran.min = this.results_Max.forceMax_Negative.X; ran.max = this.results_Max.forceMax_Positive.X; } else if (colMode == eColorMode.Force_Y) { ran.min = this.results_Max.forceMax_Negative.Y; ran.max = this.results_Max.forceMax_Positive.Y; } else if (colMode == eColorMode.Force_Z) { ran.min = this.results_Max.forceMax_Negative.Z; ran.max = this.results_Max.forceMax_Positive.Z; } else if (colMode == eColorMode.Moment_X) { ran.min = this.results_Max.momentMax_Negative.X; ran.max = this.results_Max.momentMax_Positive.X; } else if (colMode == eColorMode.Moment_Y) { ran.min = this.results_Max.momentMax_Negative.Y; ran.max = this.results_Max.momentMax_Positive.Y; } else if (colMode == eColorMode.Moment_Z) { ran.min = this.results_Max.momentMax_Negative.Z; ran.max = this.results_Max.momentMax_Positive.Z; } else if (colMode == eColorMode.Stress_Combined_Absolute) { ran.min = 0.0; ran.max = this.results_Max.stressCombinedAbs; } else { throw new NotImplementedException(); } if (ran.min == double.MaxValue) { ran.min = 0.0; } if (ran.max == double.MinValue) { ran.max = 0.0; } return(ran); }
public sColor GetBeamResultColor(sRange dataRange, eColorMode colorMode, int resultIndex, int sectionIndex, int alpha, sRange threshold = null) { sColor col = new sColor(); sColorGradient cg = null; if (colorMode == eColorMode.Force_X) { double valThis = this.results[resultIndex].force.X; cg = sColorGradient.GetCyanRedGradient(dataRange, threshold); double remapped = dataRange.GetOriginBasedNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Force_Y) { double valThis = this.results[resultIndex].force.Y; cg = sColorGradient.GetCyanRedGradient(dataRange, threshold); double remapped = dataRange.GetOriginBasedNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Force_Z) { double valThis = this.results[resultIndex].force.Z; cg = sColorGradient.GetCyanRedGradient(dataRange, threshold); double remapped = dataRange.GetOriginBasedNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Moment_X) { double valThis = this.results[resultIndex].moment.X; cg = sColorGradient.GetCyanRedGradient(dataRange, threshold); double remapped = dataRange.GetOriginBasedNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Moment_Y) { double valThis = this.results[resultIndex].moment.Y; cg = sColorGradient.GetCyanRedGradient(dataRange, threshold); double remapped = dataRange.GetOriginBasedNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Moment_Z) { double valThis = this.results[resultIndex].moment.Z; cg = sColorGradient.GetCyanRedGradient(dataRange, threshold); double remapped = dataRange.GetOriginBasedNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Stress_Combined_Absolute) { double valThis = this.results[resultIndex].sectionResults[sectionIndex].stress_Combined; cg = sColorGradient.GetRainbowLikeGradient(dataRange, threshold); double remapped = dataRange.GetNormalizedAt(valThis);//dataRange.GetOriginBasedNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Stress_Axial_X) { } else if (colorMode == eColorMode.Stress_Moment_Y) { double valThis = this.results[resultIndex].sectionResults[sectionIndex].stress_Moment_Y; cg = sColorGradient.GetCyanRedGradient(dataRange, threshold); double remapped = dataRange.GetOriginBasedNormalizedAt(valThis); //double remapped = dataRange.GetNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Stress_Moment_Z) { double valThis = this.results[resultIndex].sectionResults[sectionIndex].stress_Moment_Z; cg = sColorGradient.GetCyanRedGradient(dataRange, threshold); double remapped = dataRange.GetOriginBasedNormalizedAt(valThis); //double remapped = dataRange.GetNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.Deflection) { double valThis = this.results[resultIndex].sectionResults[sectionIndex].deflection_mm.GetLength(); cg = sColorGradient.GetRainbowLikeGradient(dataRange, threshold); double remapped = dataRange.GetNormalizedAt(valThis);//dataRange.GetOriginBasedNormalizedAt(valThis); col = cg.ColorAt(remapped); } else if (colorMode == eColorMode.NONE) { col = new sColor(200, 200, 200); } return(col); }
public sRange GetBeamResultRange(eColorMode colorMode) { double minV = double.MaxValue; double maxV = double.MinValue; foreach (sFrameResult br in this.results) { if (colorMode == eColorMode.Force_X) { if (br.force.X < minV) { minV = br.force.X; } if (br.force.X > maxV) { maxV = br.force.X; } } else if (colorMode == eColorMode.Force_Y) { if (br.force.Y < minV) { minV = br.force.Y; } if (br.force.Y > maxV) { maxV = br.force.Y; } } else if (colorMode == eColorMode.Force_Z) { if (br.force.Z < minV) { minV = br.force.Z; } if (br.force.Z > maxV) { maxV = br.force.Z; } } else if (colorMode == eColorMode.Moment_X) { if (br.moment.X < minV) { minV = br.moment.X; } if (br.moment.X > maxV) { maxV = br.moment.X; } } else if (colorMode == eColorMode.Moment_Y) { if (br.moment.Y < minV) { minV = br.moment.Y; } if (br.moment.Y > maxV) { maxV = br.moment.Y; } } else if (colorMode == eColorMode.Moment_Z) { if (br.moment.Z < minV) { minV = br.moment.Z; } if (br.moment.Z > maxV) { maxV = br.moment.Z; } } else if (colorMode == eColorMode.Stress_Combined_Absolute) { foreach (sFrameSectionResult secRe in br.sectionResults) { double absStress = Math.Abs(secRe.stress_Combined); if (absStress < minV) { minV = absStress; } if (absStress > maxV) { maxV = absStress; } } } else if (colorMode == eColorMode.Stress_Axial_X) { foreach (sFrameSectionResult secRe in br.sectionResults) { if (secRe.stress_Axial_X < minV) { minV = secRe.stress_Axial_X; } if (secRe.stress_Axial_X > maxV) { maxV = secRe.stress_Axial_X; } } } else if (colorMode == eColorMode.Stress_Moment_Y) { foreach (sFrameSectionResult secRe in br.sectionResults) { if (secRe.stress_Moment_Y < minV) { minV = secRe.stress_Moment_Y; } if (secRe.stress_Moment_Y > maxV) { maxV = secRe.stress_Moment_Y; } } } else if (colorMode == eColorMode.Stress_Moment_Z) { foreach (sFrameSectionResult secRe in br.sectionResults) { if (secRe.stress_Moment_Z < minV) { minV = secRe.stress_Moment_Z; } if (secRe.stress_Moment_Z > maxV) { maxV = secRe.stress_Moment_Z; } } } else if (colorMode == eColorMode.Deflection) { foreach (sFrameSectionResult secRe in br.sectionResults) { double def = secRe.deflection_mm.GetLength(); if (secRe.stress_Moment_Z < minV) { minV = def; } if (secRe.stress_Moment_Z > maxV) { maxV = def; } } } } sRange ran = new sRange(minV, maxV); return(ran); }
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); }