Hi,
I have a question about selection of models with J-Link. I made a Part Properties query tool, which givesme a specific list of properties of the modelthat I pick with the mouse.
This works great when an assembly is loaded, but it doesn't work when there's just one model on the screen. In that case, I click on the part, but nothing happens. What I'd like is that when I start the J-Link tool, it determines whether there's an assy on the screen or just a single part. If it's an assembly, the user has to select the desired part. If there's just one model on the screen,J-Link should simply select that model and give me it's properties.
Does anyone know how to make that work in J-link??
Below is the code I use now for the selection.
Thanks!
Regards,
Jaap
private void partProp() {Thanks all for the advice. My code now works fine. here's the code:
private void partProp() {
Session session2 = null;
try {
session2 = pfcGlobal.GetProESession();
} catch (jxthrowable xx) {
UIHelper.showException(xx, "getting Pro/E session");
}
SelectionOptions sel_options;
Selection selektie;
Model model;
Model curModel;
ComponentPath modelPath;
intseq parentIds;
Assembly modelParent;
ComponentPath parentPath = null;
String modelParentString = ";
try {
File file = new File("C:\\local\\temp\\PartProp.txt");
if (file.exists()) {
file.delete();
}
int max = 1;
curModel = session2.GetCurrentModel();
ModelType t = curModel.GetDescr().GetType();
//staat er een assy open of alleen een model??
if (t.equals(ModelType.MDL_ASSEMBLY)){
sel_options = pfcSelect.SelectionOptions_Create("prt_or_asm");
sel_options.SetMaxNumSels(new Integer(max));
Selections selekties = session2.Select(sel_options, null);
selektie = selekties.get(0); //1e element selecteren
model = selektie.GetSelModel();
}else {
model = session2.GetCurrentModel();
}
Solid solid = (Solid) model;(etcetera)
regards,
Jaap