//This method creates node loads
        private static NodalLoad[] NodalLoads(List <Karamba.Loads.PointLoad> kPLoads)
        {
            Dictionary <Tuple <Vector3d, Vector3d, int>, NodalLoad> rNodalLoads = new Dictionary <Tuple <Vector3d, Vector3d, int>, NodalLoad>();

            foreach (Karamba.Loads.PointLoad kPLoad in kPLoads)
            {
                if (!rNodalLoads.ContainsKey(new Tuple <Vector3d, Vector3d, int>(kPLoad.force, kPLoad.moment, kPLoad.loadcase)))
                {
                    NodalLoad rNodalLoad = new NodalLoad();
                    rNodalLoad.NodeList = kPLoad.node_ind.ToString();
                    NodalLoadComponent component = new NodalLoadComponent();
                    fillComponent(ref component, kPLoad);
                    rNodalLoad.Component = component;
                    rNodalLoad.NodeList  = (kPLoad.node_ind + 1).ToString();
                    rNodalLoad.No        = rNodalLoads.Count + 1;
                    if (kPLoad.loadcase == 0)
                    {
                        rNodalLoad.Comment = "999";
                    }
                    else
                    {
                        rNodalLoad.Comment = kPLoad.loadcase.ToString();
                    }
                    rNodalLoads[new Tuple <Vector3d, Vector3d, int>(kPLoad.force, kPLoad.moment, kPLoad.loadcase)] = rNodalLoad;
                }
                else
                {
                    NodalLoad temp = rNodalLoads[new Tuple <Vector3d, Vector3d, int>(kPLoad.force, kPLoad.moment, kPLoad.loadcase)];
                    temp.NodeList += "," + (kPLoad.node_ind + 1).ToString();
                    rNodalLoads[new Tuple <Vector3d, Vector3d, int>(kPLoad.force, kPLoad.moment, kPLoad.loadcase)] = temp;
                }
            }
            return(rNodalLoads.Values.ToArray());
        }
Beispiel #2
0
 public RFNodalLoad(NodalLoad load, List <Point3d> location, int loadcase)
 {
     NodeList    = load.NodeList;
     Comment     = load.Comment;
     ID          = load.ID;
     IsValid     = load.IsValid;
     No          = load.No;
     Tag         = load.Tag;
     LoadDefType = load.Definition;
     if (LoadDefType == LoadDefinitionType.ByComponentsType)
     {
         Force  = new Vector3d(load.Component.Force.X, load.Component.Force.Y, load.Component.Force.Z) * 0.001;
         Moment = new Vector3d(load.Component.Moment.X, load.Component.Moment.Y, load.Component.Moment.Z) * 0.001;
     }
     else if ((LoadDefType == LoadDefinitionType.ByDirectionType) && (load.Direction.Type == NodalLoadDirectionType.RotatedDirectionType))
     {
         var basisVec = SetOrientation(load.Direction.RotationSequence, load.Direction.RotationAngles);
         Force  = new Vector3d(basisVec * load.Direction.Force) * 0.001;
         Moment = new Vector3d(basisVec * load.Direction.Moment) * 0.001;
     }
     LoadCase = loadcase;
     Location = location;
     ToModify = false;
     ToDelete = false;
     //}
     //public RFSupportP(NodalSupport support, Point3d[] location) : this(support, location, new Plane(Plane.WorldXY))
     //{
 }
        //Sets all the nodal loads to RFEM
        private static void setRFEMnodalLoads(ILoads rLoads, NodalLoad[] rNodalLoads)
        {
            Dictionary <int, List <NodalLoad> > loads = new Dictionary <int, List <NodalLoad> >();

            foreach (NodalLoad rNodalLoad in rNodalLoads)
            {
                if (!loads.ContainsKey(int.Parse(rNodalLoad.Comment)))
                {
                    List <NodalLoad> nLoad = new List <NodalLoad>();
                    NodalLoad        a     = rNodalLoad;
                    a.Comment = "";
                    nLoad.Add(a);

                    loads[int.Parse(rNodalLoad.Comment)] = nLoad;
                }
                else
                {
                    NodalLoad a = rNodalLoad;
                    a.Comment = "";
                    loads[int.Parse(rNodalLoad.Comment)].Add(a);
                }
            }
            foreach (int n in loads.Keys)
            {
                ILoadCase lCase = rLoads.GetLoadCase(n, ItemAt.AtNo);
                lCase.PrepareModification();

                lCase.SetNodalLoads(loads[n].ToArray());
                lCase.FinishModification();
            }
        }