INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Array Question

Array Question

(OP)
I am attempting to put this code:

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

(OP)
Figured it out, it was the rules4 callout redefined it using itm2 for the size and it worked.

Thanks

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close