Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

import strings to expressions

Status
Not open for further replies.

runemark

Mechanical
Oct 3, 2010
16
0
0
GB
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
 
Replies continue below

Recommended for you

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.
 
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
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
 
Status
Not open for further replies.
Back
Top