Hi wonderful NXJ community!
Could someone please tell me what is wrong with what I am doing. I am trying to select faces and return them as an array. It should be simple. I am migrating from "selectTaggedObject" which is a single face to "selectTaggedObjects" which is an array (right?)
My code is this
Public Function SelectFaces(ByVal propt As String) As Face() Dim title As String = "Select faces" Dim includeFeatures As Boolean = False Dim keepHighlighted As Boolean = False Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific Dim scope As Selection.SelectionScope = Selection.SelectionScope.AnyInAssembly Dim selectionMask(0) As Selection.MaskTriple Dim selectedFaces() As Face = Nothing With selectionMask(0) .Type = UFConstants.UF_solid_type .Subtype = 0 .SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_ANY_FACE End With Dim responce1 As Selection.Response = theUI.SelectionManager.SelectTaggedObjects( propt, title, scope, selAction, includeFeatures, keepHighlighted, selectionMask, selectedFaces) If responce1 = Selection.Response.Ok Then Return selectedFaces Else Return Nothing End If End Function
When debugging, this gives an error on the line with .selectTaggedObject( that says "Unable to cast object of type 'NXOpen.TaggedObject[]' to type 'NXOpen.Face[]'"
I don't understand. When I used the "selectTaggedObject" I passed in a variable of type Face for it to put what you selected into. Now i have a Face() and it should put all the faces you select into that array.
Am I missing something?
Pleeeeease help
PS. selectObjects says it has been superseded by selectTaggedObjects