×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

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!

*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

Advice on a strategy to get expression data into and out of a spreadsheet

Advice on a strategy to get expression data into and out of a spreadsheet

Advice on a strategy to get expression data into and out of a spreadsheet

(OP)
NX version 1973, integrated with TC.

I'm hoping someone can point me in the right direction. I'm pretty new to NX so there may be some fundamental misunderstandings about how things work here, but I hope this is clear enough:

Part setup:

-- DatumCSYS at part absolute origin, that stays fixed.

-- Multiple other DatumCSYS whose position is defined via "Offset CSYS" from the absolute origin DatumCSYS via expressions. When the expression editor is opened, it contains a list of expressions along the lines of:

CODE -->

datumcsys_1_x = <value>
datumcsys_1_y = <value>
datumcsys_1_z = <value>
datumcsys_1_angle1 = <value>
datumcsys_1_angle2 = <value>
datumcsys_1_angle3 = <value>
datumcsys_2_x = <value>
... 


Desired functionality:

-- The various non-absolute-origin DatumCSYS can be moved around via dynamic positioning (i.e. with the mouse and handles). When they are moved, the expressions in the expression editor update to reflect the new offset values.

-- These expressions and their values can be written to an Excel file in Teamcenter.

-- The Excel file can be manually edited and these new values can then be assigned to the expressions, resulting in the various DatumCSYS moving to new locations.

I hope that's clear enough.

My work so far, covering possible approaches:

1) I've looked into using ug_cell_read() when entering the translation/rotation values for each DatumCSYS. I see that from there, I can specify an Excel spreadsheet in Teamcenter. This gives me the impression that I can only read data from the Excel file, but not move the DatumCSYS dynamically and then write out the new data to that Excel file.

2) I have also looked at the Spreadsheet functionality. I suspect this might be closer to what I want. But I am still trying to learn if the spreadsheet can be accessed as a stand-alone file (without doing a Save Copy As), and I don't think it can. I'd like to avoid things like copy-pasting into and out of the Spreadsheet window.

3) A third option (and honestly it's looking like I might go this route, because it is the simplest) is to give up on the spreadsheet idea altogether, and just use the Import Expressions/Export Expressions to save and load text files containing expressions and their values. I can always write a glue script to move these to and from whatever Excel file I am working with. With this approach, the only thing to determine is if I can indeed move the various DatumCSYS dynamically and have the expressions update with new values. I think this is the case.

Thoughts and suggestions appreciated!

RE: Advice on a strategy to get expression data into and out of a spreadsheet

I also think third option is most suitable for your requirement.

RE: Advice on a strategy to get expression data into and out of a spreadsheet

I recently started importing and exporting expressions. Indeed it is a royal drag that the format of these files is not spreadsheet-friendly.

However, it may be simpler to parse an expressions file using VBA to make an Excel-compatible format than to export directly to Excel.

RE: Advice on a strategy to get expression data into and out of a spreadsheet

(OP)
Thank you for these suggestions.

It sounds like option 3 is the way to go.

If anyone else has any input, feel free to add it.

RE: Advice on a strategy to get expression data into and out of a spreadsheet

(OP)
I guess this leads to a second question:

Is my assumption that I can dynamically move a DatumCSYS that has been defined via OffsetCSYS wrong?

RE: Advice on a strategy to get expression data into and out of a spreadsheet

Quote (please_dont_crash)

Is my assumption that I can dynamically move a DatumCSYS that has been defined via OffsetCSYS wrong?

Yes and no. You cannot move it dynamically while it is set to "offset"; in this case you would have to edit the offset values in the dialog. Alternately, you could change the type to "dynamic", move it where you want, and reset it to "offset". The offset values should update to the new location.

www.nxjournaling.com

RE: Advice on a strategy to get expression data into and out of a spreadsheet

(OP)
Thanks cowski! Hadn't thought of the second approach, and it works great!!

RE: Advice on a strategy to get expression data into and out of a spreadsheet

(OP)
Actually, looks like I spoke too soon.

My goal is to move a DatumCSYS that has been defined via Offset CSYS using expressions, not fixed values. Changing the type to Dynamic, moving the DatumCSYS using the handles, and changing back to OffsetCSYS turns the offset quantities into fixed values, breaking the link with the expression.

I have a feeling the only way to move the DatumCSYS and update the expression value is to edit the expression value. There is probably no way to use the Dynamic handles as a driver for expression quantities, while retaining the ability to use the expressions to also drive the position of the DatumCSYS.



RE: Advice on a strategy to get expression data into and out of a spreadsheet

You have the ability to save the WCS and then select it the next time you need to utilize it.
Menu -> Format -> WCS - Save

Jerry J.
UGV5-NX1961

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! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close