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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

How to set path for working directory & open specified Model?

SM_9791973
10-Marble

How to set path for working directory & open specified Model?

Hi,

Currently I am exploring the Smart assembly in the creo for the automation purpose but I facing one hurdle, I am not able to set the working directory (for the part of Creo) .

 

It would be great if somebody helps me out in these.

Below is my snap of the code which I have wrote to do this things.

 

Regards,

 

 

6 REPLIES 6
TomU
23-Emerald IV
(To:SM_9791973)

Use lowercase for the filter.

TomU_0-1629810029360.png

TomU_2-1629810095906.png

 

 

 

TomU
23-Emerald IV
(To:SM_9791973)

By the way, you can directly load the model without waiting for the user with the RETRIEVE_MDL command:

TomU_3-1629810181649.png

If you want to show it as well, add SWITCH_TO_MDL:

TomU_4-1629810290700.png

 

SM_9791973
10-Marble
(To:TomU)

Thank you @TomU for helping me in loading the part it worked for me. 

 

Can you pl. help by letting me know how to set working directory as I have tried but it doesn't work.

In setting the working directory path as my program "set_working_directory" code line is showing the error.

 

Regards,

TomU
23-Emerald IV
(To:SM_9791973)

Yes, I get the same error when attempting to access a folder in my Windows user profile.  I'm guessing it's a permissions issue?  Might also be a bug.  I'll go ahead and open a case with tech support and see what they say.

 

On the other hand, I don't have any problem if I try to set the working directory to someplace else:

GET_WORKING_DIRECTORY dir

PRINT "Current working directory: %" dir

SET_WORKING_DIRECTORY "C:\ptc\workspaces\Build"

GET_WORKING_DIRECTORY dir

PRINT "New working directory: %" dir

TomU_0-1629897882138.png

 

 

BenLoosli
23-Emerald II
(To:TomU)

Simple test to see if it is permissions is to create a file in that folder.

TomU
23-Emerald IV
(To:BenLoosli)

Okay, it wasn't a permissions issue.  From tech support:

 

The failing path have "\t" in it which is also used to add tabs in a string. This seems to be the main cause of the error you are facing.

 

Please try either by adding '@' before the path, for example SET_WORKING_DIRECTORY @"path" OR use double slash "\\" instead of single "\" as a separator in the path.


My path had a \t in it.  Yours has a \b in it.  Adding an @ symbol before the path should fix it:

SET_WORKING_DIRECTORY @"C:\Users\t....

 

Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags