Exemple #1
0
        /// <summary>
        /// Sets the model global degrees of freedom.
        /// </summary>
        /// <param name="activeDOFs">Boolean indications of which degrees of freedom are active.</param>
        /// <exception cref="MPT.CSI.API.Core.Support.CSiException"></exception>
        public void SetActiveDOF(DegreesOfFreedomGlobal activeDOFs)
        {
            bool[] dofArray = activeDOFs.ToArray();

            _callCode = _sapModel.Analyze.SetActiveDOF(ref dofArray);
            if (throwCurrentApiException(_callCode))
            {
                throw new CSiException();
            }
        }
        /// <summary>
        /// This function defines a Local constraint.
        /// If the specified name is not used for a constraint, a new constraint is defined using the specified name.
        /// If the specified name is already used for another Local constraint, the definition of that constraint is modified.
        /// If the specified name is already used for some constraint that is not a Local constraint, an error is returned.
        /// TODO: Handle this.
        /// </summary>
        /// <param name="nameConstraint">The name of a constraint.</param>
        /// <param name="degreesOfFreedom">Indicates which joint degrees of freedom are included in the constraint.</param>
        /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception>
        public void SetLocal(string nameConstraint,
                             DegreesOfFreedomGlobal degreesOfFreedom)
        {
            bool[] csiDegreesOfFreedom = degreesOfFreedom.ToArray();

            _callCode = _sapModel.ConstraintDef.SetLocal(nameConstraint, ref csiDegreesOfFreedom);
            if (throwCurrentApiException(_callCode))
            {
                throw new CSiException(API_DEFAULT_ERROR_CODE);
            }
        }
Exemple #3
0
        /// <summary>
        /// This function defines a Line constraint.
        /// If the specified name is not used for a constraint, a new constraint is defined using the specified name.
        /// If the specified name is already used for another Line constraint, the definition of that constraint is modified.
        /// If the specified name is already used for some constraint that is not a Line constraint, an error is returned.
        /// TODO: Handle this.
        /// </summary>
        /// <param name="nameConstraint">The name of a constraint.</param>
        /// <param name="degreesOfFreedom">Indicates which joint degrees of freedom are included in the constraint.</param>
        /// <param name="nameCoordinateSystem">The name of the coordinate system in which the constraint is defined.</param>
        /// <exception cref="CSiException"></exception>
        public void SetLine(string nameConstraint,
                            DegreesOfFreedomGlobal degreesOfFreedom,
                            string nameCoordinateSystem)
        {
            bool[] csiDegreesOfFreedom = degreesOfFreedom.ToArray();

            _callCode = _sapModel.ConstraintDef.SetLine(nameConstraint, ref csiDegreesOfFreedom, nameCoordinateSystem);
            if (throwCurrentApiException(_callCode))
            {
                throw new CSiException();
            }
        }
        /// <summary>
        /// This function defines a Weld constraint.
        /// If the specified name is not used for a constraint, a new constraint is defined using the specified name.
        /// If the specified name is already used for another Weld constraint, the definition of that constraint is modified.
        /// If the specified name is already used for some constraint that is not a Weld constraint, an error is returned.
        /// TODO: Handle this.
        /// </summary>
        /// <param name="nameConstraint">The name of an existing constraint.</param>
        /// <param name="degreesOfFreedom">Indicates which joint degrees of freedom are included in the constraint.</param>
        /// <param name="tolerance">Joints within this distance of each other are constrained together.</param>
        /// <param name="nameCoordinateSystem">The name of the coordinate system in which the constraint is defined.</param>
        /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception>
        public void SetWeld(string nameConstraint,
                            DegreesOfFreedomGlobal degreesOfFreedom,
                            double tolerance,
                            string nameCoordinateSystem)
        {
            bool[] csiDegreesOfFreedom = degreesOfFreedom.ToArray();

            _callCode = _sapModel.ConstraintDef.SetWeld(nameConstraint, ref csiDegreesOfFreedom, tolerance, nameCoordinateSystem);
            if (throwCurrentApiException(_callCode))
            {
                throw new CSiException(API_DEFAULT_ERROR_CODE);
            }
        }
        /// <summary>
        /// This function defines a Body constraint.
        /// If the specified name is not used for a constraint, a new constraint is defined using the specified name.
        /// If the specified name is already used for another Body constraint, the definition of that constraint is modified.
        /// If the specified name is already used for some constraint that is not a Body constraint, an error is returned.
        /// </summary>
        /// <param name="nameConstraint">The name of a constraint.</param>
        /// <param name="degreesOfFreedom">Indicates which joint degrees of freedom are included in the constraint.</param>
        /// <param name="nameCoordinateSystem">The name of the coordinate system in which the constraint is defined.</param>
        /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception>
        public void SetBody(string nameConstraint,
                            DegreesOfFreedomGlobal degreesOfFreedom,
                            string nameCoordinateSystem)
        {
            // TODO: Handle this: If the specified name is already used for some constraint that is not a [xxxx] constraint, an error is returned.
            bool[] csiDegreesOfFreedom = degreesOfFreedom.ToArray();

            _callCode = _sapModel.ConstraintDef.SetBody(nameConstraint, ref csiDegreesOfFreedom, nameCoordinateSystem);
            if (throwCurrentApiException(_callCode))
            {
                throw new CSiException(API_DEFAULT_ERROR_CODE);
            }
        }