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); }
private async void InoutblKxAsync(string name) { try { InsertBlockX(name); var psr = Ed.SelectLast(); if (psr.Status != PromptStatus.OK) { return; } await Ed.CommandAsync("_.EXPLODE", psr.Value); } catch (Autodesk.AutoCAD.Runtime.Exception ex) { if (ex.ErrorStatus != ErrorStatus.UserBreak) { throw; } } }