Esempio n. 1
0
        /// <summary>
        /// Adds a new diaphragm.
        /// Returns the new obect if diaphragm is successfully added.
        /// Returns null if the diaphragm already exists or fails to be added.
        /// </summary>
        /// <param name="app">The application.</param>
        /// <param name="name">The name of an existing diaphragm.</param>
        /// <param name="semiRigid">True: Diaphragm is semi-rigid.</param>
        /// <returns>Diaphragm.</returns>
        internal static Diaphragm AddDiaphragm(ApiCSiApplication app,
                                               string name,
                                               bool semiRigid)
        {
            ApiDiaphragm  apiDiaphragm  = getApiDiaphragm(app);
            List <string> existingItems = GetNameList(apiDiaphragm);

            if (existingItems.Contains(name))
            {
                return(null);
            }

            apiDiaphragm.SetDiaphragm(name, semiRigid);

            return(Factory(app, name));
        }
Esempio n. 2
0
 /// <summary>
 /// Returns the names of all objects.
 /// </summary>
 /// <param name="diaphragms">The diaphragms.</param>
 /// <returns>List&lt;System.String&gt;.</returns>
 /// <exception cref="T:MPT.CSI.API.Core.Support.CSiException">API_DEFAULT_ERROR_CODE</exception>
 internal static List <string> GetNameList(ApiDiaphragm diaphragms)
 {
     return((diaphragms == null) ? new List <string>() : new List <string>(diaphragms.GetNameList()));
 }