Using JLink to change view2D Simplified Representation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Using JLink to change view2D Simplified Representation.
Hi, I'm trying to parse drawing files for a laser cutting machine and change the simplified representation for bent parts using Jlink. What am I doing wrong? I tried solid.Display(), drawing.display(),
manually adding simpRep before view.SetSimpRep() with drawing.AddSimpRep(). Here is my code:
Drawing drawing = (Drawing) window.GetModel();
WView2D view2D = (WView2D) drawing.List2DViews().get(0);
Solid solid = (Solid) drawing.ListModels().get(0);
ModelItems modelItems = solid.ListItems(ModelItemType.ITEM_SIMPREP);
if (modelItems != null) {
for (int i=0; i < modelItems.getarraysize(); i++) {
if (modelItems.get(i).GetName().endsWith("FLAT_REP")) {
SimpRep simpRep = (SimpRep) modelItems.get(i);
logMessage(simpRep.GetName());
//drawing.AddSimplifiedRep(simpRep);
//drawing.DeleteSimplifiedRep(simpRep);
SimpReps simpReps = drawing.ListSimplifiedReps(solid);
for (int k=0; k<simpReps.getarraysize(); k++) {
logMessage("REPs " + simpReps.get(k).GetName());
}
logMessage("Current View SimpRep Name " + view2D.GetSimpRep().GetName());
view2D.SetSimpRep(simpRep);
logMessage("Changed SimpRep Name " + view2D.GetSimpRep().GetName());
break;
}
}
}
it throws exception at
view2D.SetSimpRep(simpRep);
Exception Message:
Exception occurred:
com.ptc.wfc.Implementation.pfcExceptions$XToolkitBadInputs
at com.ptc.wfc.Implementation.WFCRemoteCommImpl.makeObject(WFCRemoteCommImpl.java:5447)
at com.ptc.cipjava.NativeTransport.recvObject(NativeTransport.java:122)
at com.ptc.cipjava.CIPRemoteComm.processMessages(CIPRemoteComm.java:153)
at com.ptc.wfc.Implementation.wfcView2D$WView2D.SetSimpRep(wfcView2D.java:2027)
at DrwManager.viewTestings(DrwManager.java:435)
at CreoUITraining$CommitClosePushButtonListener.OnActivate(CreoUITraining.java:153)
at com.ptc.wfc.Implementation.WFCRemoteCommImpl.dispatch(WFCRemoteCommImpl.java:2758)
at com.ptc.cipjava.CIPRemoteComm.processMessages(CIPRemoteComm.java:116)
at com.ptc.uifc.uifcComponent.uifcComponent.ActivateDialog(uifcComponent.java:43)
at CreoUITraining.CreoUITraining_main(CreoUITraining.java:204)
at UITraining.<init>(UITraining.java:16)
at MenuButtonListener.OnCommand(StartUITraining.java:61)
at com.ptc.wfc.Implementation.WFCRemoteCommImpl.dispatch(WFCRemoteCommImpl.java:414)
at com.ptc.cipjava.CIPRemoteComm.processMessages(CIPRemoteComm.java:116)
at com.ptc.wfc.Implementation.WfcStarter.serverLoop(WfcStarter.java:61)
at com.ptc.wfc.Implementation.WfcStarter.main(WfcStarter.java:39)
- Labels:
-
Jlink
-
ProToolkit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Do you have license for wfc ?
SetSimpRep is part of the wfc package and not free pfc package
this may be issue (I have no experience with wfc)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yes. I tested some wfc functions before, like WWindow.Refit()
