Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Exp formatting for String varibles

Status
Not open for further replies.

jclever20

Industrial
Jul 19, 2011
11
UG NX 5
Windows XP 64-Bit w/Excel 2007

I am importing .exp files into UG using a journal file to create a large amount of drawings. I have done this successfully with other product lines but now I need to import a few string variables into the model. The problem is, UG seems to be adding extra double quotes around my variable when it imports. In the .exp it looks like this:

(String) Part_Number="12500130"

However I get an error from UG like this:
"(String) Part_Number=""12500130"""

If I remove the double quotes from the .exp like so:
(String) Part_Number=12500130

Then UG will import the value as 12500130 just fine but being that there aren't and quotes around it, the value does not update in the drawing. Am I formatting something wrong in the .exp or is there some type of manipulation I can do once the value without quotes gets imported into my expressions?

Thank you,

Jake Clever
 
Replies continue below

Recommended for you

Why are you loading this string information into the Expression system? Why no create Part Attributes instead? They can also be linked to Notes on a drawing.

Also how do you know that the notes on your drawing which are linked to the expressions are NOT updating? Have you tried selecting...

Tools -> Update -> Update for External Change

...to force an update?

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.
 
John,

The journal loads a different .exp file for each of about 10,000 drawings. I load the dimensions this way so I thought it would be easier to just load my part number and type using the same exp file. The type is really the issue because it is letters like "STD", "BEVEL", and "SQB". In the expressions table, the formula column updates when I import without quotes but the value column does not because it needs quotes to be a string. I was able to import the 3rd atribute as a constant to solve part of my problem but the other 2 are still not working.

Thanks for your help,

Jake
 
Well I didn't use a journal, but if I MANUALLY import an .exp file containing expressions formated as follows...

(String) part_no="12345"

(String) part_name="test_part"


...I had not problems with them coming across as valid String Expressions.

Note that I tested this using NX 5.0.6.3

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.
 
There must just be something wrong with my syntax somewhere between the macro writing the .exp and the journal importing. This confirms that I can atleast import as strings using .exp's.

Thanks for your help John!

 
John,

I decided to try your manual method to import a string to start my troubleshooting. This is lies with the file format that I am using in excel. When I save my .exp I am using a Tab Delimited Text file format. However, this format does not like quotations. It adds additional quotations in a manner that matches the error I am getting in UG. Can you help me out by telling me how you are saving your .exps?

Thanks again!
 
Your original post didn't say anything about Excel files. Rather, you stated that you're importing files using the .exp file, which is a simple text file. Exactly what is your workflow?

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.
 
I appologize for not being more thorough. I have created a macro in VBA to create a large number of .exp files by bringing data in from a master data sheet containing all the dimensions, filenames, and materials for each part. I store these exp files in a folder that the journal in UG pulls from on each iteration of code. I can export an exp and then import it back in just fine. However, if I open that same exp file in excel and save it without any changes, it will not import. So I assumed I was saving the exp in the wrong text format.

I hope this helps,
Thanks John
 
This appears to be Excel behavior and as such I have no way of knowing how to change it. Perhaps someone could write some sort of script/macro which could export the data and then remove the redundant quotes (").

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.
 
That's what I thought as well but before I did that I went through to try each "text" file type I could and opened them in notepad to see the output. I found that saving as a Formatted Text (Space Delimited) .prn file type allowed me to keep the quote formatting the way I wanted. Now it imports strings and numbers perfectly.

Thanks again for your help,
Jake
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor