| 处理选择集 处理选择集的 ObjectARX 函数类似于 AutoLISP 中的函数。该函数提供了创建选择集的最通用方法。它通过以下三种方式之一创建选择集: ® acedSSGet() 
 int acedSSGet ( const char *str, const void *pt1, const void *pt2, const struct resbuf *entmask, ads_name ss); 的第一个参数是一个字符串,用于描述要使用的选择选项,如下表所示。acedSSGet() 
 接下来的两个参数指定相关选项的点值。(如果他们不申请,他们应该是。如果第四个参数 不是 ,则它指向筛选中使用的实体字段值列表。第五个参数 标识选择集的名称。NULLentmaskNULLss 下面的代码显示了对 的代表性调用。如调用所示,对于多边形选项“”和“”(但不用于“”),会自动关闭点列表。您不需要构建一个列表来指定与第一个点相同的最终点。acedSSGet()acutBuildList()CPWPFacedSSGet() ads_point pt1, pt2, pt3, pt4; 
struct resbuf *pointlist; 
ads_name ssname; 
pt1[X] = pt1[Y] = pt1[Z] = 0.0; 
pt2[X] = pt2[Y] = 5.0; pt2[Z] = 0.0; 
// Get the current PICKFIRST set, if there is one; 
// otherwise, ask the user for a general entity selection. 
acedSSGet(NULL, NULL, NULL, NULL, ssname); 
// Get the current PICKFIRST set, if there is one. 
acedSSGet("I", NULL, NULL, NULL, ssname); 
// Selects the most recently selected objects. 
acedSSGet("P", NULL, NULL, NULL, ssname); 
// Selects the last entity added to the database. 
acedSSGet("L", NULL, NULL, NULL, ssname); 
// Selects entity passing through point (5,5). 
acedSSGet(NULL, pt2, NULL, NULL, ssname); 
// Selects entities inside the window from (0,0) to (5,5). 
acedSSGet("W", pt1, pt2, NULL, ssname); 
// Selects entities enclosed by the specified polygon. 
pt3[X] = 10.0; pt3[Y] = 5.0; pt3[Z] = 0.0; 
pt4[X] = 5.0; pt4[Y] = pt4[Z] = 0.0; 
pointlist = acutBuildList(RTPOINT, pt1, RTPOINT, pt2, 
	RTPOINT, pt3, RTPOINT, pt4, 0); 
acedSSGet("WP", pointlist, NULL, NULL, ssname); 
// Selects entities crossing the box from (0,0) to (5,5). 
acedSSGet("C", pt1, pt2, NULL, ssname); 
// Selects entities crossing the specified polygon. 
acedSSGet("CP", pointlist, NULL, NULL, ssname); 
acutRelRb(pointlist); 
// Selects the entities crossed by the specified fence. 
pt4[Y] = 15.0; pt4[Z] = 0.0; 
pointlist = acutBuildList(RTPOINT, pt1, RTPOINT, pt2, 
	RTPOINT, pt3, RTPOINT, pt4, 0); 
acedSSGet("F", pointlist, NULL, NULL, ssname); 
acutRelRb(pointlist); 
该函数的补充是该函数,一旦应用程序完成使用,它就会释放一个选择集。选择集由名称指定。以下代码段使用上一示例中的声明。acedSSGet()acedSSFree()ads_name acedSSFree(ssname); 注意:AutoCAD 不能同时打开超过 128 个选择集。此限制包括在所有并发运行的 ObjectARX 和 AutoLISP 应用程序中打开的选择集。您的系统上的限制可能不同。如果达到限制,AutoCAD 将拒绝创建更多选择集。不建议同时管理大量选择集。相反,在任何给定时间保持合理数量的打开集,并尽快调用释放未使用的选择集。与 AutoLISP 不同,ObjectARX 环境没有自动垃圾回收功能,以便在使用选择集后释放它们。应用程序在收到 、 或消息时应始终释放其打开的选择集。acedSSFree()kUnloadDwgMsgkEndMsgkQuitMsg 父主题: | 
 |Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-10-31 14:04
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.