Beispiel #1
0
        /***************************************************/

        private static Dataset SetGraphDataSet(Graph graph, IView view)
        {
            if (view is DependencyChart)
            {
                DependencyChart chart            = view as DependencyChart;
                string          groupPropertName = chart.Boxes.Group;
                foreach (IBHoMObject entity in graph.Entities())
                {
                    if (chart.Boxes.GroupsToIgnore.Contains(entity.PropertyValue(groupPropertName)))
                    {
                        graph.RemoveEntity(entity);
                    }
                }
            }

            BHoMGroup <IBHoMObject> entities = new BHoMGroup <IBHoMObject>();

            entities.Elements = graph.Entities();
            entities.Name     = "Entities";

            BHoMGroup <IBHoMObject> relations = new BHoMGroup <IBHoMObject>();

            relations.Elements = graph.Relations.Cast <IBHoMObject>().ToList();
            relations.Name     = "Relations";

            Dataset graphData = new Dataset();

            graphData.Data = new List <IBHoMObject>();
            graphData.Data.Add(entities);
            graphData.Data.Add(relations);

            return(graphData);
        }
Beispiel #2
0
        public static List <BarVaryingDistributedLoad> BarVaryingDistributedLoadDistanceBothEnds(Loadcase loadcase, BHoMGroup <Bar> group, bool relativePositions, double startToStartDistance = 0, Vector forceAtStart = null, Vector momentAtStart = null, double endToEndDistance = 0, Vector forceAtEnd = null, Vector momentAtEnd = null, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "", double groupingTolerance = Tolerance.Distance)
        {
            if ((forceAtStart == null || forceAtEnd == null) && (momentAtStart == null || momentAtEnd == null))
            {
                Reflection.Compute.RecordError("BarVaryingDistributedLoad requires at least the force at start and end or the moment at start and end to be defined.");
                return(null);
            }

            Dictionary <double, List <Bar> > barGroups = GroupBarsByLength(group.Elements, groupingTolerance);

            List <BarVaryingDistributedLoad> loads = new List <BarVaryingDistributedLoad>();

            foreach (KeyValuePair <double, List <Bar> > kvp in barGroups)
            {
                BHoMGroup <Bar> newGroup = new BHoMGroup <Bar> {
                    Elements = kvp.Value, Name = group.Name
                };

                double endPosition;
                if (relativePositions)
                {
                    endPosition = 1 - endToEndDistance;
                }
                else
                {
                    endPosition = kvp.Key - endToEndDistance;
                }
                loads.Add(BarVaryingDistributedLoad(loadcase, newGroup, startToStartDistance, forceAtStart, momentAtStart, endPosition, forceAtEnd, momentAtEnd, relativePositions, axis, projected, name));
            }

            return(loads.Where(x => x != null).ToList());
        }
        public static BarDifferentialTemperatureLoad BarDifferentialTemperatureLoad(Loadcase loadcase, List <double> positions, List <double> temperatures, DifferentialTemperatureLoadDirection localLoadDirection, IEnumerable <Bar> objects, string name = "")
        {
            if (loadcase.IsNull() || positions.IsNullOrEmpty() || temperatures.IsNullOrEmpty())
            {
                return(null);
            }

            //Checks for positions and profiles
            if (positions.Count != temperatures.Count)
            {
                Reflection.Compute.RecordError("Number of positions and temperatures provided are not equal");
                return(null);
            }
            else if (positions.Exists((double d) => { return(d > 1); }) || positions.Exists((double d) => { return(d < 0); }))
            {
                Reflection.Compute.RecordError("Positions must exist between 0 and 1 (inclusive)");
                return(null);
            }

            // Check that top and bottom positions are included
            if (!(positions.Contains(0) && positions.Contains(1)))
            {
                Reflection.Compute.RecordError("Positions must inlude the bottom (0) and top (1) position.");
                return(null);
            }

            if (positions.Zip(positions.Skip(1), (a, b) => new { a, b }).Any(p => p.a > p.b))
            {
                Reflection.Compute.RecordError("Positions must be sorted in ascending order.");
                return(null);
            }

            //Create ditionary for TaperedProfile
            Dictionary <Double, Double> temperatureProfile = positions.Zip(temperatures, (z, t) => new { z, t })
                                                             .ToDictionary(x => x.z, x => x.t);

            BHoMGroup <Bar> group = new BHoMGroup <Bar>();

            if (objects == null)
            {
                group = null;
            }
            else
            {
                group.Elements = objects.ToList();
            }

            return(new BarDifferentialTemperatureLoad
            {
                Loadcase = loadcase,
                TemperatureProfile = temperatureProfile,
                LoadDirection = localLoadDirection,
                Objects = group,
                Name = name
            });
        }
Beispiel #4
0
        /***************************************************/

        public static GravityLoad GravityLoad(Loadcase loadcase, Vector direction, BHoMGroup <BHoMObject> group, string name = "")
        {
            return(new GravityLoad
            {
                Loadcase = loadcase,
                GravityDirection = direction,
                Objects = group,
                Name = name
            });
        }
Beispiel #5
0
        /***************************************************/

        private List <ILoad> ReadAreaLoad(List <Loadcase> loadcases)
        {
            List <ILoad> bhLoads = new List <ILoad>();

            Dictionary <string, Panel> bhomPanels = ReadPanel().ToDictionary(x => GetAdapterId <string>(x));

            string[] names     = null;
            string[] loadcase  = null;
            string[] CSys      = null;
            int[]    dir       = null;
            int      nameCount = 0;

            double[] f = null;

            if (m_model.AreaObj.GetLoadUniform("All", ref nameCount, ref names, ref loadcase, ref CSys, ref dir, ref f, eItemType.Group) != 0)
            {
                return(bhLoads);
            }

            for (int i = 0; i < nameCount; i++)
            {
                Loadcase bhLoadcase = loadcases.FirstOrDefault(x => x.Name == loadcase[i]);

                if (bhLoadcase == null)
                {
                    continue;
                }

                BHoMGroup <IAreaElement> panelObjects = new BHoMGroup <IAreaElement>()
                {
                    Elements = { bhomPanels[names[i]] }
                };

                Vector pressure = Direction(dir[i], f[i]);
                if (CSys[i] == "Local")
                {
                    double temp = -pressure.Y;
                    pressure.Y = pressure.Z;
                    pressure.Z = temp;
                }

                AreaUniformlyDistributedLoad bhAreaUniLoad = new AreaUniformlyDistributedLoad()
                {
                    Pressure = pressure,
                    Loadcase = bhLoadcase,
                    Objects  = panelObjects
                };

                SetDirection(bhAreaUniLoad, dir[i], CSys[i]);

                bhLoads.Add(bhAreaUniLoad);
            }

            return(bhLoads);
        }
Beispiel #6
0
        private List <ILoad> ReadAreaLoad(List <Loadcase> loadcases)
        {
            int          uID            = 1;
            int          err            = 0;
            List <ILoad> bhLoads        = new List <ILoad>();
            List <Panel> bhPanels       = ReadPanel();
            Vector       localPressure  = new Vector();
            Vector       globalPressure = new Vector();

            foreach (Loadcase ldcs in loadcases)
            {
                int ldcsId = GetAdapterId <int>(ldcs);
                foreach (Panel panel in bhPanels)
                {
                    BHoMGroup <IAreaElement> panelObjects = new BHoMGroup <IAreaElement>()
                    {
                        Elements = { panel }
                    };
                    int panelId = GetAdapterId <int>(panel);

                    // local pressures
                    double[] normalPressures = new double[2];
                    err = St7.St7GetPlateNormalPressure2(uID, panelId, ldcsId, normalPressures);
                    double[] shearPressures = new double[2];
                    err           = St7.St7GetPlateShear2(uID, panelId, ldcsId, shearPressures);
                    localPressure = Vector.ZAxis * (normalPressures[0] - normalPressures[1]) + Vector.XAxis * shearPressures[0] + Vector.YAxis * shearPressures[1];
                    if (localPressure.Length() > 0)
                    {
                        bhLoads.Add(new AreaUniformlyDistributedLoad()
                        {
                            Loadcase = ldcs, Pressure = localPressure, Objects = panelObjects, Axis = LoadAxis.Local, Projected = false
                        });
                    }

                    // global pressures
                    double[] globalPressuresZplus  = new double[3];
                    double[] globalPressuresZminus = new double[3];
                    int      projectionFlag        = 0;
                    err            = St7.St7GetPlateGlobalPressure3S(uID, panelId, St7.psPlateZPlus, ldcsId, ref projectionFlag, globalPressuresZplus);
                    err            = St7.St7GetPlateGlobalPressure3S(uID, panelId, St7.psPlateZMinus, ldcsId, ref projectionFlag, globalPressuresZminus);
                    globalPressure = BH.Engine.Geometry.Create.Vector(globalPressuresZplus[0] + globalPressuresZminus[0], globalPressuresZplus[1] + globalPressuresZminus[1], globalPressuresZplus[2] + globalPressuresZminus[2]);
                    bool projected = projectionFlag != St7.ppNone;
                    if (globalPressure.Length() > 0)
                    {
                        bhLoads.Add(new AreaUniformlyDistributedLoad()
                        {
                            Loadcase = ldcs, Pressure = globalPressure, Objects = panelObjects, Axis = LoadAxis.Global, Projected = projected
                        });
                    }
                }
            }
            return(bhLoads);
        }
