/// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object can be used to retrieve data from input parameters and
        /// to store data in output parameters.</param>
        protected override void SolveInstance(IGH_DataAccess DA, EvaluationUnit unit)
        {
            //var line = new LineCurve();
            var point       = new Point3d();
            var noIndex     = 0;
            var loadCase    = 0;
            var comment     = "";
            var rfNodalLoad = new RFNodalLoad();
            var inRFEM      = new GH_RFEM();
            var mod         = false;
            var del         = false;
            var force       = new Vector3d();
            var moment      = new Vector3d();
            var nodeList    = "";
            var definition  = "";

            //int newNo = 0;


            if (DA.GetData(8, ref inRFEM))
            {
                rfNodalLoad = new RFNodalLoad((RFNodalLoad)inRFEM.Value);
            }
            else if ((DA.GetData(0, ref point)) && (DA.GetData(1, ref loadCase)))
            {
                var inPoints = new List <Point3d>();
                inPoints.Add(point);
                rfNodalLoad             = new RFNodalLoad(new NodalLoad(), inPoints, loadCase);
                rfNodalLoad.LoadDefType = LoadDefinitionType.ByComponentsType;
            }
            else
            {
                return;
            }
            if (DA.GetData(9, ref mod))
            {
                rfNodalLoad.ToModify = mod;
            }
            if (DA.GetData(10, ref del))
            {
                rfNodalLoad.ToDelete = del;
            }
            if (DA.GetData(4, ref noIndex))
            {
                rfNodalLoad.No = noIndex;
            }
            if (DA.GetData(5, ref comment))
            {
                rfNodalLoad.Comment = comment;
            }
            if (DA.GetData(2, ref force))
            {
                rfNodalLoad.Force = force;
            }
            if (DA.GetData(3, ref moment))
            {
                rfNodalLoad.Moment = moment;
            }
            // Add warning in case of null forces
            if ((rfNodalLoad.Force.Length == 0.0) && (rfNodalLoad.Moment.Length == 0))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Null forces will result in an error in RFEM");
            }
            if (DA.GetData(6, ref nodeList))
            {
                rfNodalLoad.NodeList = nodeList;
            }
            if (DA.GetData(7, ref definition))
            {
                Enum.TryParse(definition, out LoadDefinitionType myDef);
                rfNodalLoad.LoadDefType = myDef;
            }

            DA.SetData(0, rfNodalLoad);
        }
예제 #2
0
        public override void SolveInstance(IGH_DataAccess DA, out string msg, out GH_RuntimeMessageLevel level)
        {
            msg   = "";
            level = GH_RuntimeMessageLevel.Blank;
            //var line = new LineCurve();
            var point       = new Point3d();
            var noIndex     = 0;
            var loadCase    = 0;
            var comment     = "";
            var rfNodalLoad = new RFNodalLoad();
            var inRFEM      = new GH_RFEM();
            var mod         = false;
            var del         = false;
            var force       = new Vector3d();
            var moment      = new Vector3d();
            var nodeList    = "";
            var definition  = 0;

            //int newNo = 0;


            if (DA.GetData(8, ref inRFEM))
            {
                rfNodalLoad = new RFNodalLoad((RFNodalLoad)inRFEM.Value);
                if (DA.GetData(0, ref point))
                {
                    var inPoints = new List <Point3d>();
                    inPoints.Add(point);
                    rfNodalLoad = new RFNodalLoad(rfNodalLoad, inPoints, rfNodalLoad.LoadCase);
                }
                if (DA.GetData(1, ref loadCase))
                {
                    rfNodalLoad.LoadCase = loadCase;
                }
            }
            else if ((DA.GetData(0, ref point)) && (DA.GetData(1, ref loadCase)))
            {
                var inPoints = new List <Point3d>();
                inPoints.Add(point);
                rfNodalLoad             = new RFNodalLoad(new NodalLoad(), inPoints, loadCase);
                rfNodalLoad.LoadDefType = LoadDefinitionType.ByComponentsType;
            }
            else if ((DA.GetData(6, ref nodeList)) && (DA.GetData(1, ref loadCase)))
            {
                rfNodalLoad             = new RFNodalLoad();
                rfNodalLoad.LoadCase    = loadCase;
                rfNodalLoad.NodeList    = nodeList;
                rfNodalLoad.LoadDefType = LoadDefinitionType.ByComponentsType;
            }
            else
            {
                msg   = "Insufficient input parameters. Provide either base point and load case or node list and load case or existing RFNodalLoad Object. ";
                level = GH_RuntimeMessageLevel.Warning;
                return;
            }
            if (DA.GetData(9, ref mod))
            {
                rfNodalLoad.ToModify = mod;
            }
            if (DA.GetData(10, ref del))
            {
                rfNodalLoad.ToDelete = del;
            }
            if (DA.GetData(4, ref noIndex))
            {
                rfNodalLoad.No = noIndex;
            }
            if (DA.GetData(5, ref comment))
            {
                rfNodalLoad.Comment = comment;
            }
            if (DA.GetData(2, ref force))
            {
                rfNodalLoad.Force = force;
            }
            if (DA.GetData(3, ref moment))
            {
                rfNodalLoad.Moment = moment;
            }
            // Add warning in case of null forces
            if ((rfNodalLoad.Force.Length == 0.0) && (rfNodalLoad.Moment.Length == 0))
            {
                msg   = "Null forces will result in an error in RFEM. ";
                level = GH_RuntimeMessageLevel.Warning;
            }
            if (DA.GetData(6, ref nodeList))
            {
                rfNodalLoad.NodeList = nodeList;
            }
            if (DA.GetData(7, ref definition))
            {
                rfNodalLoad.LoadDefType = (LoadDefinitionType)definition;
                if (rfNodalLoad.LoadDefType == LoadDefinitionType.UnknownLoadDefinitionType)
                {
                    msg   = "Load Definition not supported. ";
                    level = GH_RuntimeMessageLevel.Warning;
                }
            }
            DA.SetData(0, rfNodalLoad);
        }