Hello,
Please I'd like to know the event name which is associaed to the "save as".
For example when we open a new file, the SYSTEM_NEW_DESIGN_FILE event is loaded and when we close the dgn file the SYSTEM_UNLOAD_PROGRAM event is loaded so what about "save as".
Search the MDL Function Reference Manual for 'save as'. You will find …
#include <msdgnfileobj.h> #include <mssystem.fdf>
Your callback function (SystemFunc_FileSave) receives several args. including enum DgnSaveReasons. Check that arg for DGNSAVE_FILE_SAVE_AS to react to that event.
Regards, Jon Summers LA Solutions
I added a callback function entitled __DkmSystem_fileSaveAs__ as follows:
void __DkmSystem_fileSaveAs__( int postsave)
{
return;
}
And I associated this function to the SYSTEM_FILE_SAVEAS event as follows:
mdlSystem_setFunction (SYSTEM_FILE_SAVEAS, __DkmSystem_fileSaveAs__);
I put a breakpoint on the __DkmSystem_fileSaveAs__ function, but it is not reached when I "save as" my dgn file.
Currently, I use microstation v8i serie 3.
Thank you for your help
I tried this issue too:
I added a callback function entitled __DkmSystem_fileSave__ as follows:
void __DkmSystem_fileSave__( ProcessChangesWhen when , DgnFileChangesFlag changesFlag , DgnSaveReasons reason , double timestamp , DgnFileObjP pFile )
if ( reason == DGNSAVE_FILE_SAVE_AS )
And I associated this function to the SYSTEM_FILE_SAVE event as follows:
mdlSystem_setFunction (SYSTEM_FILE_SAVE, __DkmSystem_fileSave__);
I put a breakpoint on the __DkmSystem_fileSave__ function, in order to verify the value of the "reason" variable, but I find that it is equal to DGNSAVE_FILE_CLOSE and not to DGNSAVE_FILE_SAVE_AS.
Unknown said:I put a breakpoint on the __DkmSystem_fileSave__ function, in order to verify the value of the "reason" variable, but I find that it is equal to DGNSAVE_FILE_CLOSE and not to DGNSAVE_FILE_SAVE_AS
It's possible that your function is called multiple times.
When I use the "save as" control, my dgn file is closed, So before closing it, microstation needs to make a save.
This is why the __DkmSystem_fileSave__ function is called. So, in this case, the reason of appeal is the closure of the dgn file that's why reason is equal to DGNSAVE_FILE_CLOSE .
What type of operation or action are you looking to perform when a SaveAs occurs? Knowing what you intend to do will help provide the best response or recommendation.
Thank you,
Bob
We deploy an mdl application called DKMETRE on microstation.
When users chooses to save their dgn file as a dwg file (autocad file format), we have to unload the DKMETRE application.
So, I need to detect the SYSTEM_FILE_SAVEAS event in order to invoke my script in the callback function associated.
This may not be an option, however it is typically best to try and work with the software vendor to work out any incompatabilities so they can better understand the situation and possibly accomodate your application workflows. This would provide them an opportunity to make changes or exceptions to help your two applications work better together potentially prevent the need to forceful unload 3rd party applications.
Another option to consider would be to perform an "mdl unload AppName" in the initialization of your code and on new design file events.
If both options above cannot be utilized you could use an approach similar to the following.
Intercept and reject the commands of interest (CMD_SAVE_AS_DWG) as well as (CMD_DIALOG_SAVEAS). Both commands are defined in the header file: cmdlist.h. Each command is respectively activated by - MicroStation "save as dwg" keyin, and MicroStation: File > Save As menu item.
Create a MicroStation input queue monitor interest using:
mdlInput_setMonitorFunction (MONITOR_ALL, InputQueueMonitor);
The user event function prototype should be similar to:
Public int InputQueueMonitor ( Inputq_element* iqel /* => Input queue element to validate */ )
Your actions/logic performed by switching on commands of interest:
switch (iqel->u.cmd.command)
Then choose to return if you want to accept (INPUT_ACCEPT) or reject (INPUT_REJECT) the current command. You may want to add some static variables in your app so that you can detect when you are starting your custom reject of the command, when the next "new" command comes along - so you could possibly reload the app, and execute the unload (and logic) on new design file changes since the 3rd party app may be reloaded as a MS_DGNAPP and running the code above w/o some additional logic write messages to the MicroStation Message Center stating that your app was not able to unload the 3rd party app.
HTH,Bob
Right Robert Hook
Thank you colleagues for your help.
Using the SystemFunc_FileSave callback function and the SYSTEM_FILE_SAVE and DGNSAVE_FILE_SAVE_AS constants, where can I find the name of the new file and his extension