Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
Hi All,
I start learning Creo customization using Jlink.
I start learning with getting the name of the current model in session but it can't work.
here is mode code.
can somebody help me where am I making the mistake?
import com.ptc.cipjava.jxthrowable;
import com.ptc.pfc.pfcAsyncConnection.AsyncConnection;
import com.ptc.pfc.pfcAsyncConnection.pfcAsyncConnection;
import com.ptc.pfc.pfcModel.Model;
import com.ptc.pfc.pfcSession.Session;
public class AsyncTest {
AsyncConnection conn = null;
Session session = null;
Model model = null;
public static void main(String[] args) throws jxthrowable, Exception {
// TODO Auto-generated method stub
System.loadLibrary("pfcasyncmt");
AsyncTest tt = new AsyncTest();
tt.runCreo();
}
public void runCreo() throws jxthrowable {
try {
conn = pfcAsyncConnection.AsyncConnection_Connect(null, null, null, null);
Thread.sleep(5000);
session = conn.GetSession();
model = session.GetCurrentModel();
System.out.println(model.GetFileName());
conn.Disconnect(null);
} catch (Exception ex) {
System.out.println(ex.getMessage());
if (conn.IsRunning()) {
conn.Disconnect(null);
}
}
}
}
"conn.GetSession();" return 'Null' value.
I don't know why this happening.
Thanks in advance!!
try:
conn = pfcAsyncConnection.AsyncConnection_Connect("", "", "", 10);
if this still does not fix your issue, you may file a case.
