×
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 strings to expressions

import strings to expressions

import strings to expressions

(OP)
Hello!
I´m using expressions to build some of my models and I am struggling to import "string-parameters"

I am using excel to store and export my formulas and values.

I am trying to create and import the formula TH02 = "M20 x 2.5", when I´m trying to import the formula it looks like this:
[]TH02="M20 x 2.5"// and I get the error-statement:
Errors importing expressions into part RRM200023478/A
[]TH02="M20 x        2.5"//                                                                                                                
 - Datatype error

I am using Nx6

Best regards
/Martin

RE: import strings to expressions

As an aside I would recommend that you use more descriptive variable names. TH02 may be completely clear to anyone in you organization but it doesn't look so to me. We had a productivity kit made for one of our divisions by an outside service company that named our variables h1, h2... l1, l2... etc. this has caused some trouble with users trying to figure out the scheme. In my opinion it is worth the time to develop long descriptive sortable names.

Unfortunately I cannot offer any help with your core trouble I do not interface with outside applications to manage my expressions. It sounds to me like you have not established TH02 as a string variable.

RE: import strings to expressions

Don't forget to specify what version of NX you are on.

RE: import strings to expressions

How are you 'importing' the string into the Expression system?  Are you using the spreadsheet function commands found under the f(x) icon?

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
http://www.siemens.com/plm
UG/NX Museum:   http://www.plmworld.org/p/cm/ld/fid=209

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

RE: import strings to expressions

You state that you're attempting to import the formula TH02 = "M20 x 2.5".  Note that you can only import the value portion of an expression (i.e. the right-side of the equal sign).

See the attached example files (an NX 6.0 part file and an Excel file) for an example of how this works.

After loading these files on your system you will need to open the NX part file and in the expression dialog you will need to edit the path portion of the expression so that it matches the path to your spreadsheet file on YOUR system.  For example, in my file the expression 'THO2' has a value of:

ug_cell_read( "D:\User_files\NX_6_Demo\Test_exp.xlsx", "B4" )

You will need to change the underlined portion of this expression to reflect the path where the Excel is located on your system in order for this to work.

Anyway, give this a try and see if it does what you need.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
http://www.siemens.com/plm
UG/NX Museum:   http://www.plmworld.org/p/cm/ld/fid=209

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

RE: import strings to expressions

(OP)
Hi!

I used this: (String)TH02="M20 x 2.5"
instead of: []TH02="M20 x 2.5"//

and it worked fine smile

 

RE: import strings to expressions

(OP)

Thanks for your support.
 

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