Open ytukids opened 6 years ago
Yes, you can interact with the table entities in netDXF. The entity name is ACAD_TABLE
.
From the version 2.0 changelog:
Table entities are imported as inserts. AutoCad uses anonymous blocks, with name "*T#", to represent tables made of rows and columns.
Here is an example of how to interact with them (Copied from the example file TestDxfDocument
in this repository):
// netDxf does not support tables made of rows and columns
// they will be imported as an Insert entity
// AutoCad uses anonymous blocks, with name "*T#", to represent tables
DxfDocument doc = DxfDocument.Load(@"sample.dxf");
// these are the block definitions imported from table entities
List<Block> tableBlocks = new List<Block>();
foreach (Block block in doc.Blocks)
{
if(block.Name.StartsWith("*T"))
tableBlocks.Add(block);
}
// these are the tables imported as Insert entities
List<Insert> tables = new List<Insert>();
foreach (Block block in tableBlocks)
{
// this is the list of users of the block,
// this list should only contain one entity, the Insert that represents the table
List<DxfObject> refs = doc.Blocks.GetReferences(block.Name);
Debug.Assert(refs.Count == 1);
tables.Add((Insert) refs[0]);
}
// Renaming and cloning anonymous blocks
DxfDocument test = new DxfDocument();
test.AddEntity((EntityObject) tables[0].Clone());
Block blk = (Block) tableBlocks[0].Clone("table");
test.AddEntity(new Insert(blk));
test.Save("test.dxf");
As we can see above it is very easy to get the contents of the table.
The Table entity is not implemented because it is not, sorry that it sounds like a nonsensical tautology. If you look the Table entity documentation there are 6 pages and a half of codes. Reorganizing and giving some sense to them takes a lot of time. Something I will not do is just create a container with all the codes, and let you figure out what is the purpose and incompatibilities of each one. And the case of the MLeader entity (multi leader) is even worse. In the projects front page you can see the full list of available entities.
At least as @sorifiend has shown, you can access the information contained in the tables, you cannot create them but you can access to them.
Daniel
hi ,thanks for your work that i can use netdxf conveniently.but i what know it is not support the table entity which is not tableobject but like excel table