Skip to main content
1-Visitor
October 10, 2017
Solved

Load drawing File from Working Directory in Jlink

  • October 10, 2017
  • 4 replies
  • 2591 views

How to load the Files from its working directory in Jlink .I need to load the files from its working directory .

Even though i set working directory ,I cannot load the files from directory by the following code.please help me to solve this problem.

 

String directory=curSession.GetCurrentDirectory().toString();
String modelLocation=""+directory+"\\"; String drw_name = drawfiles[i]; ModelDescriptor desc1 = pfcModel.ModelDescriptor_Create(ModelType.MDL_DRAWING, drw_name, null); desc1 = pfcModel.ModelDescriptor_CreateFromFileName(drw_name); desc1.SetPath (modelLocation); draw=(Drawing)curSession.RetrieveModelWithOpts(desc1, pfcSession.RetrieveModelOptions_Create()); draw.Display();
//Exporting to pdf
draw.Export(draw.GetFullName(), Mypdfexportinstructions);

Thanks regards,

Dinesh

Best answer by ddhini

Its Working fine.I close this question.

String directory=curSession.GetCurrentDirectory().toString();
String modelLocation=""+directory+"\\";
String drw_name = drawfiles[i];
ModelDescriptor desc1 = pfcModel.ModelDescriptor_Create(ModelType.MDL_DRAWING, drw_name, null);
desc1 = pfcModel.ModelDescriptor_CreateFromFileName(drw_name);
desc1.SetPath (modelLocation);
draw=(Drawing)curSession.RetrieveModelWithOpts(desc1, pfcSession.RetrieveModelOptions_Create());
draw.Display();
//Exporting to pdf
draw.Export(draw.GetFullName(), Mypdfexportinstructions);

4 replies

24-Ruby III
October 10, 2017

Hi,

 

what Creo release+build do you use ?

ddhini1-VisitorAuthor
1-Visitor
October 11, 2017

My above code Works fine without bugs .Thanks for tyour time

ddhini1-VisitorAuthorAnswer
1-Visitor
October 31, 2017

Its Working fine.I close this question.

String directory=curSession.GetCurrentDirectory().toString();
String modelLocation=""+directory+"\\";
String drw_name = drawfiles[i];
ModelDescriptor desc1 = pfcModel.ModelDescriptor_Create(ModelType.MDL_DRAWING, drw_name, null);
desc1 = pfcModel.ModelDescriptor_CreateFromFileName(drw_name);
desc1.SetPath (modelLocation);
draw=(Drawing)curSession.RetrieveModelWithOpts(desc1, pfcSession.RetrieveModelOptions_Create());
draw.Display();
//Exporting to pdf
draw.Export(draw.GetFullName(), Mypdfexportinstructions);