×
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

more journal help please

more journal help please

more journal help please

(OP)
Hi all,

Just getting into these journals and there's a standard one that seems to come with NX. It's file to points. Now i've been playing with it but not sure if it's possible.

To use the file the text needs to be:

0,0,0
1,0,0
1,1,0
0,1,0

this creates the corners of a box, however you can't use decimal places. Is there a way to edit the attached code to do this? I have text files that read:

-273.811432 3097.611816 -268.873260
-273.508575 3096.599121 -268.920746
-273.245361 3095.709717 -268.902283
-272.955902 3094.736816 -268.915466
-272.670044 3093.780273 -268.955780

etc. Can this could be edited to suit this type of thing?

Thanks in advance.

RE: more journal help please

The success of that particular journal will depend on the regional settings your computer uses. You should be able to check the regional settings somewhere in the control panel. Is your computer set to use something other than the decimal point (.) for the decimal symbol (a comma, perhaps)?

Try temporarily changing your regional settings to English(US) and run the journal again. If it works this time, we can modify the journal to accommodate your computer settings.

www.nxjournaling.com

RE: more journal help please

(OP)
Hi COWSKI, thanks for the advice. Just tried it on my laptop at home and it works fine. So it must be something to do with the settings on my PC at work.

Thanks for the advice

RE: more journal help please

Try this version, it should run correctly regardless of your computer's regional settings.

CODE

Imports System
Imports System.IO
Imports System.Windows.Forms
Imports NXOpen

Module Test

    Sub Main
	
	Dim USculture As system.globalization.CultureInfo = New System.Globalization.CultureInfo("en-US")
        Try
           Dim openFileDialog1 As New OpenFileDialog()
       
            openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
            openFileDialog1.FilterIndex = 1
            openFileDialog1.RestoreDirectory = True
       
            If openFileDialog1.ShowDialog() = DialogResult.OK Then
                Dim session As Session = Session.GetSession()
                Dim sr As StreamReader = new StreamReader(openFileDialog1.FileName)
                Dim line As String

                Try
                    line = sr.ReadLine()
                    While Not line is Nothing
                        Dim pt As Point3d
                        Dim delim As Char () = { ","C }
                        Dim strings As String () = line.Split(delim)
                        pt.x = Double.Parse(strings(0), USculture)
                        pt.y = Double.Parse(strings(1), USculture)
                        pt.z = Double.Parse(strings(2), USculture)
                        Dim p As Point
                        p = session.Parts.Work.Points.CreatePoint(pt)
                        p.SetVisibility(SmartObject.VisibilityOption.Visible)
                        line = sr.ReadLine()
                    End While
                Finally
                    sr.Close()
                End Try
            End If
        Catch E As Exception
            MessageBox.Show(E.Message)
        End Try
    End Sub
End Module 

www.nxjournaling.com

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