Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
no response when i click home -> utilities -> axuiliary application . and button is grey. I'm sure I followed the documentation.
Solved! Go to Solution.
Hi,
my last reply follows ...
Your code works well on my PC.
I am able to reproduce com.ptc.pfc.Implementation.pfcExceptions$XToolkitGeneralError exception.
This exception appears when drawing file -OR- drawing model is not accessible.
Example:
I created model a4.prt and its drawing a4.drw and saved them into working directory.
I modified following line in your code:
String drw_name = "Asm0001.drw"; >>>>> String drw_name = "a4.drw";
When I started ProE and set working directory to see a4.prt and a4.drw, the application worked well.
When I renamed a4.prt to za4.prt -OR- a4.drw to za4.drw, then I got exception.
Please check if ProE can see Asm0001.drw and drawing model.
i'm follow jlinkug.pdf to set env. i really can't get more info.
i got diff trail info when i use diff method.
1.
RetrieveModelWithOpts
!trail file version No. 1450 !Pro/ENGINEER TM 5.0 (c) 1988-2002 by Wisdom Systems All Rights Reserved. < 0 1.615407 1689 0 0 1363 1920 0 0 1440 13 !mem_use INCREASE Blocks 211690, AppSize 33503698, SysSize 41067456 < 0 1.454000 1454 0 0 1227 1920 0 0 1440 13 < 0 1.309000 1309 0 0 1227 1920 0 0 1440 13 < 0 1.309000 1309 0 0 1226 1920 0 0 1440 13 !%CI欢迎使用 Creo Elements/Pro 5.0。 !Application (exportTest): started via registry. ! type: synchronous J-Link < 0 1.311000 1311 0 0 1226 1920 0 0 1440 13 < 0 1.324000 1324 0 0 1226 1920 0 0 1440 13 ~ Close `main_dlg_cur` `main_dlg_cur` !Command ProCmdOSExit was pushed from the software. ! Message Dialog: Warning ! : Creo Elements/Pro 将终止,并且所有未保存的工作将会丢失。 ! : 您确实要退出吗? ~ FocusIn `UI Message Dialog` `no` ~ FocusIn `UI Message Dialog` `yes` ~ Activate `UI Message Dialog` `yes` !End of Trail File
2.
RetrieveModel
trail file version No. 1450 !Pro/ENGINEER TM 5.0 (c) 1988-2002 by Wisdom Systems All Rights Reserved. < 0 1.615407 1689 0 0 1363 1920 0 0 1440 13 !mem_use INCREASE Blocks 211689, AppSize 33503682, SysSize 41067456 < 0 1.454000 1454 0 0 1227 1920 0 0 1440 13 < 0 1.309000 1309 0 0 1227 1920 0 0 1440 13 < 0 1.309000 1309 0 0 1226 1920 0 0 1440 13 !%CI欢迎使用 Creo Elements/Pro 5.0。 !18-Dec-17 18:01:21 Start C:\USERS\HU\DESKTOP\asm0001.drw !%CE'C:\USERS\HU\DESKTOP\asm0001.drw'不能检索。 !18-Dec-17 18:01:21 End C:\USERS\HU\DESKTOP\asm0001.drw !Application (exportTest): started via registry. ! type: synchronous J-Link < 0 1.311000 1311 0 0 1226 1920 0 0 1440 13 < 0 1.324000 1324 0 0 1226 1920 0 0 1440 13 ~ Activate `main_dlg_cur` `main_dlg_cur` ~ Close `main_dlg_cur` `main_dlg_cur` !Command ProCmdOSExit was pushed from the software. ! Message Dialog: Warning ! : Creo Elements/Pro 将终止,并且所有未保存的工作将会丢失。 ! : 您确实要退出吗? ~ FocusIn `UI Message Dialog` `no` ~ FocusIn `UI Message Dialog` `yes` ~ Activate `UI Message Dialog` `yes` !End of Trail File
anyone is there?
I almost finished the google answer and the BBS information, but it didn't work
Hi,
my suggestion ... go to CREO_LOADPOINT\...\jlink\jlink_appls\jlinkexamples directory and study the contents of .java files located in it.
Do you mean the env is correct.
Hi,
if you can compile/run PTC installtest application then env is correct (I hope so).
It seems to me that you want to create application which:
Is it true ?
emmmm, this code export specify drw file to pdf, just test.but it can't work. every time read file to session, always get error.
i will more carefully think for my code. i will more carefuly for my code. .i will think about it, and try rewrite again. thank you reply. really thanks.
i'm still don't know why RetrieveModel return XToolkitGeneralError. pfcGlobal.getproesession fine.
pfcModel.ModelDescriptor_Create fine. cursession[by pfcGlobal.getprosession].RetrieveModel will fail.
Hi,
I was able to open drawing using following sequence:
String stdpath = "D:\\users\\mh\\creo2_parametric\\PTC_JLink\\open_drawing";
String modelname = "a4";
// D:\\users\\mh\\creo2_parametric\\PTC_JLink\\open_drawing directory contains ... a4.drw, a4.prt files
ModelType type = ModelType.MDL_DRAWING;
ModelDescriptor descr;
Model model;
Session proeSession;
try
{
proeSession = pfcGlobal.GetProESession();
descr = pfcModel.ModelDescriptor_Create(type, modelname, null);
descr.SetPath(stdpath);
model = proeSession.RetrieveModel(descr);
model.Display();
}
catch(Throwable e)
{
System.out.println ("Exception " + e);
}
same code but still can't work.
and always return
XToolkitGeneralError
Hi,
1.] what Creo version do you use ?
2.] what JDK did you use to compile source code ?
3.] what JRE do you use to run application ?
4.] can you upload your source code ?
public static void start() throws IOException, jxthrowable { // TODO Auto-generated method stub Session curSession; String filePath = "C:\\Users\\Hu\\Desktop\\java.log"; // Set the second parameter of FileWriter to "true" to append to file. Writer fileWriter = new FileWriter(filePath, true); Drawing draw = null; PDFExportInstructions pdf_export = null; String modelLocation="C:\\Users\\Hu\\Desktop"; String drw_name = "Asm0001.drw"; try { curSession = pfcGlobal.GetProESession(); pdf_export = pfcExport.PDFExportInstructions_Create(); PDFOption pdf_option = pfcExport.PDFOption_Create(); pdf_option.SetOptionType(PDFOptionType.PDFOPT_LAUNCH_VIEWER); pdf_option.SetOptionValue(pfcArgument.CreateBoolArgValue(false)); PDFOptions pdf_options = PDFOptions.create(); pdf_options.append(pdf_option); pdf_export.SetOptions(pdf_options); //Load Drawing Files.... fileWriter.write(drw_name); ModelDescriptor desc1 = pfcModel.ModelDescriptor_Create(ModelType.MDL_DRAWING, drw_name, null); desc1.SetPath (modelLocation); fileWriter.write("filename \r\n"); fileWriter.write(desc1.GetFullName()); fileWriter.write("filename \r\n"); draw = (Drawing)curSession.RetrieveModel(desc1); fileWriter.write("write file to session"); draw.Display(); draw.Export(""+draw.GetFullName()+"", pdf_export); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); fileWriter.write(e.toString()); } finally { fileWriter.close(); } }
same code but still can't work.
and always return XToolkitGeneralError.
host env:
Hi,
can you upload your source code, too ? I hope it enables me to reproduce the error message.
Thank you for your patience
Is it possible that I installed the pro engineer wrong?
emmmmm.......my installed won’t from official.
Hi,
my last reply follows ...
Your code works well on my PC.
I am able to reproduce com.ptc.pfc.Implementation.pfcExceptions$XToolkitGeneralError exception.
This exception appears when drawing file -OR- drawing model is not accessible.
Example:
I created model a4.prt and its drawing a4.drw and saved them into working directory.
I modified following line in your code:
String drw_name = "Asm0001.drw"; >>>>> String drw_name = "a4.drw";
When I started ProE and set working directory to see a4.prt and a4.drw, the application worked well.
When I renamed a4.prt to za4.prt -OR- a4.drw to za4.drw, then I got exception.
Please check if ProE can see Asm0001.drw and drawing model.
If all your ProE data are located in C:\Users\Hu\Desktop directory (from my point of view it does not make any sense to put ProE data on Desktop...) then add following option into config.pro file
search_path C:\Users\Hu\Desktop
If your ProE data are located in other directories, then add search_path option for every directory to config.pro file.
bro, why are you so cool. cause you i'm happy.
and i hate ptc.
Hi,
just little comment to your request to export part into PDF.
See attached creo2_m220_jlinkug.pdf. On page 317 you will find description of PDFOPT_EXPORT_MODE option. I guess you have to set PDFOPT_EXPORT_MODE = PDF_3D_AS_U3D_PDF to export part to PDF.
i belive you are super man.
OK, thanks for your help.
thank you so much。