×
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!
  • Students Click Here

*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.

Students Click Here

Jobs

Do/While statements not working in Modeling

Do/While statements not working in Modeling

Do/While statements not working in Modeling

(OP)
X-posted to GTAC Support Forums.

I have an automation I use very frequently. I have made no changes to it and have not updated NX, currently version 7.5. However now suddenly the program just cycles away and never achieves anything. I have managed to narrow down where the code is failing. This is a while statement I haven't changed since the first iteration of the program.

CODE --> VB

While Not line is Nothing If Len( Trim( line )) > 0 then Try strings = line.Split( vbTab ) pt1.x = Double.Parse( strings(0) ) pt1.y = Double.Parse( strings(1) ) pt1.z = Double.Parse( strings(2) ) Catch MessageBox.Show( "Spline data file " & strFile & " must be tab deliminted," & _ " and located in " & strDir, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error ) Exit Sub End Try '------------------------------------------------------------------------------------------ ' Create an array of points, each array value containing a single point '------------------------------------------------------------------------------------------ ReDim Preserve ArrayofPoints( count ) ArrayOfPoints( count ) = workPart.Points.createPoint(pt1) '------------------------------------------------------------------------------------------ ' Increase count value by 1, Read the next line of the file and continue While statement '------------------------------------------------------------------------------------------ count = count + 1 line = sr.ReadLine() End If End While
I have no idea why this is suddenly a problem, any help would be greatly appreciated.

UPDATE: I have tried multiple different Do / While Loops all of them just continue to run without ever accomplishing anything. While in Modeling this is a problem.

However things seem to work just fine if run in Drafting.

RE: Do/While statements not working in Modeling

(OP)
Solved, thanks

RE: Do/While statements not working in Modeling

And what was the solution?

"Wildfires are dangerous, hard to control, and economically catastrophic."

Ben Loosli

RE: Do/While statements not working in Modeling

(OP)
The readline is inside the If check. So when it ran across a blank line it never read the next line of the file.

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