Skip to main content
3-Newcomer
March 22, 2024
Question

weblink retrieve model sub folder problem

  • March 22, 2024
  • 2 replies
  • 1386 views

I have specified a local folder as the working directory in Creo.

then want to use Weblink to retrieve models. However, I found that currently it can only retrieve models in the current directory and does not support models in subfolders.

 

Is there a better way to handle this?

 

code like this

let session = pfcGetProESession();
let currenDirectory = session.GetCurrentDirectory();
let device = currenDirectory.split(":")[0];

let path = currenDirectory.split(":")[1];

let modelDescr = pfcCreate('pfcModelDescriptor').CreateFromFileName(fileName)
modelDescr.Device = device;
modelDescr.Path = path;
let model = session.GetModelFromDescr(modelDescr)
if (!model) {
let retrieveOptions = pfcCreate('pfcRetrieveModelOptions').Create();
model = session.RetrieveModelWithOpts(modelDescr, retrieveOptions);
}

2 replies

Community Moderator
March 28, 2024

Hi CD_10811723,
 

Thank you for your question. 
I’d like to recommend to bring more details and context to your initial inquiry

It also helps to have screenshot(s) to better understand what you are trying to do in your process. 

This will increase your chances to receive meaningful help from other Community members. 

Regards,

Community Moderation Team.

16-Pearl
July 25, 2024

Hi CD,

 

If you want to retrieve a model from a folder that is not the working directory, you can define the path as a string, for example C:\Temp\ like this:

 

modelDescr.Path = "C:\\Temp\\";

 with double \