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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Is it possible to save versioned files to a relative directory?

No ratings

Hello,

Is there a config setting that controls where versioned file backups are saved using a relative file path?

 

Ideally, when I hit ctrl-S, a new file without a version number would be saved in the working directory, and the versioned file would be saved to ./archive. I'm always purging the versioned files to keep my working directory cleaned up, but then if I need them, they're already gone. If I could automatically keep them in an archive folder, that would help my workflow.

Comments

I think Creo fundamentally saves files with version extensions regardless.

 

You might consider a mapkey to perform a backup of the current file to a archive location then purge the working directory.

 

Alternatively, you would write a batch file that a mapkey could also run to perform the necessary operations I think without much trouble.

 

Dave

Thanks Dave, I was hoping for a config option, but a mapkey and/or batch file should do the job. Is there an environment variable that CREO recognizes for working directory? I did some digging, but couldn't find one. I expected $WORKINGDIRECTORY or something along those lines.

I am not aware of a config.pro option for either of those.  I think it has been that way for some time

 

You can set the working directory on startup of the application.  But that is typically done in the shortcut you create to the actual creo startup.  My example is like this:

image

 

Alternatively, you can create a custom batch file for the startup of Creo (most do), and set your working directory as the start location also.   You could set an env variable in that if you needed it for something else... but typically those are only local to the batch file's execution as I recall.

 

I would be curious to see if anyone as any other suggestions on this issue.  I am sure it is not uncommon.

 

Dave

Hmm, having a static working directory set at startup isn't very effective for me. I generally jump around between different folder structures within the day, so I'll reset my working directory to wherever what I'm working on at the moment is stored. I bet if I dig into the trail files, I can figure out how creo is handling that and come up with something.

Well remember - it is the "starting" directory ... we also change to about 10-different directories throughout the day.

 

But if you wanted an archive old files type of capability (instead of a strightup "purge" of the folder to keep old versions from sight)... then you may have to look at either a mapkey to do the process you are looking for... or have another program externally monitor and do stuff with the files in the background (external to Creo).

 

PowerShell may be an option:  (but admittedly would require some effort to get things the way you wanted).

 

https://superuser.com/questions/226828/how-to-monitor-a-folder-and-trigger-a-command-line-action-when-a-file-is-created

 

But the PowerShell option -- could conceptually:

 

scan the target directory for the highest file extension or most recent modified date,

then get all the other files with the same rootname.ext and ultimately

copy them for you to an archive sub-folder... 

 

I think that may work.

 

Dave

I think I'm getting close with a mapkey. It looks like I can set "save_file_iterations no" in my config.pro to prevent versioned files from being saved to my working directory.

 

Then I can make a mapkey that will explicitly save to my working directory (which will set the current directory there), save-as backup to a relative path of ./archive from my current directory creating a versioned file, then somehow switch my current directory from the archive folder back to my working directory. Changing how I save files seems potentially dangerous, so I want to do a bunch of testing to make sure that this will work in all the various circumstances that I could run into. It's almost the end of the day Friday though, so that's a project for next week.

Actually, this seems to be working as intended:

mapkey save @MAPKEY_NAMESave to working dir, save versioned file to archive, purge working dir;@MAPKEY_LABELsave;\
mapkey(continued) ~ FocusIn `main_dlg_cur` `proe_win`;\
mapkey(continued) ~ Trail `UI Desktop` `UI Desktop` `PREVIEW_POPUP_TIMER` `main_dlg_w1:PHTLeft.AssyTree:<NULL>`;~ Close `main_dlg_cur` `appl_casc`;\
mapkey(continued) ~ Command `ProCmdModelSave` ;~ Close `main_dlg_cur` `appl_casc`;\
mapkey(continued) ~ Command `ProCmdModelBackup` ;\
mapkey(continued) ~ Select `file_saveas` `ph_list.Filelist` 1 `archive`;\
mapkey(continued) ~ Activate `file_saveas` `ph_list.Filelist` 1 `archive`;\
mapkey(continued) ~ Activate `file_saveas` `OK`;~ FocusIn `main_dlg_cur` `proe_win`;\
mapkey(continued) ~ Key `main_dlg_cur` `proe_win` 9 302 541 1179648 1024 1529 764 1920 1080 173568 `F4`;%$F4;

The "archive" folder needs to be created in advance, and F4 is a shortcut that runs a purge script. I'm getting double versioned files in the archive, but that's not a big problem. I don't know if this is better than my current method of dealing with versioned files, but I'm satisfied for the moment.

Hi,

I hope you know the functionality of Backup command. It creates a copy of model and set it as "current" ... this means any following modification is saved into backup copy (not into original model). Therefore after finishing backup you have to erase model from session and open original model, again.

All,

 

This is not the correct forum sub-group for this topic. This forum is for CAE/Simulation topics, not file management or Windchill.

 

Thank you

Doohh... Martin is right.... I guess "backup" does not mean "backup"...  This is one area of Creo where the words and behavior don't seem to perfectly align with intent.

 

Well... I would defer to a script to execute via mapkey to perform the operation instead.

 

Dave

I use backup extensively.  It preserves all related files for an assembly which is really nice because unless you are using windchill you can get confused about which version of file is being used in session.  Backup to a new folder and set it as working directory and you are on a new page, leaving the old behind and ensuring part references are there.  If you are trying to keep ties to parts/assemblies in a separate folder structure, these always have to be loaded in session manually before opening the master assembly.  You would have to delete those parts/assemblies from the new backup folder if you want them to go missing and prompt a manual search.  (again windchill solves this)

 

bonus rant. 😊

I of course assume you generally keep your model tree clean with no missing references.  I cringe when I see model trees with red missing references and features that are frozen because their references were lost.  Most of the time you are better off making these features dumb, independent geometry.  When doing simulate on these I often just export them as Step files and work on completely dumb models rather than try to fix models full of missing references, circular references, etc.  (circular references show up in .crc file in working folder they essentially mean you have been illogical with dependencies... A depends on B, B depends on A type of stuff)

It has been moved to Creo Tips.

Version history
Last update:
‎Feb 14, 2020 01:47 PM
Updated by:
Labels (1)
Tags (1)