Beispiel #7
0
        /***************************************************/

        private static void SetScales(this Boxes component, Dataset dataset, ViewConfig viewConfig)
        {
            BHoMGroup <IBHoMObject> entityGroup = (BHoMGroup <IBHoMObject>)dataset.Data.Find(x => x.Name == "Entities");
            List <IBHoMObject>      entities    = entityGroup.Elements;

            //set scales
            List <object> viewX = new List <object>()
            {
                0, viewConfig.Width
            };
            List <object> viewY = new List <object>()
            {
                0, viewConfig.Height
            };
            object allGroupNames = entities.PropertyValue(component.Group);
            var    groups        = Convert.ToDataList(allGroupNames).GroupBy(n => n);

            if (groups.Count() == 0)
            {
                Reflection.Compute.RecordError("No groups could be defined with the supplied property name: " + component.Group + ".");
                return;
            }

            int           maxGroup    = groups.Max(g => g.Count());
            List <object> colourNames = Graphics.Convert.ToDataList(entities.PropertyValue(component.Colour));

            if (component.IsHorizontal)
            {
                //group for x scale
                m_Xscale = Create.IScale(new List <object>()
                {
                    0, maxGroup
                }, viewX);
                m_Yscale = Create.IScale(groups.Select(g => g.Key).ToList(), viewY);
            }
            else
            {
                //group for y scale
                m_Xscale = Create.IScale(groups.Select(g => g.Key).ToList(), viewX);
                m_Yscale = Create.IScale(new List <object>()
                {
                    0, maxGroup
                }, viewY);
            }

            Gradient gradient = Create.Gradient();

            m_Colourscale = Create.IScale(colourNames, gradient.Markers.Values.Cast <object>().ToList());
        }
Beispiel #8
0
        public static BarPointLoad BarPointLoad(Loadcase loadcase, double distFromA, IEnumerable <Bar> objects, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            BHoMGroup <Bar> group = new BHoMGroup <Bar>();

            if (objects == null)
            {
                group = null;
            }
            else
            {
                group.Elements = objects.ToList();
            }

            return(BarPointLoad(loadcase, group, distFromA, force, moment, axis, name));
        }
Beispiel #9
0
        public static BarUniformlyDistributedLoad BarUniformlyDistributedLoad(Loadcase loadcase, IEnumerable <Bar> objects, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            BHoMGroup <Bar> group = new BHoMGroup <Bar>();

            if (objects == null)
            {
                group = null;
            }
            else
            {
                group.Elements = objects.ToList();
            }

            return(BarUniformlyDistributedLoad(loadcase, group, force, moment, axis, projected, name));
        }
Beispiel #10
0
        public static List <BarVaryingDistributedLoad> BarVaryingDistributedLoadDistanceBothEnds(Loadcase loadcase, IEnumerable <Bar> objects, bool relativePositions, double startToStartDistance = 0, Vector forceAtStart = null, Vector momentAtStart = null, double endToEndDistance = 0, Vector forceAtEnd = null, Vector momentAtEnd = null, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "", double groupingTolerance = Tolerance.Distance)
        {
            BHoMGroup <Bar> group = new BHoMGroup <Bar>();

            if (objects == null)
            {
                group = null;
            }
            else
            {
                group.Elements = objects.ToList();
            }

            return(BarVaryingDistributedLoadDistanceBothEnds(loadcase, group, relativePositions, startToStartDistance, forceAtStart, forceAtEnd, endToEndDistance, forceAtEnd, momentAtEnd, axis, projected, name, groupingTolerance));
        }
