Select to view content in your preferred language

How to set layout view scale in Pro

417
2
12-09-2022 09:39 AM
2Quiker
Occasional Contributor II

Is there a way to set the scale of the layout view in Pro, similar to ArcMap?

For example in Arcmap

 

lyr = arcpy.mapping.ListLayers(mxd, "lyr")[0]
df.extent = lyr.getSelectedExtent()
df.scale = 24000
arcpy.RefreshActiveView()
arcpy.RefreshTOC()

 

 

In pro I can't seem to get set

 

aprx = arcpy.mp.ArcGISProject("CURRENT")
map = aprx.listMaps()[0]
#lyr = map.listLayers("SUBJECT_PROPERTY")[0]
lyt = aprx.listLayouts("Map")[0]
mf = lyt.listElements("MAPFRAME_ELEMENT")[0]
#mf.camera.setExtent(mf.getLayerExtent(lyr, False, True))

ext = map.defaultCamera.getExtent()
mf.camera.scale *= 1.25 #some how set this to 1:24,000

 

2Quiker_1-1670607101920.png

0 Kudos
2 Replies
RachelGomez
New Contributor II

Steps are given below-

 

Do one of the following to choose Properties. On the menu, choose Modify > Properties.
Select the edge of the layout viewport.
In Custom Scale, enter the scale at which you want to view model space entities from within the layout viewport.
Click OK.

Regards,

Rachel Gomez

0 Kudos
2Quiker
Occasional Contributor II

After trying your suggestion but, but after I run the code the zoomed scale changed.

I am curious to see how people, if anyone is getting zoomed scale like in Arcmap with Python.

0 Kudos