Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! 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.