Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hello,
I want to load a model with JLink with "The generic" or with an other instance (1). For this see load_modell.png. In addition (2) I want to get all instances of a model.
(1) Load of a model with "The generic" or with an other instance:
My JLink program for this problem:
public class JlinkPrototype { public static void main(String[] args) { AsyncConnection connection; Session currSession; ModelDescriptor proeModelDescriptor = null; Model proeModel = null; String proe = "C:/Program Files/PTC/Creo 4.0/F000/Parametric/bin/parametric.exe"; // proe = proe + " -g:no_graphics -i:rpc_input"; try { System.loadLibrary("pfcasyncmt"); connection = pfcAsyncConnection.AsyncConnection_Start(proe, null); currSession = connection.GetSession(); String modellName = "MY_MODEL"; String instance = "MY_INSTANCE_01"; // instance = null; proeModelDescriptor = pfcModel.ModelDescriptor_Create(ModelType.MDL_PART, instance, modellName); currSession.ChangeDirectory("C:/tmp/test_part_family_tables"); proeModel = currSession.RetrieveModel(proeModelDescriptor); proeModel.Display(); // connection.End(); } catch (Throwable x) { x.printStackTrace(); } } }
When I load the model with "The generic" I set variable instance=null.
When I load the model with an instance I set variable e.g. instance="MY_INSTANCE_01".
In my opinion this works fine.
(2) Now I want to get all instances of my model. When I load my model in Pro/E-GUI manually with instance "The generic", I can get all variants using tools-->Family Tables (see load_generic_gui.png).
I think, I can get from this so loaded model all variants wirh JLink.
Now I load my model with my JLink programm. For this I set the variable instance=null. Unfortunately now the menu Tools -> Family table is deactivated (see load_generic_jlink.png), so I do not get the listed instances.
So my question: How can I get all instances of my model with JLink?
Thanks in advance for your tips
Thomas
Solved! Go to Solution.
Even if tools -> family table is disabled, I can find all instances with:
... proeModelDescriptor = pfcModel.ModelDescriptor_Create(ModelType.MDL_PART, null, modellName); ...
FamilyMember familyMember = (Solid) proeModel;
FamilyTableRows familyTableRows = familyMember.ListRows(); for (int ii = 0; ii < familyTableRows.getarraysize(); ii++) { FamilyTableRow familyTableRow = familyTableRows.get(ii); String instanceName = familyTableRow.GetInstanceName(); System.out.println("instanceName = " + instanceName);
} ...
Even if tools -> family table is disabled, I can find all instances with:
... proeModelDescriptor = pfcModel.ModelDescriptor_Create(ModelType.MDL_PART, null, modellName); ...
FamilyMember familyMember = (Solid) proeModel;
FamilyTableRows familyTableRows = familyMember.ListRows(); for (int ii = 0; ii < familyTableRows.getarraysize(); ii++) { FamilyTableRow familyTableRow = familyTableRows.get(ii); String instanceName = familyTableRow.GetInstanceName(); System.out.println("instanceName = " + instanceName);
} ...
Hello...
how can I implement the code to save all prt instances?
Thankful..