看看这个就可以了,我也是抄这个里面的。呵呵
int acedSSGet( const char* str, const void* pt1, const void* pt2, const struct resbuf* filter,
ads_name ss);
Include File
acedads.h
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. Note 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. The str argument is an optional string that specifies the entity selection modes.
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 p2 are declared as void*. The pt1 variable cannot contain points that define zero-length segments.
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. The str argument specifies which selection mode to use. It can be one of the strings listed in the following table. 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.
Selection options for acedSSGet:
Value of str argument Description NULL Single-point selection (if pt1 is specified)or user selection (if pt1 is also NULL) "I" The PICKFIRST set "C" Crossing selection "CP" Crossing polygon selection "F" Fence (open polygon) selection "L" Last created entity "P"  revious selection set "W" Window selection "WP" Window polygon selection "X" Filter selection only "G" Groups "" rompts supplied ":?" "Other" callbacks ":D" Duplicates OK ":E" Everything in aperature ":K" Keyword callbacks ":N" Nested ":S" Force single object selection only "." User pick "#" Nongeometric (all, last, previous) "A" All "B" BOX "M" Multiple Selection Method Mode Options
NULL
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.)
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.
"I"
Gets the current PICKFIRST set, if there is one. If there isn't, acedSSGet() returns RTERROR. ("I" stands for "implied.") Note The addCommand() optional flags ACRX_CMD_USEPICKSET and ACRX_CMD_REDRAW must be used in order for acedSSGet("I", ...) to work.
"C"
The AutoCAD Crossing selection mode. pt1 and pt2 must be points that specify the corners of the crossing window.
"CP"
The AutoCAD Crossing Polygon selection mode. pt1 is a list of points that define the crossing polygon. pt2 must be NULL.
"F"
The AutoCAD Fence selection mode. pt1 is a list of points that define the fence. pt2 must be NULL.
"L"
The AutoCAD Last selection mode. Selects the last entity that was created. Both pt1 and pt2 must be NULL.
"P"
The AutoCAD Previous selection mode. Selects the previous selection set. Both pt1 and pt2 must be NULL.
"W"
The AutoCAD Window selection mode. pt1 and pt2 must be points that specify the corners of the window.
"WP"
The AutoCAD Window Polygon selection mode. pt1 is a list of points that define the window polygon. pt2 must be NULL.
"X"
Filter selection only.
"G"
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().
Colon Mode Options
""
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[2]). The string found at index 0 replaces the select objects prompt, and the string at index 1 replaces the remove objects prompt.
":?"
This mode option will cause the callback function set with acedSSSetOtherCallbackPtr() to be called whenever acedSSGet() receives any text input that it cannot understand.
":D"
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.
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.
":E"
This mode option will cause acedSSGet() to select everything within the cursor's object selection pickbox when the user makes a selection.
":K"
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 acedSSSetKwordCallbackPtr()) then that callback function will be called whenever acedSSGet() receives any text input that is a custom keyword. 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.
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).
":N"
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.
":S"
This mode option causes acedSSGet() to allow one selection only. 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.
Keyword Filter Mode Options
"#"
When used in a '-' list, this option removes the keywords "Last", "All", "Group", and "Previous" from the keyword list. 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.
"."
This option uses the keyword manipulation syntax, but it controls the addition/removal of the ability of the user to "pick" with the pointing device or coordinate entry for selection. This is not an explicit keyword, but rather an implied keyword.
"A"
Controls the addition/removal of the "Add" keyword in the acedSSGet() keyword list.
"B"
When used in a '-' list, this option removes "Box" and "Auto" from the keyword list. When used in a '+' list, this option adds "Window", Crossing", "BOX", "WPolygon", and "CPolygon" to the keyword list.
"M"
Controls the addition/removal of the "Multiple" keyword in the acedSSGet() keyword list.
The keyword filter mode options must be grouped together and must come first in the mode string. The list takes one of these two forms:
1 a list of forbidden keywords (a '-' must precede each keyword filter mode option in the list) 2 a list containing all of the keywords that should be allowed (a '+' must precede each keyword filter mode option in the list).
It is not possible to use both a '+' and a '-' list in the same acedSSGet() call. 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:
"Window/Last/Crossing/BOX/ALL/Fence/WPolygon/CPolygon/Group/Add/
Remove/Multiple/Previous/Undo/AUto/Single"
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:
"Add/Remove/Undo/Single"
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. If the "." mode option is not added, then the user must enter a keyword in order to activate a selection method with which to select entities. 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:
"C"
揅rossing" and "CPolygon" keywords
"F"
"Fence" keyword
"L"
"Last" keyword
"P"
"Previous" keyword
"W"
揥indow" and "WPolygon" keywords
"G"
揋roup" keyword
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"). 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.
If str equals "X" but filter is NULL, acedSSGet() selects all entities in the drawing database. 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. 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.
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. If acedSSGet() returns an error status code, no selection set is created. 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 [CTRL]+[C]. When acedSSGet() fails, it sets the system variable ERRNO to a value that indicates the reason for the failure.
Selection Set Filter Lists
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.
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. 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.
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.
Filterable Entities
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. 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. 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).
Wildcard Patterns in Filter Lists
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(). 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 (').
Filtering for Extended Entity Data
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.
Relational Tests
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.
Relational operators for selection set filter lists:
Operator Description "*" Anything goes (always true) "=" Equals "!=" Not equal to "/=" Not equal to "<>" Not equal to "<" Less than "<=" Less than or equal to ">" Greater than ">=" Greater than or equal to "&" Bitwise AND (integer groups only) "&=" Bitwise masked equals (integer groups only) The relational operators can be used in any of the following ways, depending on the group you are testing.
All relational operators except for the bitwise operators "&" and "&=" are valid for both real- and integer-valued groups. The bitwise operators "&" and "&=" 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 "&" is true if the bits set in the mask are set also in the integer group ((integer_group & mask) != 0). The bitwise masked equals "&=" is true if the mask is identical to the integer group ((integer-group ^ mask) == 0).
For point groups, the X, Y, and Z tests can be combined into a single string, with each operator separated by commas--for example, ">,>,*". If you omit an operator from the string (for example, "=,<>" leaves out the Z test), the "anything goes" operator "*" is assumed. Direction vectors (group type 210) can be compared only with the operators "*", "=", and "!=" (or one of the equivalent "not equals" strings).
You cannot use the relational operators with string groups. Use wild-card tests instead.
Conditional Filtering
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 acedSSGet() call fails. The number of operands that these operators can enclose depends on the operation, as shown in the table. Conditional operators for selection set filter lists:
Starting operator Encloses Ending operator "<AND" One or more operands "AND>" "<OR" One or more operands "OR>" "<XOR" Two operands "XOR>" "<NOT" One operand "NOT>" 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. Conditional expressions that test for extended entity data (using the -3 group) can contain only -3 groups. The conditional operators are not case sensitive; you can also use their lowercase equivalents including <and, and>, <or, or>, <xor, xor>, <not, and not>. |