/// <summary> /// Data constructor: Creates an Absolute Joint Movement Goo instance from another Absolute Joint Movement Goo instance. /// This creates a shallow copy of the passed Absolute Joint Movement Goo instance. /// </summary> /// <param name="absoluteJointMovementGoo"> Absolute Joint Movement Goo instance to copy. </param> public GH_AbsoluteJointMovement(GH_AbsoluteJointMovement absoluteJointMovementGoo) { if (absoluteJointMovementGoo == null) { absoluteJointMovementGoo = new GH_AbsoluteJointMovement(); } this.Value = absoluteJointMovementGoo.Value; }
/// <summary> /// Attempt a cast from generic object. /// </summary> /// <param name="source"> Reference to source of cast. </param> /// <returns> True on success, false on failure. </returns> public override bool CastFrom(object source) { if (source == null) { return(false); } //Cast from Aboslute Joint Movement if (typeof(AbsoluteJointMovement).IsAssignableFrom(source.GetType())) { Value = source as AbsoluteJointMovement; return(true); } //Cast from Aboslute Joint Movement Goo if (typeof(GH_AbsoluteJointMovement).IsAssignableFrom(source.GetType())) { GH_AbsoluteJointMovement absoluteJointMovementGoo = source as GH_AbsoluteJointMovement; Value = absoluteJointMovementGoo.Value; return(true); } //Cast from Action if (typeof(RobotComponents.Actions.Action).IsAssignableFrom(source.GetType())) { if (source is AbsoluteJointMovement action) { Value = action; return(true); } } //Cast from Action Goo if (typeof(GH_Action).IsAssignableFrom(source.GetType())) { GH_Action actionGoo = source as GH_Action; if (actionGoo.Value is AbsoluteJointMovement action) { Value = action; return(true); } } return(false); }