复杂实体(折线或块)必须通过多次调用来创建,对每个子实体使用单独的调用。当第一次收到复杂实体的初始组件时,它会创建一个临时文件,用于收集定义数据(和扩展数据,如果存在)。每个后续调用都会将新的子实体追加到文件中。当复杂图元的定义完成时(即,当接收适当或子图元时),将检查图元的一致性,如果有效,则将其添加到图形中。当复杂实体完成或取消创建时,将删除该文件。acdbEntMake()acdbEntMake() acdbEntMake()acdbEntMake()SeqendEndblk 下面的示例包含五个调用,用于创建单个复杂实体,即折线。折线的线型为虚线,颜色为 BLUE。它有三个顶点,分别位于坐标 (1,1,0)、(4,6,0) 和 (3,2,0)。所有其他可选定义数据均采用默认值。acdbEntMake() int status; struct resbuf *entlist, result; ads_point newpt; entlist = acutBuildList( RTDXF0, "POLYLINE",// Entity type 62, 5, // Color (blue) 6, "dashed",// Linetype 66, 1, // Vertices follow. 0); if (entlist == NULL) { acdbFail("Unable to create result buffer list\n"); return BAD; } status = acdbEntMake(entlist); acutRelRb(entlist); // Release acdbEntMake() buffer. if (status != RTNORM) { acutPrintf ("%d",status); acedGetVar ("ERRNO", &result); acutPrintf ("ERRNO == %d, result.resval.rint); acdbFail("Unable to start polyline\n"); return BAD; } newpt[X] = 1.0; newpt[Y] = 1.0; newpt[Z] = 0.0; // The polyline is planar entlist = acutBuildList( RTDXF0, "VERTEX", // Entity type 62, 5, // Color (blue) 6, "dashed", // Linetype 10, newpt, // Start point 0); if (entlist == NULL) { acdbFail("Unable to create result buffer list\n"); return BAD; } status = acdbEntMake(entlist); acutRelRb(entlist); // Release acdbEntMake() buffer. if (status != RTNORM) { acdbFail("Unable to add polyline vertex\n"); return BAD; } newpt[X] = 4.0; newpt[Y] = 6.0; entlist = acutBuildList( RTDXF0, "VERTEX", // Entity type 62, 5, // Color (blue) 6, "dashed", // Linetype 10, newpt, // Second point 0); if (entlist == NULL) { acdbFail("Unable to create result buffer list\n"); return BAD; } status = acdbEntMake(entlist); acutRelRb(entlist); // Release acdbEntMake() buffer. if (status != RTNORM) { acdbFail("Unable to add polyline vertex\n"); return BAD; } newpt[X] = 3.0; newpt[Y] = 2.0; entlist = acutBuildList( RTDXF0, "VERTEX", // Entity type 62, 5, // Color (blue) 6, "dashed", // Linetype 10, newpt, // Third point 0); if (entlist == NULL) { acdbFail("Unable to create result buffer list\n"); return BAD; } status = acdbEntMake(entlist); acutRelRb(entlist); // Release acdbEntMake() buffer. if (status != RTNORM) { acdbFail("Unable to add polyline vertex\n"); return BAD; } entlist = acutBuildList( RTDXF0, "SEQEND", // Sequence end 62, 5, // Color (blue) 6, "dashed", // Linetype 0); if (entlist == NULL) { acdbFail("Unable to create result buffer list\n"); return BAD; } status = acdbEntMake(entlist); acutRelRb(entlist); // Release acdbEntMake() buffer. if (status != RTNORM) { acdbFail("Unable to complete polyline\n"); return BAD; } 创建块类似,只是当成功创建实体时,它会返回一个值 of。您可以通过调用 to 来验证新块的名称。acdbEntMake()EndblkRTKWORDacedGetInput() |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:12
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.