User's guide > Selection
Selection
This section describes how to use Interactive Selection in Creo Object TOOLKIT Java.
Interactive Selection
Methods Introduced:
When you call the method pfcSession.BaseSession.Select, the Select dialog box appears in Creo+ user interface for selecting objects and returns a pfcSelect.Selections sequence that contains the objects the user selected. Using the Options argument, you can control the type of object that can be selected and the maximum number of selections.
In addition, you can pass in a pfcSelect.Selections sequence to the method. The returned pfcSelect.Selections sequence will contain the input sequence and any new objects.
The method pfcSelect.pfcSelect.SelectionOptions_Create pfcSelect.SelectionOptions.SetOptionKeywords take a String argument made up of one or more of the identifiers listed in the table below, separated by commas.
For example, to allow the selection of features and axes, the arguments would be feature, axis.
Creo+ Database Item
String Identifier
ModelItemType
Datum point
point
ITEM_POINT
Datum axis
axis
ITEM_AXIS
Datum plane
datum
ITEM_SURFACE
Coordinate system datum
csys
ITEM_COORD_SYS
Feature
feature
ITEM_FEATURE
Edge (solid or datum surface)
edge
ITEM_EDGE
Edge (solid only)
sldedge
ITEM_EDGE
Edge (datum surface only)
qltedge
ITEM_EDGE
Datum curve
curve
ITEM_CURVE
Composite curve
comp_crv
ITEM_CURVE
Surface (solid or quilt)
surface
ITEM_SURFACE
Surface (solid)
sldface
ITEM_SURFACE
Surface (datum surface)
qltface
ITEM_SURFACE
Quilt
dtmqlt
ITEM_QUILT
Dimension
dimension
ITEM_DIMENSION
Reference dimension
ref_dim
ITEM_REF_DIMENSION
Integer parameter
ipar
ITEM_DIMENSION
Part
part
N/A
Part or subassembly
prt_or_asm
N/A
Assembly component model
component
N/A
Component or feature
membfeat
ITEM_FEATURE
Detail symbol
dtl_symbol
ITEM_DTL_SYM_INSTANCE
Note
any_note
ITEM_NOTE, ITEM_DTL_NOTE
Draft entity
draft_ent
ITEM_DTL_ENTITY
Table
dwg_table
ITEM_TABLE
Table cell
table_cell
ITEM_TABLE
Drawing view
dwg_view
N/A
Solid body
3d_body
ITEM_BODY
Datum Curve End
curve_end
ITEM_CRV_START or ITEM_CRV_END
When you specify the maximum number of selections, the argument to pfcSelect.SelectionOptions.SetMaxNumSels must be an Integer. The code will be as follows:
sel_options.setMaxNumSels (new Integer (10));
The default value assigned when creating a SelectionOptions object is –1, which allows any number of selections by the user.
The method wfcSelect.wfcSelect.WSelectionOptions_Create allows you to set options for selecting objects by specifying the selection attribute. The input arguments are:
OptionKeywords—Specifies the selection filter.
MaxNumSels—Specifies the maximum number of selections.
SelEnvOpts—Specifies the selection attribute set using the method wfcSelect.WSelectionOptions.SetSelEnvOptions.
The method wfcSelect.WSelectionOptions.GetSelEnvOptions retrieves the selection attribute.
The method wfcSelect.wfcSelect.SelectionEnvironmentOption_Create creates a data object of type SelectionEnvironmentOption that contains information about the attributes for the interactive selection in Creo+ user interface. Use the method wfcSelect.SelectionEnvironmentOption.SetAttribute to set the selection attribute. The following attribute types are available:
SELECT_DONE_REQUIRED—Specifies that user has to click OK in the Select dialog box to get the selected items.
SELECT_BY_MENU_ALLOWED—Specifies that search tool is available in the method pfcSession.BaseSession.Select when the attribute value is set to 1, which is the default value.
SELECT_BY_BOX_ALLOWED—Specifies that user must draw a bounding box to get the items selected within the box.
SELECT_ACTIVE_COMPONENT_IGNORE—Specifies that user can select items external to the activate component.
SELECT_HIDE_SEL_DLG—Specifies that the Select dialog box must be hidden.
The method wfcSelect.SelectionEnvironmentOption.GetAttribute retrieves the selection attribute.
Use the method wfcSelect.SelectionEnvironmentOption.SetAttributeValue to get the integer value of the attributes set in the selection object.
The method wfcSelect.WSelection.Verify verifies if the content of the selection object is valid.
The method wfcSelect.WSelection.GetWindow retrieves the window where the selection was made.
Was this helpful?