public void InsertAlimentador() { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; AlimentadorContent fullContent = AutoCADUtils.GetAlimentadorFromJSON(); AutoCADUtils.VoidTransaction((Document doc, Transaction tr) => { if (fullContent != null && fullContent.Lineas.Length > 0) { var saver = new FormatSaver(fullContent.Lineas); saver.Save(doc, tr); } }); if (fullContent != null) { List <AlimentadorContent> contentByPages = AlimentadorContent.FixContentByPages(fullContent); foreach (var content in contentByPages) { AutoCADUtils.VoidTransaction((Document doc, Transaction tr) => { var res = ed.GetPoint("Selecciona el punto de inserción de la tabla"); if (res.Status == PromptStatus.OK) { AlimTable table = new AlimTable(res.Value, content); table.Init(); table.Insert(doc, tr); } }); ed.Regen(); } } }
public void InsertVerticalLines() { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; AutoCADUtils.VoidTransaction((Document doc, Transaction tr) => { FormatSaver sav = new FormatSaver(); sav.InsertVerticalTags(doc, tr); }); ed.Regen(); }
public void TestBlockLoad() { new QuickTransactionWrapper((Document doc, Transaction tr) => { try { string blockPath = @"D:\DaSoft\Proyectos\RivModulador\Modulador\Bordeo\2D\BR2020181815T.dwg"; AutoCADUtils._LoadBlock(String.Format("test{0}", index++), blockPath, tr); } catch (System.Exception exc) { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; ed.WriteMessage(exc.Message); } }).Run(); }
public void InsertTabalimBlock() { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; String blkDirectory = Assembly.GetAssembly(typeof(Tabalim.Addin.Runtime.Commands)).Location; blkDirectory = Path.GetDirectoryName(blkDirectory); blkDirectory = Path.Combine(blkDirectory, BLOCK_DIR); View.WinBlockInsert win = new View.WinBlockInsert(); win.ShowDialog(); AutoCADUtils.VoidTransaction((Document doc, Transaction tr) => { if (win.DialogResult.Value) { String blockName = win.SelectedBlock.Index.ToString(), file = Path.Combine(blkDirectory, String.Format("{0}.dwg", blockName)); tr.LoadBlock(doc.Database, file, blockName); } ; }); PromptStatus status = PromptStatus.OK; PromptPointResult res; while (status == PromptStatus.OK) { AutoCADUtils.VoidTransaction((Document doc, Transaction tr) => { String blockName = win.SelectedBlock.Index.ToString(); BlockTable blkTab = (BlockTable)doc.Database.BlockTableId.GetObject(OpenMode.ForRead); BlockTableRecord currentSpace = (BlockTableRecord)doc.Database.CurrentSpaceId.GetObject(OpenMode.ForWrite); res = ed.GetPoint(new PromptPointOptions("Selecciona el punto de inserción del bloque.") { AllowNone = true }); status = res.Status; if (status == PromptStatus.OK) { BlockReference blkRef = new BlockReference(res.Value, blkTab[blockName]); blkRef.Rotation = 0; blkRef.ScaleFactors = new Scale3d(16); currentSpace.AppendEntity(blkRef); tr.AddNewlyCreatedDBObject(blkRef, true); } ed.Regen(); }); } }
/// <summary> /// Inicia el proceso de la carga de bloques /// </summary> public void LoadBlocks() { String blkDirectory = Assembly.GetAssembly(typeof(Tabalim.Addin.Model.TableroContent)).Location; blkDirectory = Path.GetDirectoryName(blkDirectory); blkDirectory = Path.Combine(blkDirectory, BLOCK_DIR); var blocks = this.CmpColumns.Select(x => new KeyValuePair <String, String>(x.ImageIndex.ToString(), String.Format("{0}.dwg", x.ImageIndex))); blocks = blocks.Union(new KeyValuePair <String, String>[] { new KeyValuePair <String, String>(this.ImagenTablero, String.Format("{0}.dwg", this.ImagenTablero)) }); string file; AutoCADUtils.VoidTransaction((Document doc, Transaction tr) => { foreach (var blkName in blocks) { file = Path.Combine(blkDirectory, blkName.Value); tr.LoadBlock(doc.Database, file, blkName.Key); } // tr.UpdatePath(doc, this.ImagenTablero); }); }
public void InsertTablero() { TableroContent cont = AutoCADUtils.GetTableroFromJSON(); if (cont == null) { return; } Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; var res = ed.GetPoint("Selecciona el punto de inserción de la tabla"); if (res.Status == PromptStatus.OK) { cont.LoadBlocks(); AutoCADUtils.VoidTransaction((Document doc, Transaction tr) => { TableroTable table = new TableroTable(res.Value, cont); table.Blocks = tr.GetBlockTableRecordIds(doc.Database); table.Init(); table.Insert(doc, tr); }); } }