cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

JLink: Creo 3: M150: RetrieveSymbolDefinition fails to load sym file located in user's ptc/creo3 dir

JohnU-PNSR
4-Participant

JLink: Creo 3: M150: RetrieveSymbolDefinition fails to load sym file located in user's ptc/creo3 dir

Hello;

I am writing a Jlink app for our ME team to place informational custom (aka User) symbols on Drawing2Ds.

The app jarfile  and the symbol file are both installed into the users ptc/creo3/ directory:

 

Directory of C:\Users\bob.smith\ptc\creo3
05/07/2020 11:18 AM <DIR> .
05/07/2020 11:18 AM <DIR> ..
04/01/2020 04:46 PM 27 config.pro
05/07/2020 11:20 AM 14,559 autoplacer.jar
05/06/2020 10:24 AM 4,343 autoplace_test.sym

 

the code in the jar file uses RetrieveSymbolDefinition() to load the DetailSymbolDefItm

DetailSymbolDefItem DefItm =
prts_dwg.RetrieveSymbolDefinition("autoplace_test", null, null, null);

 

The good news is that it finds the symfile.

The bad news is that it fails to load it and tosses an XToolkitFound exception.

 

The stack looks like this:

C:\Users\john.utz\ptc\creo3>more pst.txt
com.ptc.pfc.Implementation.pfcExceptions$XToolkitFound
at com.ptc.pfc.Implementation.PFCRemoteCommImpl.makeObject(PFCRemoteCommImpl.java:2144)
at com.ptc.cipjava.NativeTransport.recvObject(NativeTransport.java:115)
at com.ptc.cipjava.CIPRemoteComm.processMessages(CIPRemoteComm.java:153)
at com.ptc.pfc.Implementation.pfcDrawing$Drawing.RetrieveSymbolDefinition(pfcDrawing.java:712)
at bobco.me.dimid.WorkerAutoPlacer.SymbolCreate(WorkerAutoPlacer.java:604)
 
What does it mean when a symbol file can be found and opened but the underlying stack can not complete the task? Can somebody explain this to me?
 
Tnx!
johnu

 

1 ACCEPTED SOLUTION

Accepted Solutions

Ok! I'll try that. Your reasoning makes perfect sense. I will report back on how it goes.

View solution in original post

5 REPLIES 5

FilePath

The path to the symbol definition file, relative to the configuration option pro_symbol_dir. null indicates that the function should search the system symbol definition directory instead.

 

Option pro_symbol_dir in config.pro file point Creo to the folder with symbols. I think, you must copy symbol file to this folder.

Hi Moonstone!

Thankyou so much for your thoughtful response and reasonable hypothesis.

However, the exception thrown is not the one that says it cant find the file, it's the one that says it was found and a loading was attempted and something went wrong.

 

Here is the pertinent part of the stack trace again:

 

com.ptc.pfc.Implementation.pfcExceptions$XToolkitFound

at com.ptc.pfc.Implementation.PFCRemoteCommImpl.makeObject(PFCRemoteCommImpl.java:2144)

at com.ptc.cipjava.NativeTransport.recvObject(NativeTransport.java:115)

at com.ptc.cipjava.CIPRemoteComm.processMessages(CIPRemoteComm.java:153)
at com.ptc.pfc.Implementation.pfcDrawing$Drawing.RetrieveSymbolDefinition(pfcDrawing.java:712)

 

Here is what the api docs say about it:

Class XToolkitFound

package com.ptc.pfc.pfcExceptions;


public class XToolkitFound
  extends com.ptc.pfc.pfcExceptions.XToolkitError
Description
This exception is thrown when there is an error of type PRO_TK_E_FOUND in a Creo Parametric TOOLKIT function called by PFC.

 

Now that you have seen this, do you have any other thoughts? Or do you think that Creo found it, loaded it and then tossed the error because it didnt like where it found the *.sym file?

 

Tnx!

johnu

Try to set last argument in method

UpdateUnconditionally

true if Creo Parametric should update existing instances of this symbol definition, false if the operation should fail if the definition already exists in the model.

DetailSymbolDefItem DefItm =
prts_dwg.RetrieveSymbolDefinition("autoplace_test", null, null, true);

 

In this case symbol instance will be replaced, if it was loaded in drawing early.

Ok! I'll try that. Your reasoning makes perfect sense. I will report back on how it goes.

JohnU-PNSR
4-Participant
(To:JohnU-PNSR)

FIXED IT! THANKYOU SO VERY MUCH!!!

Top Tags