export spline data points to a file
export spline data points to a file
(OP)
I am currently working with UG NX 8.5 and I am trying to find out what is the best way or if there is any way where I can export spline data points to a file. I have a curve generated by offset the edge of a surface.
I would like to be able to either create points of the curve to a text file so that it can be formatted as x,y,z coordinates and import the information to MATLAB.
Anyone who has valuable advice would be much appreciated.
I would like to be able to either create points of the curve to a text file so that it can be formatted as x,y,z coordinates and import the information to MATLAB.
Anyone who has valuable advice would be much appreciated.





RE: export spline data points to a file
John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Digital Factory
Cypress, CA
Siemens PLM:
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
RE: export spline data points to a file
It is so nice of you sharing the file. I run it through "File/Execute/Grip" and selected "Pts_Along_Any_Curve_to_txt-file.grx". A window showed up a blank line where I typed in "test.txt", then a window with "Name =" showed up. I selected the spline needed, then click "Yes", left "Points" as "50", clicked "OK", "Finish Program" and I received an Error Message saying "Data file Saving Error! Program Terminating!"
I'd like to ask for your suggestion on it?
Thank you!
Arwen
RE: export spline data points to a file
CODE --> VB
Option Infer On Imports Snap, Snap.Create, Snap.UI, Snap.InfoWindow Imports System.Linq Public Class MyProgram Public Shared Sub Main() ' Create a selection dialog for selecting a spline Dim dialog = Selection.SelectObject("Please select a spline") dialog.SetCurveFilter(Snap.NX.ObjectTypes.Type.Spline) ' Display the dialog and get a result Dim result = dialog.Show() ' Loop to write the spline knot points to the Info window If result.Response <> Response.Cancel And result.Response <> Response.Back Then Dim mySpline As NX.Spline = result.Object For Each t As Double In mySpline.Knots.Distinct() Dim pt = mySpline.Position(t) ' Compute point at knot value WriteLine(pt) ' Write to Info window Next End If End Sub End ClassIt writes the point coordinates to the Info window, and you can then copy/paste into Matlab, Excel, or anywhere else.
This is very basic, and it could be modified in many ways. For example:
(1) It could output some user-specified number of points on the spline, not just the knot-points.
(2) It could call NX/Open functions, rather than SNAP functions.
(3) It could write the text to a file rather than the Info window.
(4) It could write the point coordinates in some other format.
If any of those improvements are important to you, the code will be eay to revise.
RE: export spline data points to a file
John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Digital Factory
Cypress, CA
Siemens PLM:
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
RE: export spline data points to a file
If i remember things correct, GRIP programs don't like spaces, nor "non-english" characters.
( GRIP is very old, still running,)
Regards,
Tomas
RE: export spline data points to a file
RE: export spline data points to a file
RE: export spline data points to a file
RE: export spline data points to a file
John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Digital Factory
Cypress, CA
Siemens PLM:
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
RE: export spline data points to a file
RE: export spline data points to a file
John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Digital Factory
Cypress, CA
Siemens PLM:
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
RE: export spline data points to a file
I opened the native program. I'd like to ask is it possible related to the administrator's access of my PC?
Again, appreciate your time and effort.
Thanks!
RE: export spline data points to a file
John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Digital Factory
Cypress, CA
Siemens PLM:
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
RE: export spline data points to a file