Array Question
Array Question
(OP)
I am attempting to put this code:
Into an loop using arrays, to allow for different sized arrays, or number of faces to be passed. So far it looks like thise:
When itm2 is 0 it works fine, but on any other value it fails. I do not want faces1 to increment I want it to over write every time but I get the following error when I attempt to run the program:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
Checkface is a passed array in tests it contains 3 faces.
faces1(0) is defined as "Dim faces1(0) As Face"
This is code that is intended to be run in Unigraphics environment, but I think the problem is in the VB and not the UG specific code.
any help is appreciated.
CODE --> vb
faces2(0) = face1 faceDumbRule2 = workPart.ScRuleFactory.CreateRuleFaceDumb(faces2) faces3(0) = face3 faceDumbRule3 = workPart.ScRuleFactory.CreateRuleFaceDumb(faces3) rules4(0) = faceDumbRule2 rules4(1) = faceDumbRule3
Into an loop using arrays, to allow for different sized arrays, or number of faces to be passed. So far it looks like thise:
CODE --> vb
itm2 = checkFace.Length - 1 msgbox("array length determined") For itm1 = 0 To itm2 msgbox("itm1" & itm1 ) faces1(0) = checkFace(itm1) msgbox("checking face " & itm1 ) faceDumbRule1 = workPart.scRuleFactory.CreateRuleFaceDumb(faces1) rules4(itm1) = faceDumbRule1 Next itm1
When itm2 is 0 it works fine, but on any other value it fails. I do not want faces1 to increment I want it to over write every time but I get the following error when I attempt to run the program:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
Checkface is a passed array in tests it contains 3 faces.
faces1(0) is defined as "Dim faces1(0) As Face"
This is code that is intended to be run in Unigraphics environment, but I think the problem is in the VB and not the UG specific code.
any help is appreciated.
RE: Array Question
Thanks