Array and Face Question
Array and Face Question
(OP)
I think this one is probably going to be a no brainer for someone out there but it has me stuck.
I have wave linked an array of faces and now I'm trying to convert them back to faces to be passed into later subroutines. So I'm converting the wave created face to extractFace (so far successful) then from ExtractFace to Face (and here lies the problem).
at the line:
[code]
finalFace(i) = ExtractedFaces(i).GetFaces
[/code vb]
I get the following error:
1-dimensional array of NXOpen.Face cannot be converted to NXOpen.Face
I'm sure the solution is simple, but I appreciate your time and help.
I have wave linked an array of faces and now I'm trying to convert them back to faces to be passed into later subroutines. So I'm converting the wave created face to extractFace (so far successful) then from ExtractFace to Face (and here lies the problem).
CODE --> vb
'------------------------------------------------------------------------------------------
' At this point the wavelinked-face will show up in the part navigator, but need to convert
' Xform to faces to pass back into the program to be used later
'------------------------------------------------------------------------------------------
dim extractedFaces(selectFaces.Length-1) As Features.ExtractFace
dim finalFace(selectFaces.Length-1) As Face
i = 0
For Each aFace2 As Face in SelectFaces
ExtractedFaces(i) = NXObjectManager.Get(returnFace(i))
i = i + 1
Next
i=0
For Each aFace3 As Face in SelectFaces
finalFace(i) = ExtractedFaces(i).GetFaces
i = i + 1
Next
Return finalFace at the line:
[code]
finalFace(i) = ExtractedFaces(i).GetFaces
[/code vb]
I get the following error:
1-dimensional array of NXOpen.Face cannot be converted to NXOpen.Face
I'm sure the solution is simple, but I appreciate your time and help.





RE: Array and Face Question
My current solution for the above problem is:
CODE --> vb
'------------------------------------------------------------------------------------------ ' At this point the wavelinked-faces will show up in the part navigator, but need to convert ' Xform to faces to pass back into the program to be used later '------------------------------------------------------------------------------------------ Dim extractedFaces(selectFaces.Length-1) As Features.ExtractFace Dim faceArrayTemp() As Face Dim finalFace() As Face Dim index As Long Dim lngPos As Long Dim lngUBoundSource As Long 'finalFace = Null i = 0 For Each aFace2 As NXOpen.Tag in returnFace ExtractedFaces(i) = NXObjectManager.Get(aFace2) i = i + 1 Next 'i=0 For Each aFace3 As Features.ExtractFace in ExtractedFaces ReDim faceArrayTemp( aFace3.GetFaces.Length-1) faceArrayTemp = aFace3.GetFaces() If finalFace is nothing Then ReDim finalFace( faceArrayTemp.Length-1) finalFace = faceArrayTemp Else lngPos = UBound(finalFace) lngUBoundSource = UBound(faceArrayTemp) 'Array.Resize( finalFace, finalFace.Length + faceArrayTemp.Length - 1) ReDim Preserve finalFace( 0 To UBound(finalFace)+UBound(faceArraytemp)-LBound(faceArrayTemp)+1) 'Array.Copy(faceArrayTemp, 0, finalFace, faceArrayTemp.Length-finalFace.Length, finalFace.Length ) index = 0 For index = lngPos To lngUBoundSource finalFace( index ) = faceArrayTemp(index - lngPos) Next End If 'i = i + 1 Next Return finalFaceI don't know if the values are being passed properly. The program attempts to place an intersection curve and if it fails changes an expression which moves the datum and tries again. The model has to be updated after the expression is changed for the datum to move. It seemed to be working before I added the previous code, now I get the following error:
NXOpen.NXException:Update undo happened.
The undo is set at the beginning of the program and the loop where the update takes places reads as follows:
CODE --> vb
While( boolMoldSurface = False ) boolMoldSurface = True boolMoldIntersection = True PlaceIntersection1( linkMoldFace, dPStation, moldInterLine, boolMoldIntersection ) If boolMoldIntersection = False Then expDatum = workPart.Expressions.FindObject("CheckDatum") intStation = intStation + 100 expDatum.RightHandSide = intStation 'theUFSession.Modl.Update() theSession.UpdateManager.DoUpdate(markId1) boolMoldSurface = False End If End WhileI have only found two ways to update and both generate the same error.
Any help would be greatly appreciated.
RE: Array and Face Question
However my problem with the wave length face continues to rear its ugly head.
When I use the above wave length code it works fine for a single face. However when I attempt to pass the new array of wave linked faces converted to faces back to the program and into a sub to create an intersection line on said faces, the dumb rule has an error.
I have run the intersection curve sub on an array of multiple faces that are work parts and it works fine. The wave link works so long as it is only a single face, but it is not working for the array of multiple wave linked faces.
So I believe the problem lies in where I am converting multiple wave linked faces to faces.
Any help is greatly appreciated.