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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

working on temp ProMdl


working on temp ProMdl


I have a workflow which basically is:

  • open creo
  • load/create ProMdl
  • do some regular stuff and save ProMdl.
  • do some other stuff I do not want to be saved.
  • close creo

My Idea is to call "ProMdlSave()" after I am done with my regular stuff. Then clear the session with "ProMdlErase()", "ProMdlRetrieve(saved model)" and "ProObjectwindowCreate(..)", "ProMdlDisplay" and "ProWindowActivate".

The Problem with that is, that I do not know how to change my Current working Directory. I am trying:

ProMdldata modelData;

status = ProMdlDataGet(mdl, &modelData);

wcsncat(modelData.path,, PRO_PATH_SIZE);


But the File I am working on is stored on a network drive and I think this is causing the error... Does someone has an idea on how to get the correct path. Or create a temp copy of my mdl?
best regards and thanks in adavance

This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.

The "wcsncat(modelData.path,, PRO_PATH_SIZE);" line concatenates the name of the model (without extension) to the file path. This way you get an incomplete path of the model file. I think that is what is causing the error.

What you are looking for is to get the name of the directory where the file is stored. For this you need to concatenate the modelData.device with the modelData.path:

Something like:

ProPath workingDir;


wcscpy(workingDir, modelData.device);

wcscat(workingDir, L":");



The above code should work if you are using mapped network drives. If you want to use UNC paths then you should replace modelData.device with

Another way to do it is to use ProMdlLoad. This function allows you to load model that are stored in directories different than the working directory. I don't recommend to use ProMdlLoad when you are working with assemblies or drawings. For standalone parts it should work fine.

Hey Gabriel Zaha,

thanks for your reply.

Unfortunately both, ".device" and ".host" are empty strings.

The "modelData.path" i receive is in UNC:

+"\\Server.Name\UserName$\My Documents\DestinationFolder\"

If I set  ProDirectoryChange to this path i get: PRO_TK_INVALID_NAME ... do I have to format this path?

And for Load I got the same problem to find the correct path

//edit: I am trying a new way: use creo save as function to save a local stored copy... do my stuff on the local stored copy... and delete the copy afterwards

//edit 2:  Re: How to access the hidden UNC path with "$" in Creo   <- this seems to be the reason why it is not working. Although I find it very strange.. because I am able to work with Creo using files stored on network devices... (Creo 2.0)... but API is not able to??? wired..

I think you are right. Hidden UNC paths can be tricky. In these circumstances I'd look at two possible ways:

1. Since the model is already in memory I'd look to see if there is a way to skip the model erase and retrieval steps.

2. If first option is not applicable then I would use a local copy - same way as you described

Top Tags