Beispiel #11
0
        public static PointLoad PointLoad(Loadcase loadcase, IEnumerable <Node> objects, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            BHoMGroup <Node> group = new BHoMGroup <Node>();

            if (objects == null)
            {
                group = null;
            }
            else
            {
                group.Elements = objects.ToList();
            }

            return(PointLoad(loadcase, group, force, moment, axis, name));
        }
Beispiel #12
0
        public static PointVelocity PointVelocity(Loadcase loadcase, IEnumerable <Node> objects, Vector translationalVelocity = null, Vector rotationalVelocity = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            BHoMGroup <Node> group = new BHoMGroup <Node>();

            if (objects == null)
            {
                group = null;
            }
            else
            {
                group.Elements = objects.ToList();
            }

            return(PointVelocity(loadcase, group, translationalVelocity, rotationalVelocity, axis, name));
        }
        public static BarVaryingDistributedLoad BarVaryingDistributedLoad(Loadcase loadcase, IEnumerable <Bar> objects, double startPosition = 0, Vector forceAtStart = null, Vector momentAtStart = null, double endPosition = 1, Vector forceAtEnd = null, Vector momentAtEnd = null, bool relativePositions = true, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            BHoMGroup <Bar> group = new BHoMGroup <Bar>();

            if (objects == null)
            {
                group = null;
            }
            else
            {
                group.Elements = objects.ToList();
            }

            return(BarVaryingDistributedLoad(loadcase, group, startPosition, forceAtStart, momentAtStart, endPosition, forceAtEnd, momentAtEnd, relativePositions, axis, projected, name));
        }
        public static AreaDifferentialTemperatureLoad AreaDifferentialTemperatureLoad(Loadcase loadcase, List <double> positions, List <double> temperatures, IEnumerable <IAreaElement> objects, string name = "")
        {
            if (positions.IsNullOrEmpty() || temperatures.IsNullOrEmpty())
            {
                return(null);
            }

            //Checks for positions and profiles
            if (positions.Count != temperatures.Count)
            {
                Reflection.Compute.RecordError("Number of positions and temperatures provided are not equal");
                return(null);
            }
            else if (positions.Exists((double d) => { return(d > 1); }) || positions.Exists((double d) => { return(d < 0); }))
            {
                Reflection.Compute.RecordError("Positions must exist between 0 and 1 (inclusive)");
                return(null);
            }

            if (positions.Zip(positions.Skip(1), (a, b) => new { a, b }).Any(p => p.a > p.b))
            {
                Reflection.Compute.RecordError("Positions must be sorted in ascending order.");
                return(null);
            }

            //Create ditionary for TaperedProfile
            Dictionary <double, double> temperatureProfile = positions.Zip(temperatures, (z, t) => new { z, t })
                                                             .ToDictionary(x => x.z, x => x.t);

            BHoMGroup <IAreaElement> group = new BHoMGroup <IAreaElement>();

            if (objects == null)
            {
                group = null;
            }
            else
            {
                group.Elements = objects.ToList();
            }

            return(new AreaDifferentialTemperatureLoad
            {
                Loadcase = loadcase,
                TemperatureProfile = temperatureProfile,
                Objects = group,
                Name = name
            });
        }
Beispiel #15
0
        /***************************************************/

        public static PointVelocity PointVelocity(Loadcase loadcase, BHoMGroup <Node> group, Vector translation = null, Vector rotation = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            if (translation == null && rotation == null)
            {
                throw new ArgumentException("Point velocity requires either the translation or the rotation vector to be defined");
            }

            return(new PointVelocity
            {
                Loadcase = loadcase,
                Objects = group,
                TranslationalVelocity = translation == null ? new Vector() : translation,
                RotationalVelocity = rotation == null ? new Vector() : rotation,
                Axis = axis,
                Name = name
            });
        }
