I want to use a selection manager similar to the one described in the "Beginner Selections" tutorial however, I need the output from the code to be a "Point3d" object rather than "NXObject" which is currently being output. Does anyone know how to use the selection manager to only select points and output a point object? I've tried changing the "ByRel selObj as NXObject" to "Point3d" however, this doesn't seem to work.
Any help is appreciated! See Function below:
Function SelectAnObject(prompt As String, _
ByRef selObj As NXObject) As Selection.Response
Dim theUI As UI = UI.GetUI
Dim cursor As Point3d
Dim typeArray() As Selection.SelectionType = _
{Selection.SelectionType.All, _
Selection.SelectionType.Faces, _
Selection.SelectionType.Edges, _
Selection.SelectionType.Features}
Dim resp As Selection.Response = theUI.SelectionManager.SelectObject( _
prompt, "Selection", _
Selection.SelectionScope.AnyInAssembly, _
False, typeArray, selObj, cursor)
If resp = Selection.Response.ObjectSelected Or _
resp = Selection.Response.ObjectSelectedByName Then
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If
End Function
re: Point3d from Point object
You cannot select a Point3d, it is not something that shows up in the graphics window. A Point3d is a data structure that holds information about a point.
If you have a reference to a point object (the points that you select on screen), you can get a Point3d structure from the object. The point object has a .Coordinates property that will return a Point3d structure with the coordinates of the point object.
Dim somePoint3d as Point3d = myPointObject.Coordinates