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:
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:
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)?
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
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:
www.nxjournaling.com
RE: NXOpen -- Stp214Importer Error
Bruce
RE: NXOpen -- Stp214Importer Error
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