×
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

import .xls file, points

import .xls file, points

import .xls file, points

(OP)
Hi,

How can I import an .xls file, I want to create a point cloud surface.

I have donde this with .dat files is there another way?

Thanks.

RE: import .xls file, points

Unless you write your own application (or get something from someone who has) there is no direct way of reading an Excel file into NX and creating points from X,Y,Z data in the spreadsheet.

However, once the next version of NX is released there will be a function which will, for all intents and purposes, allow you to do just that.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
http://www.siemens.com/plm
http://www.plmworld.org/museum/

To an Engineer, the glass is twice as big as it needs to be.
 

RE: import .xls file, points

Hi guys,

Can anyone load this macro or journal,(program)

for importing .XLS points to NX.

It can be a great help...

Thanks.

RE: import .xls file, points

Attached is a VB journal which allows you to read in excel (.xlsx) data into a windows datagrid.  Use the Browse button to select a Excel file.  The file name is placed into the text box.  Once a file is selected use the Import button to read the excel data.  I have assumed that row 1 contains column headings.

Remember this is just a demo.  It is of course possible to use data directly.

Hope this helps.

Frank Swinkels

RE: import .xls file, points

Please save your excel file to Office 2008 format.  I only have Office 2008 and there is a difference in the vb code for different database versions.

Frank Swinkels

RE: import .xls file, points

I found a further error in when I was testing my program I used a sample excel file which I thought was Office 2008 when in fact it was Excel 97-2003 workbook.  In fact I have not been able to run it with other than this format.  I have attached a new journal file which should work wit Excel 97-2003 format.

Sorry about the error.

Frank Swinkels

RE: import .xls file, points

(OP)
Hi Frank,

I have tested it with Excel 2010, I can find the .xls file but I can't read it. Can be office version problem?

Can you send me and example of an .xls file tested by you?

I don't know what I am doing wrong...

Sorry,

Thanks all.

RE: import .xls file, points

Let me see if I can explain.

The following .NET libraries are supported by journaling:

mscorlib.dll

System.dll

System.Windows.Forms.dll

System.Drawing.dll

To access excel workbooks System.dll has a data class.OleDb which has a method OleDbConnection.

Unfortunately this method can only open excel spreadsheets to Excel 97-2003 format.

To read later spreadsheets we need to use the Microsoft library.  Specifically Microsoft.Office.Interop.  With this we can read 2010 spreadsheets.

To summerize we can use journals to read  spreadsheets up to Excel 97-2003 format.  To read later format spreadsheets we cannot use a journal.  We can build the source code as an executable (.exe or .dll) to read the later formats.

Frank Swinkels

RE: import .xls file, points

(OP)
Ok FranK it works,

thanks for the .xls example.

I have to know ho to insert this points on NX .prt part.

Regards,

RE: import .xls file, points

I have added the create points in the journal in the attached zip file.  As before I have renamed the .vb file to a .txt file.  Just rename it back.  It works for the previously supplied data2.xls.  To use for other data it needs to be in the same format i.e. row 1 must have the heading "xvalues" (in A1), "yvalues" (in B1) and "zvalues" (in C1).  Alternatively you would need to reprogram the appropriate lines of code (to use your own column names). Also I have assumed Sheet1 as the sheet name.

Hope this helps further.

Regards

Frank Swinkels

RE: import .xls file, points

I simply added the points creation to the import buttom (remember this is purely an example).  I have created an additional journal file (in ReadExcelData3.zip).  This time the apply points button creates the points and exits the journal.  Now obviously the program can be much improved on.  For example it would not be necessary to display the data grid.  We could simply ask for the data file using a windows dialog.  Then an apply button would create the points and ask for another data file.  A cancel button would not create any points and an OK button would create the points and exit the program.  Other options such as layer control etc can be included on a dialog.

As before I have renamed the vb file to a txt file.  Just rename it back to .vb to run the journal.

Regards

Frank Swinkels

RE: import .xls file, points

(OP)
Hi Frank,

Yes, I was looking for this VB.

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