DXF/DWG 内部:块的名称是否唯一?

DXF/DWG internals: Is a block's name unique?

我正在编写一个 DXF/DWG 对象转储程序。转储器分层导出所有数据,然后将此完整数据集转换为 GeoJson 或 CSV-WKT 交替。

我偶然发现的一件事是我的内部层次结构将所有转储块存储在与字典相同的层次结构级别:

entities->block1->...data...
entities->block2->...data...

我还没有发现任何问题,但由于我将其存储为映射,因此块名称需要是唯一键,我想知道这个假设是否正确。

那么,方块名称是唯一的吗?块总是有名字吗?是否可以存在没有唯一名称的非用户创建的块,即使用户创建的块确实是唯一的?

如果您查看 here,您将获得有关 DXF 文件的所有信息。

您需要查看 BLOCKS and ENTITIES INSERT 部分。

方块的定义有一个唯一的引用。然后在绘图中是 INSERT 对象,它们是块的实例。

它还提到:

The BLOCKS section of the DXF file contains all the block definitions. It contains the entities that make up the blocks used in the drawing, including anonymous blocks generated by the HATCH command and by associative dimensioning. The format of the entities in this section is identical to those in the ENTITIES section. All entities in the BLOCKS section appear between block and endblk entities. Block and endblk entities appear only in the BLOCKS section. Block definitions are never nested (that is, no block or endblk entity ever appears within another block-endblk pair), although a block definition can contain an insert entity.

External references are written in the DXF file as block definitions, except that they also include a string (group code 1) that specifies the path and file name of the external reference.

The block table handle, along with any xdata and persistent reactors, appears in each block definition immediately following the BLOCK record, which contains all of the specific information that a block table record stores.

AutoCAD 块是可以在不同位置以不同角度和比例(甚至不均匀比例)多次插入图形中的符号。每个块的实体列表都可以包含生成嵌套结构的块引用。因此,您的实现需要处理多级对象嵌套的递归方法。

是的,块的名称是唯一的,可以存储为字典键。