Select to view content in your preferred language

Guidelines- arcpy

3671
6
04-25-2015 11:33 PM
Yaron_YosefCohen
Frequent Contributor

Hi everyone,

I have a lot of mxd files with guidelines in  every mxd. i wonder if there is a way with arcpy, to clear all those guidelines at once ?

in ArcGIS Help (10.2, 10.2.1, and 10.2.2) ArcGIS Help (10.2, 10.2.1, and 10.2.2) ,

i didn't saw any mention for what i seeking.

Thanks in advance.

Tags (2)
0 Kudos
6 Replies
RebeccaStrauch__GISP
MVP Emeritus

​Hi YYC,

I bet resetting you normal.mxt would do the trick, but it will also reset all the other interface customizations you made, such as non-default placement of menus, etc. It's worth a try though, since if you just rename the current one and it doesn't work, you can always put it back to the current by renaming it back.  It's also a very quick test.

Curtis Price Covers how to reset in his blog:

Resetting your ArcGIS application profile

0 Kudos
Yaron_YosefCohen
Frequent Contributor

Hi Rebecca,

i tried delete the normal mxt but it didn't remove the guide lines- thanks any way

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

Bummer...it was just a guess.​

0 Kudos
Yaron_YosefCohen
Frequent Contributor

thanks anyway

0 Kudos
DarrenWiens2
MVP Honored Contributor

AFAIK, the only way to access guides inside a specific mxd is through ArcObjects, which you can access through comtypes/Snippets (see here for more).

I don't believe deleting your Normal.mxt will do anything to an existing mxd, but I can't test that at the moment.

This will remove the vertical guides from an mxd, if you have comtypes and Snippets properly installed - you can do the same for horizontal guides:

from comtypes.client import GetModule, CreateObject
from Snippets import GetLibPath, InitStandalone

def main():
    InitStandalone()
    modCarto = GetModule(r"C:\Program Files (x86)\ArcGIS\Desktop10.2\com\esriCarto.olb")
    snapGuide = CreateObject(modCarto.SnapGuides, interface=modCarto.ISnapGuides)
    mxdObject = CreateObject(modCarto.MapDocument, interface=modCarto.IMapDocument)
    mxdObject.Open(r"C:\junk\guides.mxd")
    snapGuide = mxdObject.PageLayout.VerticalSnapGuides
    snapGuide.RemoveAllGuides()
    mxdObject.Save()
    del mxdObject

if __name__ == '__main__':
    main()
0 Kudos
Yaron_YosefCohen
Frequent Contributor

Hi Darren

unfortunately i don't know ArcObjects yet.

0 Kudos