|
[code]https://blog.csdn.net/mary288267/article/details/118959992[/code]
今天翻看arx帮助文档,偶然看到以下接口:
struct resbuf * acdbEntGet( const ads_name ent );
该接口可以从图形数据库获取指定实体,并将其定义数据以链表形式返回。这个函数也可用于检查字典。
(Retrieves the specified entity from the drawing database and returns its definition data as a linked list of result buffers. This function is used also to examine dictionaries.)
然后,我就在想,是否有一个接口,能够根据实体定义数据创建一个实体呢?确实是有:
int acdbEntMake( const struct resbuf * ent );
该接口将链表描述的实体(或者可以是一个空的字典)添加到图形数据库当中。参数ent是一个结果缓冲区链表,它的格式同acdbEntGet接口返回的链表一致。
(Makes a new entity, which can be an empty dictionary, by appending the entity specified by ent to the drawing database. The ent argument is a linked list of result buffers that should have the same format as a list returned by acdbEntGet().)
void MakeEntFromResbuf()
{
struct resbuf *newent;
ads_point center = { 4.0, 4.0, 0.0 };
newent = acutBuildList(
RTDXF0, _T("CIRCLE"),
62, 1, // 1 == red
10, center,
40, 1.0, // Radius
0);
if (acdbEntMake(newent) != RTNORM)
{
acdbFail(_T("Error making circle entity\n"));
}
acutRelRb(newent);
} |
|