Cancel
Showing results for 
Search instead for 
Did you mean: 

Update Point From Spreadsheet

Builder
Builder

Dear All,

 

I have pionts in NX part and I want to link their x,y,z cordinates to the spreadsheet. It means whenever I change the excel they update automatically. Is there any suggestion using expressions os internal spreadsheets? I use NX 11

Sina shojaee
9 REPLIES

Re: Update Point From Spreadsheet

Valued Contributor
Valued Contributor

@sina wrote:

Dear All,

 

I have pionts in NX part and I want to link their x,y,z cordinates to the spreadsheet. It means whenever I change the excel they update automatically. Is there any suggestion using expressions os internal spreadsheets? I use NX 11


Hello Sina,

Did you find a solution?

Re: Update Point From Spreadsheet

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi,

Will it be ok for you to use UG_EXCEL_READ to link the co-ordinate values of the points with a spreadsheet value ?  I did it for an automated piping project (NX 5).

Regards

Kapil

Re: Update Point From Spreadsheet

Siemens Phenom Siemens Phenom
Siemens Phenom

You can also look into Knowledge Fusion for automating it .

Regards

Kapil

Re: Update Point From Spreadsheet

Valued Contributor
Valued Contributor

@kapilsharma wrote:

Hi,

Will it be ok for you to use UG_EXCEL_READ to link the co-ordinate values of the points with a spreadsheet value ?  I did it for an automated piping project (NX 5).

Regards

Kapil


Hi @kapilsharma,

Is it somehow possible to provide an example?

 

Thank you!

Danijel

Re: Update Point From Spreadsheet

Siemens Phenom Siemens Phenom
Siemens Phenom

danijelVR --

 

Here's an example that might be useful.

 

NX File (Saved in NX 9)
XLSX File
AVI File

 

It covers a bit more than you're asking for, I think, but might give you some interesting ideas.  :-)

 

This one uses ug_read_list() to collect ten 2D points from a spreadsheet (could easily be adapted to 3D, of course) and create points for them.  A sketch is then created referencing these points, and a solid is constructed from the sketch. 

 

The spreadsheet actually contains four different options for the Y coordinates, and the expression logic is set up to easily swap between these (or add additional sets, if desired.)

 

Option 1  Option 1  Option 1  Option 1

 

And then there's a Product Template interface on the model to allow REALLY simple swapping of the Y coordinates.  :-)

 

To try this, just save the files locally, open the PRT in NX, and edit the "point_data_spreadsheet" expression to point to the XLSX file.  Make sense?

 

I've added a movie, too, so you can see what to expect:

 

Any questions?

 

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Tel: +1 (602) 441-0683
taylor.anderson@siemens.com

Re: Update Point From Spreadsheet

Legend
Legend

Hi,

Very good example!

Would you please explain below expression and its formula?

 

Name: point01

Formula: Point(nth(1,points_X_coordinates),nth(1,points_Y_coordinates),0)

Re: Update Point From Spreadsheet

Siemens Phenom Siemens Phenom
Siemens Phenom

 

My pleasure. :-)

 

First, the expression is a "Point" expression, meaning that rather than holding a single number, it holds a 3D point coordinate location.  The most basic Point expression might have a formula that looks something like this:

 

point(1,2,3)

 

...indicating a 3D location with an X coordinate of 1, Y coordinate of 2, and z coordinate of 3. 

 

So far, so good?

 

Now...  in the expression you mention, there's one more interesting expression type at work.  In the middle of the formula, there are references to points_X_coordinates and points_Y_coordinates.  Each of these is a "List" expression.  Rather than holding a single number, a "List" expression can store a set of values.  (These might be numbers, strings, points, etc., or even other lists.)  Each of these expressions is using a function called ug_read_list() to pull a series of values from the Excel spreadsheet and populate the list expression.  If you look at the value of each of these expressions, they each look something like this:

 

{55,65,70,65,50,35,25,20,25,40}

 

Now, back to the Point expression "point01"...

 

The curve we're going to create from these points is planar and lies on the XY plane, so within the point() function, the Z coordinate of this point is just zero.

 

Point(nth(1,points_X_coordinates),nth(1,points_Y_coordinates),0)

 

That's the easy one.  :-)

 

This expression "point01" is the first of ten point expressions we're creating here.  As such, for the X coordinate, we want to pull the FIRST value out of the points_X_coordinates List expression.  We'll do that using a function called nth().  This function pulls the "N-th" value out of a list.  (fourth, fifth, twelfth, etc. or first, second, third, even though they don't actually end in -th.)   But this little expression:

 

nth(1,points_X_coordinates)

 

...is what makes that happen.  For reference, further down the expression list, we pull out the sixth value for the "point06" expression with the same method:

 

nth(6,points_X_coordinates)

 

And so then we do a similar thing for the Y coordinate:

 

nth(1,points_Y_coordinates)

 

...and then we insert each of those into the X and Y coordinate locations in the point() function and we end up with the final formula:

 

Point(nth(1,points_X_coordinates),nth(1,points_Y_coordinates),0)

 

Once the point expressions have been created, ten Point features were created referencing these ten Point expressions:

 

Making Points from Point Expressions

 

And the spline curve in Sketch(11) references these ten points.

 

See how that all works?  Pretty cool, huh?  :-)

 

Any more questions?

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Tel: +1 (602) 441-0683
taylor.anderson@siemens.com

Re: Update Point From Spreadsheet

Valued Contributor
Valued Contributor

@TaylorAnderson wrote:

danijelVR --

 

Here's an example that might be useful.

 

NX File (Saved in NX 9)
XLSX File
AVI File

 

It covers a bit more than you're asking for, I think, but might give you some interesting ideas.  :-)

 

This one uses ug_read_list() to collect ten 2D points from a spreadsheet (could easily be adapted to 3D, of course) and create points for them.  A sketch is then created referencing these points, and a solid is constructed from the sketch. 

 

The spreadsheet actually contains four different options for the Y coordinates, and the expression logic is set up to easily swap between these (or add additional sets, if desired.)

 

Option 1  Option 1  Option 1  Option 1

 

And then there's a Product Template interface on the model to allow REALLY simple swapping of the Y coordinates.  :-)

 

To try this, just save the files locally, open the PRT in NX, and edit the "point_data_spreadsheet" expression to point to the XLSX file.  Make sense?

 

I've added a movie, too, so you can see what to expect:

 

Any questions?

 


Hi @TaylorAnderson

This is very helpful! I will try to adapt it on my case and if I have some question, I will post it.

Thank you very much!

 

Danijel

Re: Update Point From Spreadsheet

Siemens Phenom Siemens Phenom
Siemens Phenom

 

I'm very much looking forward to it, Danijel. 

 

Thanks!

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Tel: +1 (602) 441-0683
taylor.anderson@siemens.com