Exemplo n.º 1
0
        internal void SetStartAndEndForces(Geometry.FdVector3d startForce, Geometry.FdVector3d endForce)
        {
            if (startForce.IsZero() && !endForce.IsZero())
            {
                this.Direction = endForce.Normalize();
                this.StartLoad = 0;
                this.EndLoad   = endForce.Length();
            }

            else if (!startForce.IsZero() && endForce.IsZero())
            {
                this.Direction = startForce.Normalize();
                this.StartLoad = startForce.Length();
                this.EndLoad   = 0;
            }

            else if (startForce.IsZero() && endForce.IsZero())
            {
                throw new System.ArgumentException($"Both StartForce and EndForce are zero vectors. Can't set direction of LineLoad.");
            }

            // if no zero vectors - check if vectors are parallel
            else
            {
                Geometry.FdVector3d v0 = startForce.Normalize();
                Geometry.FdVector3d v1 = endForce.Normalize();
                double q0 = startForce.Length();
                double q1 = endForce.Length();

                int par = v0.Parallel(v1);
                if (par != 0)
                {
                    this.Direction = v0;
                    this.StartLoad = q0;
                    this.EndLoad   = par * q1;
                }
                else
                {
                    throw new System.ArgumentException($"StartForce and EndForce must be parallel or antiparallel.");
                }
            }
        }
Exemplo n.º 2
0
        public static LineLoad MomentUniform(Autodesk.DesignScript.Geometry.Curve curve, Autodesk.DesignScript.Geometry.Vector force, LoadCase loadCase, [DefaultArgument("true")] bool constLoadDir, string comment = "")
        {
            // convert geometry
            Geometry.Edge       edge        = Geometry.Edge.FromDynamoLineOrArc1(curve);
            Geometry.FdVector3d _startForce = Geometry.FdVector3d.FromDynamo(force);
            Geometry.FdVector3d _endForce   = _startForce;

            // check zero vector
            if (_startForce.IsZero())
            {
                throw new System.ArgumentException($"Force is zero.");
            }

            return(new LineLoad(edge, _startForce, _endForce, loadCase, ForceLoadType.Moment, comment, constLoadDir, loadProjection: false));
        }