Beispiel #16
0
        /***************************************************/

        public static PointForce PointForce(Loadcase loadcase, BHoMGroup <Node> group, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            if (force == null && moment == null)
            {
                throw new ArgumentException("Point force requires either the force or the moment vector to be defined");
            }

            return(new PointForce
            {
                Loadcase = loadcase,
                Objects = group,
                Force = force == null ? new Vector() : force,
                Moment = moment == null ? new Vector() : moment,
                Axis = axis,
                Name = name
            });
        }
Beispiel #17
0
        /***************************************************/

        public static BarPointLoad BarPointLoad(Loadcase loadcase, BHoMGroup <Bar> group, double distFromA, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            if (force == null && moment == null)
            {
                throw new ArgumentException("Bar point load requires either the force or the moment vector to be defined");
            }

            return(new BarPointLoad {
                Loadcase = loadcase,
                DistanceFromA = distFromA,
                Force = force == null ? new Vector() : force,
                Moment = moment == null ? new Vector() : moment,
                Objects = group,
                Axis = axis,
                Name = name
            });
        }
Beispiel #18
0
        public static PointVelocity PointVelocity(Loadcase loadcase, BHoMGroup <Node> group, Vector translationalVelocity = null, Vector rotationalVelocity = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            if (translationalVelocity == null && rotationalVelocity == null)
            {
                Reflection.Compute.RecordError("PointVelocity requires at least the translation or the rotation vector to be defined");
                return(null);
            }

            return(new PointVelocity
            {
                Loadcase = loadcase,
                Objects = group,
                TranslationalVelocity = translationalVelocity == null ? new Vector() : translationalVelocity,
                RotationalVelocity = rotationalVelocity == null ? new Vector() : rotationalVelocity,
                Axis = axis,
                Name = name
            });
        }
        public static BarDistributedMass BarDistributedMass(Loadcase loadcase, BHoMGroup <Bar> group, double distFromA = 0, double massA = 0, double distFromB = 0, double massB = 0, string name = "")
        {
            if (massA == 0 && massB == 0)
            {
                throw new ArgumentException("Bar distributed mass requires either the mass at A or/and B to be defined");
            }

            return(new BarDistributedMass
            {
                Loadcase = loadcase,
                Objects = group,
                DistanceFromA = distFromA,
                DistanceFromB = distFromB,
                MassA = massA,
                MassB = massB,
                Name = name
            });
        }
Beispiel #20
0
        public static PointLoad PointLoad(Loadcase loadcase, BHoMGroup <Node> group, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            if (force == null && moment == null)
            {
                Reflection.Compute.RecordError("PointForce requires at least the force or moment vector to be defined");
                return(null);
            }

            return(new PointLoad
            {
                Loadcase = loadcase,
                Objects = group,
                Force = force == null ? new Vector() : force,
                Moment = moment == null ? new Vector() : moment,
                Axis = axis,
                Name = name
            });
        }
Beispiel #21
0
        /***************************************************/

        private List <ILoad> ReadAreaTempratureLoad(List <Loadcase> loadcases)
        {
            List <ILoad> bhLoads = new List <ILoad>();

            Dictionary <string, Panel> bhomPanels = ReadPanel().ToDictionary(x => GetAdapterId <string>(x));

            string[] names     = null;
            string[] loadcase  = null;
            int[]    myType    = null;
            double[] value     = null;
            int      nameCount = 0;

            string[] patternName = null;

            if (m_model.AreaObj.GetLoadTemperature("All", ref nameCount, ref names, ref loadcase, ref myType, ref value, ref patternName, eItemType.Group) != 0)
            {
                return(bhLoads);
            }

            for (int i = 0; i < nameCount; i++)
            {
                Loadcase bhLoadcase = loadcases.FirstOrDefault(x => x.Name == loadcase[i]);

                if (bhLoadcase == null)
                {
                    continue;
                }

                if (myType[i] == 1)
                {
                    BHoMGroup <IAreaElement> panelObjects = new BHoMGroup <IAreaElement>()
                    {
                        Elements = { bhomPanels[names[i]] }
                    };

                    bhLoads.Add(new AreaUniformTemperatureLoad()
                    {
                        Loadcase = bhLoadcase, Objects = panelObjects, TemperatureChange = value[i]
                    });
                }
            }

            return(bhLoads);
        }
