处理选择集的 ObjectARX 函数类似于 AutoLISP 中的函数。该函数提供了创建选择集的最通用方法。它通过以下三种方式之一创建选择集: ® acedSSGet()
int acedSSGet ( const char *str, const void *pt1, const void *pt2, const struct resbuf *entmask, ads_name ss); 第一个参数 to 是一个字符串,用于描述要使用的选择选项,如下表所示。acedSSGet()
The next two arguments specify point values for the relevant options. (They should be if they don't apply.) If the fourth argument, , is not , it points to the list of entity field values used in filtering. The fifth argument, , identifies the selection set's name. NULLentmaskNULLss The following code shows representative calls to . As the call illustrates, for the polygon options “” and “” (but not for “”), automatically closes the list of points. You don't need to build a list that specifies a final point identical to the first. 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)
GMT+8, 2025-1-8 19:30
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.