xiangzhong 发表于 2006-5-13 17:10:00

[ARX]问个关于ads_ssget的问题

<P>&nbsp; 我在过滤模式下:</P>
<P>&nbsp; ads_ssget("X",Null,Null,resbuf,ssname)是可以实现的,</P>
<P>&nbsp;但我现在要对某一窗口里面进行过滤,LL是左下脚坐标,UR是右上角坐标</P>
<P>&nbsp;&nbsp; ads_ssget("X",&amp;LL,&amp;UR,resbuf,ssname)就出错了,</P>
<P>&nbsp; 请问大侠,我该怎么设置啊?谢谢了</P>

HuaiYu 发表于 2006-5-13 18:15:00

<P>ads_ssget("X",&amp;LL,&amp;UR,resbuf,ssname)</P>
<P>改成</P>
<P>ads_ssget("W",&amp;LL,&amp;UR,resbuf,ssname)</P>

xiangzhong 发表于 2006-5-13 18:58:00

<P>en ,我改成c, w 就可以了</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp; 大侠能介绍下X有什么实际意义吗?不是都支持过滤吗?为什么说明里面特别替代x</P>
<P>的过滤呢?</P>

HuaiYu 发表于 2006-5-13 21:37:00

<P>看看这个就可以了,我也是抄这个里面的。呵呵</P>
<P>int<BR>acedSSGet(<BR>&nbsp;&nbsp;&nbsp; const char* str,<BR>&nbsp;&nbsp;&nbsp; const void* pt1,<BR>&nbsp;&nbsp;&nbsp; const void* pt2,<BR>&nbsp;&nbsp;&nbsp; const struct resbuf* filter,</P>
<P>&nbsp;&nbsp;&nbsp; ads_name ss);</P>
<P>Include File</P>
<P>acedads.h</P>
<P>Returns a selection set obtained by specifying one of the AutoCAD selection modes. A selection mode is specified either by prompting the AutoCAD user or by filtering the drawing database.<BR>Note&nbsp; Only a selection set consisting of entities from the current drawing's model space and paper space (not non-graphical objects or entities in other block definitions) can be returned by this function.<BR>The str argument is an optional string that specifies the entity selection modes.</P>
<P>The pt1 and pt2 arguments specify optional points relevant to some selection modes. pt1 can also be a result-buffer list that contains multiple points for the polygon or fence selection options, or it can be an array of two strings that are replacement prompts (but only when the :$ mode option is used). This is the reason that pt1 and <BR>p2 are declared as void*. The pt1 variable cannot contain points that define zero-length segments.</P>
<P>The filter argument is an optional result-buffer list that enables acedSSGet() to filter the drawing to select entities that are of certain types or that have certain properties. Whichever mode you use to obtain the selection set, use ss to identify the selection set's name.<BR>The str argument specifies which selection mode to use. It can be one of the strings listed in the following table.<BR>You must release the allocated selection set after you are finished with processing the selection. If you fail to do this the selection set will be kept on the stack until AutoCAD terminates. Since AutoCAD can only hold 128 application-based selection sets per session, the unreleased selection sets can result in failed object selections through ObjectARX.</P>
<P>Selection options for acedSSGet:</P>
<P>Value of str argument&nbsp;<BR>Description<BR>NULL &nbsp;Single-point selection (if pt1 is specified)or user selection (if pt1 is also NULL)<BR>"I" &nbsp;The PICKFIRST set<BR>"C" &nbsp;Crossing selection<BR>"CP" &nbsp;Crossing polygon selection<BR>"F" &nbsp;Fence (open polygon) selection<BR>"L" &nbsp;Last created entity<BR>"P" &nbsp;Previous selection set<BR>"W" &nbsp;Window selection<BR>"WP" &nbsp;Window polygon selection<BR>"X" &nbsp;Filter selection only <BR>"G"&nbsp;Groups<BR>":$"&nbsp;Prompts supplied<BR>":?"&nbsp;"Other" callbacks<BR>":D"&nbsp;Duplicates OK<BR>":E"&nbsp;Everything in aperature<BR>":K"&nbsp;Keyword callbacks<BR>":N"&nbsp;Nested<BR>":S"&nbsp;Force single object selection only<BR>"."&nbsp;User pick<BR>"#"&nbsp;Nongeometric (all, last, previous)<BR>"A"&nbsp;All<BR>"B"&nbsp;BOX<BR>"M"&nbsp;Multiple<BR>Selection Method Mode Options</P>
<P>NULL</P>
<P>If str, pt1, pt2, and filter are all NULL, acedSSGet() checks to see if there is a current PICKFIRST set. If there is, acedSSGet() returns it; otherwise, it prompts the user with AutoCAD's general Select objects prompt and waits until the user has chosen a selection set. During interactive selection, entities are highlighted on the screen, but acedSSGet() does not highlight entities that are obtained directly or with the filter argument. The acedSSGet() function does not return information about how the user chose the selection set. (The acedEntSel() and acedNEntSelP() functions obtain both an entity and a user-selected point.)</P>
<P>If both str and pt2 are NULL but pt1 is a point, the effect is the same as a user selecting an entity by specifying a single point with the AutoCAD pointing device.</P>
<P>"I"</P>
<P>Gets the current PICKFIRST set, if there is one. If there isn't, acedSSGet() returns RTERROR. ("I" stands for "implied.")<BR>Note The addCommand() optional flags ACRX_CMD_USEPICKSET and ACRX_CMD_REDRAW must be used in order for acedSSGet("I", ...) to work.</P>
<P>"C"</P>
<P>The AutoCAD Crossing selection mode. pt1 and pt2 must be points that specify the corners of the crossing window.</P>
<P>"CP"</P>
<P>The AutoCAD Crossing Polygon selection mode. pt1 is a list of points that define the crossing polygon. pt2 must be NULL.</P>
<P>"F"</P>
<P>The AutoCAD Fence selection mode. pt1 is a list of points that define the fence. pt2 must be NULL.</P>
<P>"L"</P>
<P>The AutoCAD Last selection mode. Selects the last entity that was created. Both pt1 and pt2 must be NULL.</P>
<P>"P"</P>
<P>The AutoCAD Previous selection mode. Selects the previous selection set. Both pt1 and pt2 must be NULL.</P>
<P>"W"</P>
<P>The AutoCAD Window selection mode. pt1 and pt2 must be points that specify the corners of the window.</P>
<P>"WP"</P>
<P>The AutoCAD Window Polygon selection mode. pt1 is a list of points that define the window polygon. pt2 must be NULL.</P>
<P>"X"</P>
<P>Filter selection only.</P>
<P>"G"</P>
<P>Causes AutoCAD to prompt the user to enter a group name. There is no way for a program to feed a group name to acedSSGet().</P>
<P>Colon Mode Options</P>
<P>":$"</P>
<P>This mode option indicates that the caller has supplied new prompts as the pt1 argument. These prompts will replace AutoCAD's select objects and remove objects prompts. The new prompt strings are passed to acedSSGet() as an array of two pointers to character strings (char* prompts). The string found at index 0 replaces the select objects prompt, and the string at index 1 replaces the remove objects prompt.</P>
<P>":?"</P>
<P>This mode option will cause the callback function set with acedSSSetOtherCallbackPtr() to be called whenever acedSSGet() receives any text input that it cannot understand.</P>
<P>":D"</P>
<P>This mode option causes acedSSGet() to allow duplication of entities within the selection set. So, each time an entity is selected it will be added to the selection set regardless of whether or not it is already in the selection set.</P>
<P>Warning Prior to the introduction of this mode option, all entries in selection sets were unique. Since the :D option does not guarantee that each entry will be unique, code that relies on this uniqueness should not use selection sets created with :D or else unexpected behaviour might result.</P>
<P>":E"</P>
<P>This mode option will cause acedSSGet() to select everything within the cursor's object selection pickbox when the user makes a selection.</P>
<P>":K"</P>
<P>This mode option will add custom keywords to the keyword list used by acedSSGet. In addition, if there is a keyword callback function pointer set in AutoCAD (set via <BR>acedSSSetKwordCallbackPtr()) then that callback function will be called whenever acedSSGet() receives any text input that is a custom keyword.<BR>When this mode option is used, the pt2 argument to acedSSGet() must point to a string of keywords formatted in the same fashion as for acedInitGet(). acedSSGet() will use a copy of the keyword list string passed in.</P>
<P>The ":K" keyword mechanism supports globalization in the same way that acedInitGet() does. The only difference is that in this instance you are appending your keywords to an already existing keyword list supplied by AutoCAD and the existing list has local and global keyword pairs, so you must either provide only global keywords (that is, the first character in your keyword list string is an underscore), or your keyword list must be local/global keyword pairs (that is, all of your local keywords followed by an underscore followed by all the matching global keywords).</P>
<P>":N"</P>
<P>This mode option will cause a subsequent call to acedSSNameX() to provide additional information about container blocks and transformation matrices for any entities selected during the acedSSGet() operation. The additional information will only be available for entities selected via graphical selection methods such as Window, Crossing, point pick, etc.</P>
<P>":S"</P>
<P>This mode option causes acedSSGet() to allow one selection only.<BR>Note that when using this mode option, the "Multiple" keyword should be removed using the "-M" mode option or undesirable behavior may result if the user activates the "Multiple" keyword option.</P>
<P>Keyword Filter Mode Options</P>
<P>"#"</P>
<P>When used in a '-' list, this option removes the keywords "Last", "All", "Group", and "Previous" from the keyword list.&nbsp; When used in a '+' list, this option adds the keywords "Last", "All", and "Previous". Controls the addition/removal of the "Last", "All", "Group", and "Previous" keywords in the acedSSGet() keyword list.</P>
<P>"."</P>
<P>This option uses the keyword manipulation syntax,&nbsp; but it controls the addition/removal of the ability of the user to "pick" with the pointing device or coordinate entry for selection.&nbsp; This is not an explicit keyword, but rather an implied keyword.</P>
<P>"A"</P>
<P>Controls the addition/removal of the "Add" keyword in the acedSSGet() keyword list.</P>
<P>"B"</P>
<P>When used in a '-' list,&nbsp; this option removes "Box" and "Auto" from the keyword list.&nbsp; When used in a '+' list,&nbsp; this option adds "Window", Crossing", "BOX", "WPolygon", and "CPolygon" to the keyword list.</P>
<P>"M"</P>
<P>Controls the addition/removal of the "Multiple" keyword in the acedSSGet() keyword list.</P>
<P>The keyword filter mode options must be grouped together and must come first in the mode string.&nbsp; The list takes one of these two forms:</P>
<P>1&nbsp;a list of forbidden keywords (a '-' must precede each keyword filter mode option in the list)<BR>2&nbsp;a list containing all of the keywords that should be allowed (a '+' must precede each keyword filter mode option in the list).</P>
<P>It is not possible to use both a '+' and a '-' list in the same acedSSGet() call.<BR>If the mode string str begins with a "-" the keywords specified by the keyword filter mode options which follow will be removed from the following full list:</P>
<P>"Window/Last/Crossing/BOX/ALL/Fence/WPolygon/CPolygon/Group/Add/</P>
<P>Remove/Multiple/Previous/Undo/AUto/Single"</P>
<P>If the mode string str starts with a "+" the keywords specified by the keyword filter mode options which follow will be added to the following base list:</P>
<P>"Add/Remove/Undo/Single"</P>
<P>Note When using the '+' filter mode, the option to allow the user to "pick" entities on screen is not available unless the '+' keyword list includes the "." mode option.&nbsp; If the "." mode option is not added,&nbsp; then the user must enter a keyword in order to activate a selection method with which to select entities.<BR>In addition to the "#", ".", "A", "B", and "M" keyword filter mode options, the letters "C", "F", "L", "P", and "W" may also be used to control their corresponding keywords as follows:</P>
<P>"C" </P>
<P>揅rossing" and "CPolygon" keywords</P>
<P>"F"</P>
<P>"Fence" keyword</P>
<P>"L"</P>
<P>"Last" keyword</P>
<P>"P"</P>
<P>"Previous" keyword</P>
<P>"W"</P>
<P>揥indow" and "WPolygon" keywords</P>
<P>"G" </P>
<P>揋roup" keyword</P>
<P>Selection Method mode options cannot be used in a mode string which contains keyword filter mode options or colon mode options. However, both colon mode options keyword filter momde options may be used together in the same mode string (for example: "-#-W:$:?:K:N").<BR>Note For the polygon options "CP" and "WP" (but not for "F"), acedSSGet() automatically closes the list of points. You don't need to build a list that specifies a final point that is identical to the first.</P>
<P>If str equals "X" but filter is NULL, acedSSGet() selects all entities in the drawing database.<BR>The filter is a linked list of result buffers that specify DXF group code. You can use an filter filter list in conjunction with any of the preceding selection modes. <BR>Entity names in selection sets obtained with acedSSGet() are always the names of main entities. The acedSSGet() function cannot obtain the names of subentities (block attributes and polyline vertices). For a means of obtaining subentity names, see the description of the acdbEntNext() function.</P>
<P>A selection set returned by acedSSGet() can be passed to AutoCAD with acedCmd() or acedCommand() in response to any Select objects prompt at which a selection by Last would also be valid. AutoCAD does not require the objects to be visible on the screen or to be selected by specifying a point.<BR>If acedSSGet() returns an error status code, no selection set is created.<BR>If acedSSGet() succeeds, it returns RTNORM; it returns RTERROR if no entities in the database match the specified criteria, or if the filter list contains invalid group codes. If acedSSGet() prompts the user to select entities, it can also return RTCAN to indicate that the user canceled the request by pressing +. When acedSSGet() fails, it sets the system variable ERRNO to a value that indicates the reason for the failure.</P>
<P>Selection Set Filter Lists</P>
<P>When acedSSGet() filters a drawing, it scans the entire database and compares the fields of each main entity against the filter filtering list. If an entity's properties match the codes specified by filter, it is included in the returned selection set; otherwise, it is not included. Each result buffer in filter specifies a DXF group code and associated value. Unless filter includes relational or conditional codes as described in the sections 揜elational Tests?and 揅onditional Filtering?later in this topic, acedSSGet() includes an entity in the selection set only if it matches all codes specified by filter.</P>
<P>Name types--for example, 0 (entity type), 2 (block reference), 6 (linetype), and 8 (layer name)--can include wild cards. If the name matches the wild-card pattern, it is included in the selection set.<BR>The resval specified in each buffer must be the appropriate type. For example, name types are strings, such as resval.rstring; thicknesses are double-precision floating-point values, such as resval.rreal; color and attributes-follow values are short integers, such as resval.rint; and extrusion vectors are three-dimensional points resval.rpoint.</P>
<P>Note The meaning of certain group codes can differ from entity to entity, and not all group codes are present in all entities. If a particular group code is specified in filter, entities that don't include that code are excluded from the selection set that acedSSGet() returns.</P>
<P>Filterable Entities</P>
<P>Entity filter lists recognize all DXF group codes except for handles (group 5), names (the "pseudo" group code -1), and extended entity data codes (in the range 1,000-2,000). To retrieve extended entity data, a filter list must specify the data's registered application name.<BR>The acedSSGet() call fails if the filter includes invalid group codes. The number of group codes that acedSSGet() filters recognize was increased in AutoCAD Release 12.<BR>When it filters a drawing, acedSSGet() retrieves entities on the filter list criteria alone; the selection set it retrieves may include entities from both paper space and model space. However, when the selection set is passed to an AutoCAD command, only entities from the space that is currently in effect are used (the space to which an entity belongs is specified by the value of its 67 group).</P>
<P>Wildcard Patterns in Filter Lists</P>
<P>Symbol names specified in filter lists--the entity type (0), block name (2), DIMSTYLE name (3), linetype (6), text style (7), and layer name (8)--can include wild-card patterns. The wildcard patterns recognized by acedSSGet() are the same as those recognized by the function acutWcMatch().<BR>The wildcard character, or asterisk (*), also appears in the name of anonymous blocks. So if you try to retrieve an anonymous block, you must escape this character by preceding it with a reverse quote (').</P>
<P>Filtering for Extended Entity Data</P>
<P>You can filter for extended entity data that belongs to a particular application or set of applications by specifying the -3 group code in filter. Separate multiple application names by commas. Wild cards are allowed in the string.</P>
<P>Relational Tests</P>
<P>By default, acedSSGet() selects entities that match all the criteria in the filter list. The implied relation between each item in filter is "equals." For numeric groups (integers, reals, points, and vectors) you can specify other relationships by including a special -4 result buffer that specifies a relational operator. The operator applies to the result buffer that immediately follows it. Relational operators are specified by strings. The following table shows the possible operators.</P>
<P>Relational operators for selection set filter lists:</P>
<P>Operator&nbsp;Description<BR>"*" &nbsp;Anything goes (always true) <BR>"=" &nbsp;Equals <BR>"!=" &nbsp;Not equal to <BR>"/=" &nbsp;Not equal to<BR>"&lt;&gt;" &nbsp;Not equal to <BR>"&lt;" &nbsp;Less than <BR>"&lt;=" &nbsp;Less than or equal to <BR>"&gt;" &nbsp;Greater than <BR>"&gt;=" &nbsp;Greater than or equal to <BR>"&amp;" &nbsp;Bitwise AND (integer groups only) <BR>"&amp;=" &nbsp;Bitwise masked equals (integer groups only) <BR>The relational operators can be used in any of the following ways, depending on the group you are testing.</P>
<P>All relational operators except for the bitwise operators "&amp;" and "&amp;=" are valid for both real- and integer-valued groups.<BR>&nbsp;The bitwise operators "&amp;" and "&amp;=" are valid only for integer-valued groups. The result buffer that follows the bitwise operator must be of type RTSHORT, which is used as a mask for the integer group. The bitwise AND "&amp;" is true if the bits set in the mask are set also in the integer group ((integer_group &amp; mask) != 0). The bitwise masked equals "&amp;=" is true if the mask is identical to the integer group ((integer-group ^ mask) == 0).</P>
<P>For point groups, the X, Y, and Z tests can be combined into a single string, with each operator separated by commas--for example, "&gt;,&gt;,*". If you omit an operator from the string (for example, "=,&lt;&gt;" leaves out the Z test), the "anything goes" operator "*" is assumed.<BR>&nbsp;Direction vectors (group type 210) can be compared only with the operators "*", "=", and "!=" (or one of the equivalent "not equals" strings).</P>
<P>You cannot use the relational operators with string groups. Use wild-card tests instead.</P>
<P>Conditional Filtering</P>
<P>The relational operators are binary operators. You can also test groups by creating nested Boolean expressions that use the conditional operators shown in the following table. The conditional operators are specified by -4 groups, like the relational operators. They are paired and must be balanced correctly in the filter list or the <BR>acedSSGet() call fails. The number of operands that these operators can enclose depends on the operation, as shown in the table.<BR>Conditional operators for selection set filter lists:</P>
<P>Starting operator &nbsp;<BR>Encloses&nbsp;Ending operator<BR>"&lt;AND" &nbsp;One or more operands &nbsp;"AND&gt;" <BR>"&lt;OR" &nbsp;One or more operands &nbsp;"OR&gt;" <BR>"&lt;XOR" &nbsp;Two operands &nbsp;"XOR&gt;" <BR>"&lt;NOT" &nbsp;One operand&nbsp; &nbsp;"NOT&gt;" <BR>With the conditional operators, an operand is an entity field group, a relational operator followed by an entity field group, or a nested expression created by these operators.<BR>Conditional expressions that test for extended entity data (using the -3 group) can contain only -3 groups.<BR>The conditional operators are not case sensitive; you can also use their lowercase equivalents including &lt;and, and&gt;, &lt;or, or&gt;, &lt;xor, xor&gt;, &lt;not, and not&gt;.</P>

wzz1968 发表于 2006-5-16 15:04:00

<P>X--是选择所有的选择集</P>
<P>W是窗选</P>
<P>&nbsp;</P>
页: [1]
查看完整版本: [ARX]问个关于ads_ssget的问题