I�??m converting a mapping system into ArcPy. I�??ve made great progress but hit a stumbling block!!! I want my users to be able to pick, from a pick list, a pre-made mxd and load it into their current ArcMap session. I�??ve created this simple toolbox but�?� could not find any ArcPy method for loading an mxd into the current session?
I could load layer files instead but that would defeat my purpose since the mxds have several elements in the layout (header, footer, north arrow, tailored legend, etc.) that I want to preserve . Since we can�??t create these elements in ArcPy, I am kind of stuck! Using ArcObject to do such a simple task would be kind of ridiculous too. Am I missing something here or was it an oversight in ArcPy?
I can open up an mxd into a �??separate�?� session though, but that�??s not want I�??m trying to achieve: mxd = r"C:\Temp\eaub490\SUMA\Products\Timber Sales Map\Timber Sales Map.mxd" os.startfile(mxd)
Any helps or comments would be greatly appreciated.
Thanks Jeff for your response. I still believe that being able to open up an mxd into the current (active) session is not crossing too far into the "realm of desktop customization", it would open up so many possibilities. Let's put it that way, would it be nice to have a method like this one:
Just finding this thread as well after attempting to do the same task. I just wanted to note that the os.startfile("/path") method works but does so by opening up a new instance of ArcMap. This is not the same as changing the CURRENT map document to the new one. Of course, I'm typing into the Python window within ArcMap rather than executing as a standalone script, which I haven't tried.
Redirecting the active MXD app is not possible with arcpy.mapping. It was not designed to do this. Its purpose was to connect to existing, pre-authored MXDs. For similar reasons, you can't change page size, orientation, etc.
I know I am bumping a really old thread but I want to do this with ArcObjects in C#.NET cant find a whole lot on opening it in the active session. Anyone have a code snippet handy for doing this within the onClick() event of a button.