public static object SnowDrift_ByEdgeHeight(Dyn.Curve edgeCurve, bool flipDirectioin, double snowLoad_ground_psf, double snowLoad_flatRoof_psf, double roofLength_lower_ft, double roofLength_upper_ft, double roofHeight_delta_ft, double adjustmentFactor_ft = 10.0) { sDynamoUtilities dynutil = new sDynamoUtilities(); double designLen; double designHeight; double designMaxLoad; double designSnowDensity; dynutil.GetSnowDriftInformation(snowLoad_ground_psf, snowLoad_flatRoof_psf, roofHeight_delta_ft, roofLength_lower_ft, roofLength_upper_ft, out designLen, out designHeight, out designMaxLoad, out designSnowDensity); double fac = designLen; if (flipDirectioin) { fac *= -1; } Dyn.PolyCurve edgeCrvEx = Dyn.PolyCurve.ByJoinedCurves(new Dyn.Curve[1] { edgeCurve.ExtendStart(adjustmentFactor_ft).ExtendEnd(adjustmentFactor_ft) }); Dyn.PolyCurve driftCrv_onRoof = Dyn.PolyCurve.ByJoinedCurves(new Dyn.Curve[1] { edgeCrvEx.Offset(fac) }); Dyn.PolyCurve driftCrv_onEdge = Dyn.PolyCurve.ByJoinedCurves(new Dyn.Curve[1] { edgeCrvEx.Translate(Dyn.Vector.ZAxis().Scale(designHeight)) as Dyn.Curve }); List <Dyn.Solid> snows = new List <Dyn.Solid>(); for (int i = 0; i < driftCrv_onRoof.NumberOfCurves; ++i) { List <Dyn.PolyCurve> cs = new List <Dyn.PolyCurve>(); cs.Add(Dyn.PolyCurve.ByPoints(new Dyn.Point[3] { driftCrv_onRoof.CurveAtIndex(i).StartPoint, driftCrv_onEdge.CurveAtIndex(i).StartPoint, edgeCrvEx.CurveAtIndex(i).StartPoint }, true)); cs.Add(Dyn.PolyCurve.ByPoints(new Dyn.Point[3] { driftCrv_onRoof.CurveAtIndex(i).EndPoint, driftCrv_onEdge.CurveAtIndex(i).EndPoint, edgeCrvEx.CurveAtIndex(i).EndPoint }, true)); snows.Add(Dyn.Solid.ByLoft(cs)); } Dyn.Solid snowSolid = Dyn.Solid.ByUnion(snows); // edgeCrvEx.Dispose(); // driftCrv_onEdge.Dispose(); // driftCrv_onRoof.Dispose(); return(new Dictionary <string, object> { { "DesignLength_ft", designLen }, { "DesignHeight_ft", designHeight }, { "DesignMaxLoad_psf", designMaxLoad }, { "DesignDensity_pcf", designSnowDensity }, { "DrfitVolumeSolid", snowSolid }, }); }
internal sPolyLine TosPolyLine(Dyn.PolyCurve dpc) { List <sXYZ> vertice = new List <sXYZ>(); for (int i = 0; i < dpc.NumberOfCurves; ++i) { vertice.Add(TosXYZ(dpc.CurveAtIndex(i).StartPoint)); if (i == dpc.NumberOfCurves - 1) { vertice.Add(TosXYZ(dpc.CurveAtIndex(0).EndPoint)); } } sPolyLine spl = new sPolyLine(vertice, dpc.IsClosed); return(spl); }