Community Tip - You can change your system assigned username to something more personal in your community settings. X
I want to make dialog like for creating planar constraint, but can't understand how to set filters to wfcSession selection or make call wfcSession->Select(wfcSelectionOptions_ptr) in background with ActionListener like "OnSelect" or something. Can anyone help me with this issue?
creating planar constraint dialog image :http://joxi.ru/v29l1M0sgYEamG
Solved! Go to Solution.
found that if set up to choose one item than dialog hide correctly
pfcSession_ptr pSession = pfcGetProESession();
wfcWSession_ptr wSession = wfcWSession::cast(pSession);
wfcSelectionEnvironmentOptions_ptr wfcSelEnvOptions = wfcSelectionEnvironmentOptions::create();
wfcSelectionEnvironmentOption_ptr selEnvOpt = wfcSelectionEnvironmentOption::Create(wfcSELECT_HIDE_SEL_DLG, 1);
wfcSelEnvOptions->append(selEnvOpt);
wfcWSelectionOptions_ptr wSelOpt = wfcWSelectionOptions::Create(choosenType, 1, wfcSelEnvOptions);
pfcSelectionOptions_ptr pSelOpt = pfcSelectionOptions::softcast(wSelOpt);
pfcSelections_ptr pSelections = wSession->Select(pSelOpt);
wfcSession->Select is perfect for this. What do you want to select ?
AFAIK :
1. Create an option_ptr
pfcSelectionOptions_ptr option_ptr = pfcSelectionOptions::Create("String Identifier");
Creo Parametric Database Item | String Identifier | ModelItemType |
---|---|---|
Datum point | point | pfcITEM_POINT |
Datum axis | axis | pfcITEM_AXIS |
Datum plane | datum | pfcITEM_SURFACE |
Coordinate system datum | csys | pfcITEM_COORD_SYS |
Feature | feature | pfcITEM_FEATURE |
Edge (solid or datum surface) | edge | pfcITEM_EDGE |
Edge (solid only) | sldedge | pfcITEM_EDGE |
Edge (datum surface only) | qltedge | pfcITEM_EDGE |
Datum curve | curve | pfcITEM_CURVE |
Composite curve | comp_crv | pfcITEM_CURVE |
Surface (solid or quilt) | surface | pfcITEM_SURFACE |
Surface (solid) | sldface | pfcITEM_SURFACE |
Surface (datum surface) | qltface | pfcITEM_SURFACE |
Quilt | dtmqlt | pfcITEM_QUILT |
Dimension | dimension | pfcITEM_DIMENSION |
Reference dimension | ref_dim | pfcITEM_REF_DIMENSION |
Integer parameter | ipar | pfcITEM_DIMENSION |
Part | part | N/A |
Part or subassembly | prt_or_asm | N/A |
Assembly component model | component | N/A |
Component or feature | membfeat | pfcITEM_FEATURE |
Detail symbol | dtl_symbol | pfcITEM_DTL_SYM_INSTANCE |
Note | any_note | pfcITEM_NOTE, pfcITEM_DTL_NOTE |
Draft entity | draft_ent | pfcITEM_DTL_ENTITY |
Table | dwg_table | pfcITEM_TABLE |
Table cell | table_cell | pfcITEM_TABLE |
Drawing view | dwg_view | N/A |
2. Do your select and get back your pfcselection_ptr.
3. Undefined maxlength
int length = sel_ptr.getarraysize();
for (int i = 0; i < length; i++) {
sel_ptr.get(i);
}
3. Defined maxlength
sel_ptr.get(0);
4. Cast it to the stuff you say he can select. If it's more than one you need to check the type.
Br,
Eike
PS: Code is written down without testing it ... so please check it before you run it ^.^
thanks, I tried "wfcSession->Select", but still have default dialog appears, I want to do something like Creo Simulate planar constraint dialog reference selection.
Here some code:
pfcSession_ptr | pSession = pfcGetProESession(); |
wfcWSession_ptr wSession = wfcWSession::cast(pSession);
wfcSelectionEnvironmentOptions_ptr wfcSelEnvOptions = wfcSelectionEnvironmentOptions::create();
wfcSelectionEnvironmentOption_ptr ptropt = wfcSelectionEnvironmentOption::Create(wfcSELECT_HIDE_SEL_DLG, 1);
wfcSelEnvOptions->append(ptropt);
wfcWSelectionOptions_ptr wOpt= wfcWSelectionOptions::Create("surface",-1,wfcSelEnvOptions);
pfcSelectionOptions_ptr pOpt = pfcSelectionOptions::softcast(wOpt);
wSession->Select(pOpt);
One more Idea ...
If you use the std. select and you are in a Program that is async. You need to know how the window name ist (collect it by mapkey) and it could be that you can use ProDialogHide() or something like that on it. But I don't know if it reacts after that like it should.
It could be that this isn't possible at that moment and crashes Creo ... so I don't know ... just an idea.
Or you live with the small Dialog, because it's std. PTC behaivior ^.^
Br,
Eike
thanks, I'll try ProDialogHide(), may be any ideas how to set up filters without using wSession->Select or ProSelect() ?
found that if set up to choose one item than dialog hide correctly
pfcSession_ptr pSession = pfcGetProESession();
wfcWSession_ptr wSession = wfcWSession::cast(pSession);
wfcSelectionEnvironmentOptions_ptr wfcSelEnvOptions = wfcSelectionEnvironmentOptions::create();
wfcSelectionEnvironmentOption_ptr selEnvOpt = wfcSelectionEnvironmentOption::Create(wfcSELECT_HIDE_SEL_DLG, 1);
wfcSelEnvOptions->append(selEnvOpt);
wfcWSelectionOptions_ptr wSelOpt = wfcWSelectionOptions::Create(choosenType, 1, wfcSelEnvOptions);
pfcSelectionOptions_ptr pSelOpt = pfcSelectionOptions::softcast(wSelOpt);
pfcSelections_ptr pSelections = wSession->Select(pSelOpt);
Pretty cool : ) Thanks for sharing