Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Journal: Selection Filter to default?

Status
Not open for further replies.

CNSZU

Mechanical
Sep 2, 2005
318
Hello,

How does one set the selection filter of a BlockStyler.SelectObject to default ("No Selection Filter") so that you can select any object?

This is what I have so far:
Code:
 Dim selectionfilter(0) As MaskTriple
selectionfilter(0).Type = -1
selectionfilter(0).Subtype = -1
selection0.GetProperties.SetSelectionFilter("SelectionFilter", Selection.SelectionAction.ClearAndEnableSpecific, selectionfilter)

However, this disables the selection filter.

Is there a solution?

NX10.0 Win8.1 64bit i7-3770K 16GB Quadro2000
 
Replies continue below

Recommended for you

selection0.GetProperties.SetSelectionFilter("SelectionFilter", Selection.SelectionAction.EnableAll, ...
 
Hi BubbaK,

I tried that, but it fails.

Code:
Dim selectionfilter(0) As MaskTriple
selection0.GetProperties.SetSelectionFilter("SelectionFilter", Selection.SelectionAction.EnableAll, selectionfilter)

NX shows an error dialog with "NXOpen.NXException: Second parameter is invalid"
The log shows "+++ Cannot specify mask_triples if action is enable all"

So I tried this
Code:
selection0.GetProperties.SetSelectionFilter("SelectionFilter", Selection.SelectionAction.EnableAll, Nothing)

but the same error occurs.

NX10.0 Win8.1 64bit i7-3770K 16GB Quadro2000
 
CNZSU,

You have the parameters in SetSelectionFilter mixed up.

The second is SelectionAction but you have put the selectionFilter in there. You need to put EnableAll in the third parameter.

Paul

Paul Turner
CAD & Process Engineer
Mastip Technology
 
They're not mixed up, otherwise the code wouldn't even build in visual studio.

The strange thing is that all selection actions work, except EnableAll.

I could do selection0.ResetFilter() , and that will enable most of the object types, but not Sketch.

Here's the workaround:

Code:
Dim selectionfilter(0) As MaskTriple
selectionfilter(0).Type = NXOpen.UF.UFConstants.UF_sketch_type
selectionfilter(0).Subtype = NXOpen.UF.UFConstants.UF_all_subtype
selection0.ResetFilter()
selection0.SetSelectionFilter(SelectionAction.EnableSpecific, selectionfilter)

This will reset the selection filter (to enable most object types) and add the Sketch object type to the filter, which adequately solves my problem.

NX10.0 Win8.1 64bit i7-3770K 16GB QuadroK2200
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor