mxd = arcpy.mapping.MapDocument("current") mxd_path = mxd.filePath
I am trying to make a script a bit more friendly by removing the need for a user to manually alter the directory location of a workspace.
import os mxd = arcpy.mapping.MapDocument("current") mxd_path = mxd.filePath mxd_dir = os.path.dirname(mxd_path)
you should include a "findAndReplaceWorkspacePaths" method on the "CURRENT" map document. If you acquire the path to the .mxd, you could use that within the Replace portion of the findAndReplaceWorkspacePaths, and set the workspace to the same relative path as the map.Regards,Jim
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.