Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hi,
does anybody know if it is possible to remove an option from the type list in file browser dialog "File / SaveAs / Save A Copy"???
I want to remove an option because I created a new Toolkit function that the user has to use instead of the OOTB function (different coordinate system by default and so on...).
I cannot find a list in the Creo install dir that allows me to remove options....
Thanks for any comments.
Andreas
Solved! Go to Solution.
Hi all,
Andreas, if you modify your requirements as "no STEP file to be available as a result of 'Save As' OOTB command" you would have more options to handle the situation...
The most logical way would be to delete the OOTB step file and instantly generate your own via ProMdlCopy...Action but I don't think the action function would be triggered for IGES/STEP/PARASOLID...
You could somewhat replicate this approach by using a bracket function over 'SaveAs' along with the trail file parser... The idea is to make a bracket function 'after execution' event to read at the end of the trail file - the full path of the output file will be listed there. If the file was indeed a STEP one then copy its path, delete the file, notify the end user about it and /or make your own STEP file at the same location. You would have some cumbersome workflow and a couple of unhappy users which would need to wait through output only to find out that the file was deleted if you would choose just to remove the wrong data...
HIH.
Feliks.
Andreas,
file format list is not customizable.
MH
You can adjust the sort order with the config.pro option preferred_save_as_type. Maybe this will help...
Tom,
I am not able to put preferred_save_as_type option into operation in CR2... .
MH
Thanks for the answers. There are already some cases on ptc.com/Customer Support which say that this option might not work with Creo2.
But this isn't the solution I am looking for. I simply want to remove an option and not only to specify my favorite export format as a new default value.
With a "bracket" function in Pro/TOOLKIT I would be able to suppress the complete execution of "Save As" (since ProCmdSaveAs is available as a regular Creo command), but I see no possibility to limit this to the export of a certain export format (in my case STEP).
Andreas
Info from PTC Support:
Config Option "preferred_save_as_type" does not work in Creo Parametric 1.0 and 2.0
https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS61360
SPR Details - 2843734 / 2125675
https://support.ptc.com/appserver/cs/view/spr.jsp?n=2843734
MH
There is this callback action, I think it should do what you want to do?
I don't know if you can overwrite file handlers with the ProFileSaveRegister dialog, or if the function is called also for other file types.
Br,
Eike
Description | ||||||||
Callback function to decide if the file type should be selectable in File 'Save a Copy' dialog or not. | ||||||||
Synopsis | ||||||||
#include <ProUtil.h> | ||||||||
ProBoolean | (*ProFileSaveAccessFunction) | ( | ||||||
wchar_t* file_type | ||||||||
/* (In) | ||||||||
File type | ||||||||
*/ | ||||||||
ProMdl model | ||||||||
/* (In) | ||||||||
The handle of the model being saved | ||||||||
*/ | ||||||||
ProAppData app_data | ||||||||
/* (In) | ||||||||
The application data | ||||||||
*/ | ||||||||
) | ||||||||
Returns | ||||||||
|
Hi Eike,
thanks for sharing this idea. As far as I understand these functions in toolkit they can be used to register a new file type in the SaveAs dialog.
I will try to replace an existing option with a new one.
2015-10-12: I tried to replace the option "STEP (*.stp)" with a new function by using ProFileSaveRegister() - but unfortunately it seems that the default options from Creo cannot be overwritten....
Andreas
Is it possible to use a notification function? Set either ProMdlCopyPostAction or ProMdlCopyPostAllAction to call your custom export.
This way even if the user selects the OOTB save as command the file will be overwritten with the correct one.
In theory it should work but I have to admit that I didn't get the chance to try if it works.
@Gabriel:
This was my first idea - to use this notification.
The problem with this is that it triggers ALL Export/SaveAs activities. But I want to prevent the user from exporting to STEP only...
Andreas
Andreas,
You are right. Also I did some quick tests and I noticed that the notification is working only when saving new Pro/E models but not for exports, like you need.
I took a look at the ProCmdBracketFuncAdd. There may be a workaround:
I added the following two lines to the user_initialize function:
status = ProCmdCmdIdFind("ProCmdModelSaveAs", &save_as_cmd_id);
status = ProCmdBracketFuncAdd(save_as_cmd_id, (uiCmdCmdBktFn)CheckExportType, (char*)"CheckExportType", (void**)NULL);
The save_as_cmd_id is defined as a global variable.
And here is the CheckExportType function:
int CheckExportType(uiCmdCmdId command, uiCmdValue *p_new_value, int entering_command, void **data)
{
ProUIMessageButton* buttons;
ProUIMessageButton user_choice;
//Exit function if called afer the SaveAs command
if(entering_command==0) return 1;
//Prepare the pupup dialog
ProArrayAlloc (2, sizeof (ProUIMessageButton), 1, (ProArray*)&buttons);
buttons [0] = PRO_UI_MESSAGE_YES;
buttons [1] = PRO_UI_MESSAGE_NO;
//Display the popup dialog.
ProUIMessageDialogDisplay (PROUIMESSAGE_INFO, L"About", L"Is this a custom STEP export?", buttons, PRO_UI_MESSAGE_YES, &user_choice);
ProArrayFree ((ProArray*)&buttons);
if (user_choice == PRO_UI_MESSAGE_YES)
{
//Call custom export function here
ProMessageDisplay(msgfile, "USER %0s", "Custom Export");
return 0;
}
return 1;
}
You will need to call you export function where I put the "ProMessageDisplay(msgfile, "USER %0s", "Call custom export here");"
Is not very straight forward but it may give you a way to do what you need.
Gabriel
Hi all,
Andreas, if you modify your requirements as "no STEP file to be available as a result of 'Save As' OOTB command" you would have more options to handle the situation...
The most logical way would be to delete the OOTB step file and instantly generate your own via ProMdlCopy...Action but I don't think the action function would be triggered for IGES/STEP/PARASOLID...
You could somewhat replicate this approach by using a bracket function over 'SaveAs' along with the trail file parser... The idea is to make a bracket function 'after execution' event to read at the end of the trail file - the full path of the output file will be listed there. If the file was indeed a STEP one then copy its path, delete the file, notify the end user about it and /or make your own STEP file at the same location. You would have some cumbersome workflow and a couple of unhappy users which would need to wait through output only to find out that the file was deleted if you would choose just to remove the wrong data...
HIH.
Feliks.
Hi Feliks,
exactly this procedure is the one I will try in the next days. Instead of a bracket function I will use the notification that is available for SaveAs or SaveACopy.
Andreas