Example #1
0
 /// <summary>
 /// Set a AcadCAD variable to a new value
 /// </summary>
 /// <param name="name"></param>
 /// <param name="value"></param>
 public static void SetVariable(string name, object value)
 {
     try
     {
         Application.SetSystemVariable(name, value);
     }
     catch (Exception ex)
     {
         Active.WriteMessage(ex.Message);
         throw;
     }
 }
Example #2
0
        /// <summary>
        /// Writes the exception message(s) on the commandline.
        /// </summary>
        /// <param name="ex">Exception.</param>
        /// <param name="inner">True if messages from innerexceptions also need to be written on the commandline.</param>
        public static void WriteToCommandLine(this Exception ex, bool inner)
        {
            StartException();

            Active.WriteMessage(ex.Message);

            if (inner)
            {
                Active.WriteMessage(GetInnerExceptions(ex));
            }

            EndException();
        }
Example #3
0
 /// <summary>
 /// Retreive the value of an AutoCAD Variable
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public static string GetVariable(string name)
 {
     try
     {
         object value = Application.GetSystemVariable(name);
         if (value != null)
         {
             return(value.ToString());
         }
     }
     catch (Exception ex)
     {
         Active.WriteMessage(ex.Message);
         throw;
     }
     return(string.Empty);
 }
Example #4
0
 private static void EndException()
 {
     Active.WriteMessage(END_EXCEPTION);
 }
Example #5
0
 private static void StartException()
 {
     Active.WriteMessage(START_EXCEPTION);
 }