明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1669|回复: 1

求助,无名块的问题

[复制链接]
发表于 2004-10-13 21:15:00 | 显示全部楼层 |阅读模式
请问各位主高手,怎样用ARX编写实现无名块(*U)的具体程序,谢谢!
发表于 2004-10-13 22:22:00 | 显示全部楼层

回复

帮助中的例子:

The following code begins an anonymous block, ends it, and retrieves its name.

int status; 
struct resbuf *entlist; 
ads_point basept; 
char newblkname[20]; 
 
ads_point pnt1 = ( 0.0, 0.0, 0.0); 
entlist = acutBuildList(
    RTDXF0, "BLOCK", 
    2, "*ANON", // Only the '*' matters.
    10, "1", // No other flags are set.
    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 start anonymous block\n"); 
    return BAD; 
} 
 
// Add entities to the block by more acdbEntMake calls.
. 
. 
. 
entlist = acutBuildList(RTDXF0, "ENDBLK", 0 ); 
 
if (entlist == NULL) { 
    acdbFail("Unable to create result buffer list\n"); 
    return BAD; 
} 
 
status = acdbEntMake(entlist); 
acutRelRb(entlist); // Release acdbEntMake buffer.
 
if (status != RTKWORD) { 
    acdbFail("Unable to close anonymous block\n"); 
    return BAD; 
} 
status = acedGetInput(newblkname); 
 
if (status != RTNORM) { 
    acdbFail("Anonymous block not created\n"); 
    return BAD; 
} 

To reference an anonymous block, create an insert entity with acdbEntMake(). (You cannot pass an anonymous block to the INSERT command.)

Continuing the previous example, the following code fragment inserts the anonymous block at (0,0).

basept[X] = basept[Y] = basept[Z] = 0.0; 
 
entlist = acutBuildList(
    RTDXF0, "INSERT", 
    2, newblkname, // From acedGetInput  
    10, basept, 
    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 insert anonymous block\n"); 
    return BAD; 
} 
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-2-23 14:57 , Processed in 0.161726 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表