- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
I am trying to create a BOM table and save it into a Side Database as a .dwg.
When I run this code on the active drawings database it works, but when I try and use a side database it creates the new drawing, but does not insert the new table.
Am I doing something wrong here?
Here is the section of my code that creates the table based off of an array and saves it.
var tb = new Table();
var bt = acTrans.GetObject(newDb.BlockTableId, OpenMode.ForRead) as BlockTable;
tb.TableStyle = newDb.Tablestyle;
// insert rows and columns
totalRows -= 1;
tb.InsertRows(1, .2533, totalRows);
tb.InsertColumns(0, 2, 1);
tb.InsertColumns(0, 7, 1);
tb.InsertColumns(0, 2, 1);
tb.Position = new Point3d(1.5, 22, 0);
totalRows += 1;
for (int a = 1; a < totalRows; a++)
{
for (int b = 0; b < 4; b++)
{
string itemToInsert = bomArray[a, b];
tb.Cells[a, b].TextHeight = .1033;
tb.Cells[a, b].TextString = itemToInsert;
tb.Cells[a, b].Alignment = CellAlignment.MiddleCenter;
}
tb.GenerateLayout();
var btr = acTrans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
btr.AppendEntity(tb);
acTrans.AddNewlyCreatedDBObject(tb, true);
}
acTrans.Commit();
}
newDb.SaveAs(bomDwg, DwgVersion.AC1027);
¡Resuelto! Ir a solución.