J-Link: can not open a model with more than 29 characters in modelName in CREO8 and CREO9
Hello,
I use J-Link, the Java language toolkit for PTC Creo Parametric.
In my test directory C:/test_dir are a model with root(master) assembly file 123456789012345678901234567890.asm.1 and related child files (other assemblies, parts, ...).
To open a model file I use the following Java code:
...
BaseSession session = connection.GetSession();
...
String modelName = "123456789012345678901234567890";
ModelType modelType = ModelType.MDL_ASSEMBLY;
String instance = null;
String dirName = "C:/test_dir";
Model model = null;
ModelDescriptor proeModelDescriptor = null;
try {
proeModelDescriptor = pfcModel.ModelDescriptor_Create(modelType, instance, modelName);
session.ChangeDirectory(dirName);
model = session.RetrieveModel(proeModelDescriptor);
model.Display();
} catch (jxthrowable jxt) {
String errorMessage = MessageFormat.format("Cannot open model ''{0}''. jxt = ''{1}''", modelName, jxt.toString()));
}
This code works fine for CREO version 1 to CREO version 7.
But for CREO version 8 and CREO version 9 the call of
model = session.RetrieveModel(proeModelDescriptor);
produces the following error message
Cannot open model \'123456789012345678901234567890\'. jxt = \'com.ptc.pfc.Implementation.pfcExceptions$XToolkitInvalidName
When I change the model assembly file to 12345678901234567890123456789.asm.1 and modelName to "12345678901234567890123456789" the code works.
Thats means I can open models with a modeName of max. 29 characters and I can not open models with a modeName of 30 or more characters.
Note: I can succesfull open the model in GUI CREO version 8 and CREO version 9 manually.
My customers have models with 30 or more characters in the modelName.
In Creo version <= 7 I can open models with 30 or more characters in the modelName.
What can I do to open models with a modeName of 30 or more characters in CREO version 8 and CREO version 9?
Thank you for your hints Thomas

