×
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

NXOpen -- Stp214Importer Error

NXOpen -- Stp214Importer Error

NXOpen -- Stp214Importer Error

(OP)
Hello all,
I'm trying to write what I thought would be a quick and easy NXOpen program to batch STP->NX conversions. We wanted a few other things such as changing part and background color that the translation tool doesn't provide. I'm having quite an issue trying to use the NXOpen methods to convert these files though. Here's a snippet of code where the conversion is supposed to take place:

CODE --> C#

Session NXSession = Session.GetSession();

            foreach (string s in (e.Argument as ListBox).Items)
            {
                try
                {
                    Step214Importer STPImporter = NXSession.DexManager.CreateStep214Importer();
                    STPImporter.InputFile = s;
                    STPImporter.ImportTo = Step214Importer.ImportToOption.WorkPart;
                    STPImporter.ImportToTeamcenter = false;
                    STPImporter.LayerDefault = 1;
                    STPImporter.ObjectTypes.Curves = true;
                    STPImporter.ObjectTypes.Surfaces = true;
                    STPImporter.ObjectTypes.Solids = true;
                    STPImporter.ObjectTypes.Csys = true;
                    STPImporter.ObjectTypes.ProductData = true;
                    STPImporter.ObjectTypes.PmiData = true;
                    STPImporter.Optimize = true;
                    STPImporter.SettingsFile = @"C:\Program Files\Siemens\NX 9.0\step214ug\step214ug.def";
                    STPImporter.FileOpenFlag = false;
                    NXObject _object = STPImporter.Commit();
                    STPImporter.Destroy();
                }
                catch(Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            } 

Problem is, I'm not getting any output at all from the translator. Once the command window pops open, I'm greeted with the following message:

CODE -->

Error - Unhandled UG Exception caught.
With the following message <Internal error: memory access violation>.
Please reference syslog for more detailed information 

referring to the syslog, I see the section indicating my NXOpen program has begun, and the final message simply states that the translation has failed. I can easily convert models using the translator from the command line as well as from the NX GUI. Is this piece of NXOpen broken in my release(9.0.2)?

RE: NXOpen -- Stp214Importer Error

Quote (lharrison)

We wanted a few other things such as changing part and background color...

I'd suggest modifying the seed part settings; then any parts you convert will use your settings. The seed parts can be found in the {NX install directory}\STEP214UG folder:
  • step214ugnullnx90_in.prt
  • step214ugnullnx90_mm.prt

www.nxjournaling.com

RE: NXOpen -- Stp214Importer Error

(OP)
We've modified the seed parts, but I'm not sure how to go about setting the default color of the imported part. There aren't any bodies within the seed part, so nothing I can set the display properties on. The background color was easy though. I should also note the original question is part of a larger workflow for converting parts and setting some company standard settings, thus the reason I went towards NXOpen rather than the translator.

Bruce

RE: NXOpen -- Stp214Importer Error

In Preferences -> Object, you can set default colors for solid and sheet bodies, and other object types. I realize my previous answer (and this one so far) doesn't solve the overall problem, but I thought modifying the seed file would be useful for you. All your translations will use your preferred defaults, not just the ones handled through your converter code.

Back to the larger problem: the code snippet looks pretty good from what I can tell, but the error message is much too vague to be very useful. I'd start by double checking that the step files for processing and the settings file exist before starting the translation.

Also, the step214Importer has a .Validate method, you might try checking that before calling the .Commit method.

The code will try to import each step file into the current work part, is that intentional? or should each step file get imported into its own part?

www.nxjournaling.com

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