Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Journal: get selected components?

Status
Not open for further replies.

CNSZU

Mechanical
Joined
Sep 2, 2005
Messages
318
Location
TW
Hello all,

Is there a way to get a list of all currently selected components? I do not want a dialog or other interface asking the user to first select components like this:

Dim resp As Selection.Response = theUI.SelectionManager.SelectObject(prompt, "Selection", Selection.SelectionScope.AnyInAssembly, False, typeArray, selObj, cursor)

Instead, I want the code to immediately act upon components that are already selected. I couldn't find any information on this. Does anyone have a solution?

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000
 
Thanks, preselect was the keyword.

However, now I've run into another problem: how do I deselect the components? As far as I know you can remove the highlight of the components in the graphics window (comp.Unhighlight()), but this will not actually deselect the components. They will still be selected, as can be seen in the Assembly navigator, and any action performed will affect these components.

Doing a partCleanup1.DoCleanup() also won't deselect components.

I guess the correct way is with sel.RemoveFromSelectionList(), but you need a selection handle and I've no idea how to obtain this.

The only thing I could think of is to do a hack: sending an ESC key to the ugraf process with

If Process.GetProcessesByName("ugraf").Length >= 1 Then
For Each ObjProcess As Process In Process.GetProcessesByName("ugraf")
AppActivate(ObjProcess.Id)
SendKeys.SendWait(Keys.ESC)
Next
End If

but nothing happens. Any suggestions for deselecting components?

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top