Click or drag to resize

CADSharpToolsPDMExceptionMessageEnum Property

Gets the CADSharpTools exception enumerator.

Namespace:  CADSharpTools.Exceptions
Assembly:  CADSharpTools.PDM (in CADSharpTools.PDM.dll) Version: 1.4.16.0 (1.4.16)
Syntax
public CADSharpToolsPDMExceptionMessages_e MessageEnum { get; }

Property Value

Type: CADSharpToolsPDMExceptionMessages_e
Examples
This console example shows how to handle a CADSharpToolsPDMException exception. The exception is thrown by SetDataCardVariable(IEdmFile5, String, String, Object) because the specified file is checked in.
using EPDM.Interop.epdm;
using System;
using CADSharpTools.PDM;
namespace Test
{
    class Program
    {
        public enum EdmLoginFlags
        {
            Nothing,
            WebClient
        }
        [STAThread]
        static void Main(string[] args)
        {
            try
            { 
            //create vault object 
            var swPDMVault = new EdmVault5();
            var swPDMVaultEx = swPDMVault as IEdmVault13;
            //required per PDM EULA in out-of-process applications
            swPDMVaultEx.LoginEx("Admin", "****", "CADSharp", (int)EdmLoginFlags.Nothing);
             IEdmFolder5 folder = default(IEdmFolder5);
             var file = swPDMVaultEx.GetFileFromPath(@"C:\CADSharp\Vault\CADSharp\Part1.sldprt", out folder);
            // attempt to set a variable
            file.SetDataCardVariable("PartNumber", "@", "15");
            }
            catch (CADSharpTools.Commons.CADSharpToolsPDMException ex)
            {
                Console.WriteLine("CADSharpTools exception caught: {0} [enum: {1} value: {2}]",ex.Message, ex.MessageEnum.ToString(),(int)ex.MessageEnum);
            }
            catch (Exception e)
            {
                Console.WriteLine("General exception caught: " + e.Message);
            }
            finally
            {
                Console.ReadKey();
            }
            /* result:
             * CADSharpTools exception caught: File must be checked out. [enum: FileMustBeCheckedOut value: 1]
             */
        }
    }
}
See Also