Exemplo n.º 1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            StructureType s         = new StructureType();
            List <Curve>  dirCurves = new List <Curve>();

            if (!DA.GetData(0, ref s))
            {
                return;
            }
            if (!DA.GetDataList(1, dirCurves))
            {
                return;
            }

            s.AlignMaterialAxisWithCurves(dirCurves.ToArray());
            s.RegenerateDMatrices();

            DA.SetData(0, s);
        }
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            StructureType s      = new StructureType();
            List <double> angles = new List <double>();

            if (!DA.GetData(0, ref s))
            {
                return;
            }
            if (!DA.GetDataList(1, angles))
            {
                return;
            }

            if (s.NumberOfElements != angles.Count && angles.Count != 1)
            {
                throw new Exception("Number of angles does not match number of elements");
            }

            s.K = null; // Sparse matrix is not serializable
            s.M = null;
            s   = s.DeepClone();

            if (angles.Count > 1)
            {
                s.SetMaterialOrientationAngles(angles);
            }
            else
            {
                s.SetMaterialOrientationAngles(angles[0]);
            }

            s.RegenerateDMatrices();

            DA.SetData(0, s);
        }