first this is a stand alone app so I have to use COM.
Maybe im missing something or misunderstanding this but I don't see how to do a save settings on a file that I opened via OpenDesignFileForProgram. I only found the key in but that wont work since its not the active file.
I see the save and saveas methods but I don't see a save settings. I see save settings at the application level. which only affects the active file. isn't save settings saving the design file settings. confused as to why its at the application level and not a method for the file.
Granted most of the things save settings does is GUI related so I see how opendesignfileforprogram wouldn't be the logical to use with save settings. but one of the things save settings does is associate the dgn file with the workspace/workset. which is what im trying to accomplish. since there is no COM call
im trying to get around the fact that DgnWorkSetInfo is not available in COM. and it just takes soo much longer to load the file to the screen (make active).
John Drsek said: I don't see how to do a save settings on a file that I opened via OpenDesignFileForProgram
Why do you feel the need to use that method rather than OpenDesignFile? See this blog.
OpenDesignFile
Regards, Jon Summers LA Solutions
to save on loading times because I need to do this on multiple files. and really I don't want to see the application at all but there is a bug with -automation when I start microstation, so I have no way to silently open microstation.
i can just use opendesignfile, just trying to optimize where i can.
John Drsek said: it just takes soo much longer to load the file ...
Software that's correct but slow is preferable to software that is fast but wrong. Develop your app using OpenDesignFile, and when it's working you can explore ways to make the performance acceptable.
The idiomatic way to process multiple DGN files without showing graphics is to write an app that can be started as an MS_INITAPP. I don't know if .NET can do that, but C++ certainly can; VBA can't. The app can seize control of MicroStation and prevent it from opening any graphics (unless your code explicitly tells it to). It also has the benefit of speed: if performance is really an issue for you, then you won't get faster than a native-code app written in C++.
MS_INITAPP
okay im not familiar with MS_INITAPP. ill have to look into it some more and how to create one. really the microstation specific stuff Is just this save settings. so it shouldn't be too much
im guessing I could start the microstation process and pass the -wa parameter to load this app from my stand alone app.
so my stand alone app would do its thing then call up the microstaion process to finish off the work on the dgn files?
Hi John,
a few more notes in addition to Jon's answers:
John Drsek said:Maybe im missing something or misunderstanding this but I don't see how to do a save settings on a file that I opened via OpenDesignFileForProgram.
There is no reason why there should be "save setting" feature available for OpenDesignFileForProgram method. These two "open methods" target different purposes and offer different set of features.
Whereas normal open design file is backed by fully active MicroStation, open design file for program is more like "element stream" with only basic (typically elements related) functionality available. More complex concepts like rasters, references, views etc. do not exist in this approach.
John Drsek said:im trying to get around the fact that DgnWorkSetInfo is not available in COM
Well, VBA / Interop API is pretty limited and is often the last updated in a chain C++ > NET > COM when a new feature is added to MicroStation.
John Drsek said:ill have to look into it some more and how to create one
I agree with Jon that this is the way to go. I know about a few projects that quite quickly turned from limited Interop API to specifically designed initapp code that works as server communicating (e.g. using some RPC method) with client. An advantage is that in initapps, complete MicroStation API is available.
I do not see it in CE examples, but there are V8i examples how to implement initapp in native code (which is the best way). I recommend to search also existing discussions, because how to use NET API was discussed also (e.g. here).
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Answer Verified By: John Drsek
thanks Jan, so if im understanding this right, its just an addin your loading on start up with the -wa parameter?
i was thinking it was some special kind of app.
John Drsek said:its just an addin your loading on start up with the -wa parameter? i was thinking it was some special kind of app
its just an addin your loading on start up with the -wa parameter?
i was thinking it was some special kind of app
It is a special kind of app. When you load something with the -wa switch, it is started before MicroStation's UI is initialised, and before any DGN file is opened. The app must recognise its privileged status and act accordingly...
-wa
AFAIK the only option for creating an MS_INITAPP for MicroStation CONNECT is to write a C++ app. As I commented above, VBA can't do that. I don't know whether a .NET AddIn can do it: I don't see any evidence that it can, but I'll be pleased to be shown otherwise. A C++ app. can do it (I've written C++ several apps that are init apps).
Hi,
It is possible use a C# Addins with MS_INITAPP.
protected override int Run( string[ ] commandLine ) { if( commandLine.Contains( "MS_INITAPPS" ) ) { // start a visible or invisble session } }
In order to start a invisible Microstation, you have to open a designfile and then call mdlSystem_entergraphics via pinvoke if you want to use 'view' functionality.
Utilities.ComApp.OpenDesignFile( dgnFilename, false, MsdV7Action.UpgradeToV8 ); Utilities.ComApp.Visible = true; mdlSystem_enterGraphics( );
To start a 'visible' Microstation, change the order of the methods above
Utilities.ComApp.Visible = true; mdlSystem_enterGraphics( ); Utilities.ComApp.OpenDesignFile( dgn, false, MsdV7Action.UpgradeToV8 ); . . . [DllImport( "ustation.dll", EntryPoint = "mdlSystem_enterGraphics", CallingConvention = CallingConvention.Cdecl )] public static extern int mdlSystem_enterGraphics( );
Regards,
Harmen
thanks Harmen,
so i think im close. is there a way to not have the app be in the Mdlapps folder? is there a variable that controls this? im using the -WA parameter to kick it off.
John Drsek said:is there a way to not have the app be in the Mdlapps folder?
MicroStation looks for apps in the folders listed in configuration variable MS_MDLAPPS.
MS_MDLAPPS