Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Creating points from a text file

Xobi

New member
Does anyone know how to import a csv file or excel file to generate
points in NX2? The purpose would be to overlay the points as
inspection points and check the actual profile of a part against the
model.
 
<DIV>What type of part is it, how complicated is it and how many points do you have?</DIV>
<DIV></DIV>
<DIV>Larry</DIV>
 
Here is a GRIP program that will read in a .csv file and create points. You will need to compile and link the program. When you run the .grx file it will prompt you for a file to import. Enter the path\filename.csv


$$


$$ PROGRAM: FILE2POINTS.GRS


$$


$$ SYSTEM TYPE: ALL


$$


NUMBER/SRESP,PCNT,PC(3)


STRING/FNAMEX(80)


ENTITY/PNTS(1000)


DATA/FNAMEX,'POINTS.DAT'


$$


$$ ASK FOR FILENAME, MAKE SURE IT EXISTS:


$$


ST1:


TEXT/'FILENAME FOR POINT INPUT',FNAMEX,RESP,DEFLT


JUMP/STOP:,STOP:,RESP


IF/LENF(FNAMEX)==0,JUMP/ST1:


$$


FHREAD/FNAMEX,IFERR,FILERR:


JUMP/ST2:


FILERR:


MESSG/'FILE DOES NOT EXIST'


JUMP/ST1:


$$


$$ ASK FOR POINTS:


$$


ST2:


FETCH/TXT,2,FNAMEX,IFERR,NOFET:


RESET/2


PCNT=0


RLOOP:


READ/2,IFEND,EOF2:,PC


POINT/PC


PCNT=PCNT+1


JUMP/RLOOP:


$$


EOF2:


FTERM/TXT,2


MESSG/ISTR(PCNT)+' POINTS CREATED.'


JUMP/STOP:


$$


NOFET:


MESSG/'COULD NOT FETCH FILE'


JUMP/ST1:


STOP: HALT





Have fun
 
Hello Xobi,


U canuse this alternate method.


Open excel sheet, File->Save As...->select Formatted Text (Space Delimited) (*.prn) from the 'Save as type' drop down list.


Rename thefile just created,from xx.prn to xx.dat


In ug, Insert curve->spline->Through points->Points from file-> select the xx.dat file. spline is created based on the current wcs position.


Insert->Curve->Point Set...->Spline Defining Points->select the spline.


point set is created.


Delete the spline.
 

Sponsor

Articles From 3DCAD World

Back
Top