Exemplo n.º 1
0
        private async Task<bool> InsertBlock(string name)
        {
            using (var tsv = new TemporarySystemVariables() { })
            {
                tsv.TEXTEVAL = true;

                try
                {
                    Ed.InitCommandVersion(2);
                    Application.PreTranslateMessage += Application_PreTranslateMessage;
                    await Ed.CommandAsync("_.-INSERT", name, Editor.PauseToken);
                    Application.PreTranslateMessage -= Application_PreTranslateMessage;
                    await Ed.CommandAsync(1);
                    while (Ed.IsDragging ||Settings.Variables.CMDNAMES.ToUpper().IndexOf("INSERT", StringComparison.Ordinal) >= 0)
                    {
                        await Ed.CommandAsync(Editor.PauseToken);
                    }
                }
                catch (Autodesk.AutoCAD.Runtime.Exception ex)
                {
                    if (ex.ErrorStatus != ErrorStatus.UserBreak)
                    {
                        throw;
                    }
                    Application.PreTranslateMessage -= Application_PreTranslateMessage;
                    return false;
                }
            }
            return true;
        }
Exemplo n.º 2
0
 private void InsertBlockX(string name)
 {
   using (var tsv = new TemporarySystemVariables() { })
     {
         Ed.InitCommandVersion(2);
         Ed.Command("_.-INSERT", name, Editor.PauseToken, 1);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TransactedSysytemVariables"/> class.
 /// </summary>
 /// <param name="trx">The TRX.</param>
 public TransactedSysytemVariables(Transaction trx) : base(trx.UnmanagedObject, trx.AutoDelete)
 {
     Interop.DetachUnmanagedObject(trx);
     GC.SuppressFinalize(trx);
     TransactedVariables = new TemporarySystemVariables();
 }