Beispiel #22
0
        public static BarPointLoad BarPointLoad(Loadcase loadcase, BHoMGroup <Bar> group, double distFromA, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            if (force == null && moment == null)
            {
                Reflection.Compute.RecordError("BarPointLoad requires at least the force or the moment vector to be defined.");
                return(null);
            }

            return(new BarPointLoad
            {
                Loadcase = loadcase,
                DistanceFromA = distFromA,
                Force = force == null ? new Vector() : force,
                Moment = moment == null ? new Vector() : moment,
                Objects = group,
                Axis = axis,
                Name = name
            });
        }
Beispiel #23
0
        public static BarPrestressLoad BarPrestressLoad(Loadcase loadcase, double prestress, IEnumerable <Bar> objects, string name = "")
        {
            BHoMGroup <Bar> group = new BHoMGroup <Bar>();

            if (objects == null)
            {
                group = null;
            }
            else
            {
                group.Elements = objects.ToList();
            }

            return(new BarPrestressLoad
            {
                Loadcase = loadcase,
                Prestress = prestress,
                Objects = group,
                Name = name
            });
        }
Beispiel #24
0
        public static GravityLoad GravityLoad(Loadcase loadcase, Vector gravityDirection, IEnumerable <IBHoMObject> objects, string name = "")
        {
            BHoMGroup <BHoMObject> group = new BHoMGroup <BHoMObject>();

            if (objects == null)
            {
                group = null;
            }
            else
            {
                group.Elements = objects.Cast <BHoMObject>().ToList();
            }


            return(gravityDirection.IsNull() ? null : new GravityLoad
            {
                Loadcase = loadcase,
                GravityDirection = gravityDirection,
                Objects = group,
                Name = name
            });
        }
        public static AreaUniformlyDistributedLoad AreaUniformlyDistributedLoad(Loadcase loadcase, Vector pressure, IEnumerable <IAreaElement> objects, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            BHoMGroup <IAreaElement> group = new BHoMGroup <IAreaElement>();

            if (objects == null)
            {
                group = null;
            }
            else
            {
                group.Elements = objects.ToList();
            }

            return(new AreaUniformlyDistributedLoad
            {
                Loadcase = loadcase,
                Pressure = pressure,
                Objects = group,
                Axis = axis,
                Projected = projected,
                Name = name
            });
        }
Beispiel #26
0
        public static BarUniformTemperatureLoad BarUniformTemperatureLoad(Loadcase loadcase, double temperatureChange, IEnumerable <Bar> objects, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            BHoMGroup <Bar> group = new BHoMGroup <Bar>();

            if (objects == null)
            {
                group = null;
            }
            else
            {
                group.Elements = objects.ToList();
            }

            return(loadcase.IsNull() ? null : new BarUniformTemperatureLoad
            {
                Loadcase = loadcase,
                TemperatureChange = temperatureChange,
                Objects = group,
                Axis = axis,
                Projected = projected,
                Name = name
            });
        }
