コード例 #1
0
        public static object To_DynamoObj_sPointLoad(sPointLoad pointLoad)
        {
            sDynamoConverter dyncon = new sDynamoConverter("Meters", "Feet");

            Dyn.Point lp = (Dyn.Point)dyncon.EnsureUnit((dyncon.ToDynamoPoint(pointLoad.location)));
            //Dyn.PolyCurve pc = (Dyn.PolyCurve) dyncon.EnsureUnit((dyncon.ToDynamoPolyCurve(pointLoad.tributaryArea.areaBoundary)));

            Dyn.Vector force = null;
            if (pointLoad.forceVector != null)
            {
                force = dyncon.ToDynamoVector(dyncon.EnsureUnit(pointLoad).forceVector);
            }
            Dyn.Vector moment = null;
            if (pointLoad.momentVector != null)
            {
                moment = dyncon.ToDynamoVector(dyncon.EnsureUnit(pointLoad).momentVector);
            }

            return(new Dictionary <string, object>
            {
                { "location", lp },
                { "loadPattern", pointLoad.loadPatternName },
                { "forceVec", force },
                { "momentVec", moment }
            });
        }
コード例 #2
0
        public static object AppendMesh(sSystem sghSystem, string meshName, List <double> verticeNineNumbers, int colorA, int colorR, int colorG, int colorB)
        {
            sDynamoConverter dycon = new sDynamoConverter("Feet", "Meters");

            List <string> meshNames = new List <string>();

            for (int i = 0; i < sghSystem.meshes.Count; ++i)
            {
                if (sghSystem.meshes[i].meshName == meshName)
                {
                    sghSystem.meshes.RemoveAt(i);
                }
            }

            sMesh sm = dycon.TosMesh(dycon.EnsureUnit(verticeNineNumbers), new sColor(colorA, colorR, colorG, colorB));

            sm.meshName = meshName;

            sghSystem.meshes.Add(sm);

            foreach (sMesh mm in sghSystem.meshes)
            {
                meshNames.Add(mm.meshName);
            }

            return(new Dictionary <string, object>
            {
                { "sSystem", sghSystem },
                { "AppendedMeshNames", meshNames }
            });
        }
コード例 #3
0
        public static object To_DynamoObj_sPointSupport(sPointSupport pointSupport)
        {
            sDynamoConverter dyncon = new sDynamoConverter("Meters", "Feet");

            Dyn.Point lp = (Dyn.Point)dyncon.EnsureUnit((dyncon.ToDynamoPoint(pointSupport.location)));

            Dyn.Vector force = null;
            if (pointSupport.reaction_force != null)
            {
                force = dyncon.EnsureUnit_Force(dyncon.ToDynamoVector(pointSupport.reaction_force));
            }
            Dyn.Vector moment = null;
            if (pointSupport.reaction_moment != null)
            {
                moment = dyncon.EnsureUnit_Force(dyncon.ToDynamoVector(pointSupport.reaction_moment));
            }

            return(new Dictionary <string, object>
            {
                { "location", lp },
                { "supportType", pointSupport.supportType.ToString() },
                { "constraints", pointSupport.constraints },
                { "reactionForce", force },
                { "reactionMoment", moment },
            });
        }
コード例 #4
0
        public static object To_DynamoObj_sBeamPreview(sFrame beam)
        {
            sDynamoConverter dyncon = new sDynamoConverter("Meters", "Feet");

            return(new Dictionary <string, object>
            {
                { "beamPreview", dyncon.EnsureUnit(dyncon.ToDynamoBeamPreview(beam)) }
            });
        }
コード例 #5
0
        public static object To_DynamoObj_sBeam(sFrame beam)
        {
            sDynamoConverter dyncon = new sDynamoConverter("Meters", "Feet");

            return(new Dictionary <string, object>
            {
                { "beamName", beam.frameName },
                { "beamID", beam.frameID },
                { "beamLine", dyncon.EnsureUnit(dyncon.ToDynamoLine(beam.axis)) },
                { "crossSection", beam.crossSection },
                { "lineLoads", beam.lineLoads }
            });
        }
コード例 #6
0
        public static object sBeamSetByCurves(string beamSetName, List <Dyn.Curve> beamSetCurves, List <sCrossSection> crossSections)
        {
            List <sFrameSet> sets = new List <sFrameSet>();
            //how to get Revit Unit?...
            sDynamoConverter dycon = new sDynamoConverter("Feet", "Meters");

            for (int i = 0; i < beamSetCurves.Count; ++i)
            {
                double len = beamSetCurves[i].Length;
                if (len > 0.005)
                {
                    Dyn.Curve dc     = dycon.EnsureUnit(beamSetCurves[i]) as Dyn.Curve;
                    sCurve    setCrv = dycon.TosCurve(Dyn.PolyCurve.ByJoinedCurves(new Dyn.Curve[] { dc }));
                    sFrameSet bset   = new sFrameSet(setCrv);
                    bset.frameSetName = beamSetName;
                    bset.setId        = i;

                    if (crossSections.Count == 1)
                    {
                        bset.crossSection = crossSections[0] as sCrossSection;
                    }
                    else if (crossSections.Count == beamSetCurves.Count)
                    {
                        bset.crossSection = crossSections[i] as sCrossSection;
                    }

                    sets.Add(bset);
                    dc.Dispose();
                }
            }

            //for(int i = 0; i < beamSetCurves.Count; ++i)
            //{
            //    beamSetCurves[i].Dispose();
            //}

            return(new Dictionary <string, object>
            {
                { "sBeamSets", sets }
            });
        }
コード例 #7
0
        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 }
            });
        }