Beispiel #27
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/


        public static ILoad Load(LoadType type, Loadcase loadCase, List <double> magnitude, string groupName, LoadAxis axis, bool isProjected, string units = "kN")
        {
            units = units.ToUpper();
            units = units.Replace(" ", "");

            double sFac = 1;

            switch (units)
            {
            case "N":
            case "NEWTON":
            case "NEWTONS":
                sFac = 1;
                break;

            case "KN":
            case "KILONEWTON":
            case "KILONEWTONS":
                sFac = 1000;
                break;

            case "C":
            case "CELSIUS":
            case "K":
            case "KELVIN":
                sFac = 1;
                break;

            default:
                throw new ArgumentException("Unrecognised unit type");
            }

            Vector force  = null;
            Vector moment = null;
            double mag;

            if (magnitude.Count < 1)
            {
                throw new ArgumentException("Need at least one maginute value");
            }

            mag = magnitude[0] * sFac;

            if (magnitude.Count > 2)
            {
                force = new Vector()
                {
                    X = magnitude[0], Y = magnitude[1], Z = magnitude[2]
                }
            }
            *sFac;

            if (magnitude.Count > 5)
            {
                moment = new Vector()
                {
                    X = magnitude[3], Y = magnitude[4], Z = magnitude[5]
                }
            }
            *sFac;

            switch (type)
            {
            case LoadType.Selfweight:
            {
                BHoMGroup <BHoMObject> group = new BHoMGroup <BHoMObject>()
                {
                    Name = groupName
                };
                return(GravityLoad(loadCase, force, group, groupName));
            }

            case LoadType.PointForce:
            {
                BHoMGroup <Node> group = new BHoMGroup <Node>()
                {
                    Name = groupName
                };
                return(PointForce(loadCase, group, force, moment, axis, groupName));
            }

            case LoadType.PointDisplacement:
            {
                BHoMGroup <Node> group = new BHoMGroup <Node>()
                {
                    Name = groupName
                };
                return(PointDisplacement(loadCase, group, force, moment, axis, groupName));
            }

            case LoadType.PointVelocity:
            {
                BHoMGroup <Node> group = new BHoMGroup <Node>()
                {
                    Name = groupName
                };
                return(PointVelocity(loadCase, group, force, moment, axis, groupName));
            }

            case LoadType.PointAcceleration:
            {
                BHoMGroup <Node> group = new BHoMGroup <Node>()
                {
                    Name = groupName
                };
                return(PointAcceleration(loadCase, group, force, moment, axis, groupName));
            }

            case LoadType.BarUniformLoad:
            {
                BHoMGroup <Bar> group = new BHoMGroup <Bar>()
                {
                    Name = groupName
                };
                return(BarUniformlyDistributedLoad(loadCase, group, force, moment, axis, isProjected, groupName));
            }

            case LoadType.BarTemperature:
            {
                BHoMGroup <Bar> group = new BHoMGroup <Bar>()
                {
                    Name = groupName
                };
                return(BarTemperatureLoad(loadCase, mag, group, axis, isProjected, groupName));
            }

            case LoadType.AreaUniformLoad:
            {
                BHoMGroup <IAreaElement> group = new BHoMGroup <IAreaElement>()
                {
                    Name = groupName
                };
                return(AreaUniformalyDistributedLoad(loadCase, force, group, axis, isProjected, groupName));
            }

            case LoadType.BarVaryingLoad:
            case LoadType.BarPointLoad:
            case LoadType.AreaTemperature:
            case LoadType.Pressure:
            case LoadType.Geometrical:
            default:
                throw new NotImplementedException("Load type not implemented");
            }
        }
Beispiel #28
0
        /***************************************************/

        public static BarVaryingDistributedLoad BarVaryingDistributedLoad(Loadcase loadcase, BHoMGroup <Bar> group, double distFromA = 0, Vector forceA = null, Vector momentA = null, double distFromB = 0, Vector forceB = null, Vector momentB = null, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            if ((forceA == null || forceB == null) && (momentA == null || momentB == null))
            {
                throw new ArgumentException("Bar varying load requires either the force at A and B OR the moment at A and B to be defined");
            }

            return(new BarVaryingDistributedLoad
            {
                Loadcase = loadcase,
                Objects = group,
                DistanceFromA = distFromA,
                DistanceFromB = distFromB,
                ForceA = forceA == null ? new Vector() : forceA,
                ForceB = forceB == null ? new Vector():forceB,
                MomentA = momentA == null? new Vector() : momentA,
                MomentB = momentB == null? new Vector() : momentB,
                Projected = projected,
                Axis = axis,
                Name = name
            });
        }
Beispiel #29
0
        /***************************************************/

        public static BarUniformlyDistributedLoad BarUniformlyDistributedLoad(Loadcase loadcase, BHoMGroup <Bar> group, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            if (force == null && moment == null)
            {
                throw new ArgumentException("Bar uniform load requires either the force or the moment vector to be defined");
            }

            return(new BarUniformlyDistributedLoad
            {
                Loadcase = loadcase,
                Objects = group,
                Force = force == null? new Vector(): force,
                Moment = moment == null? new Vector():moment,
                Axis = axis,
                Name = name,
                Projected = projected
            });
        }
Beispiel #30
0
        /***************************************************/

        public static BarTemperatureLoad BarTemperatureLoad(Loadcase loadcase, double temperatureChange, BHoMGroup <Bar> group, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            return(new BarTemperatureLoad
            {
                Loadcase = loadcase,
                TemperatureChange = temperatureChange,
                Objects = group,
                Axis = axis,
                Projected = projected,
                Name = name
            });
        }