1.dynamo在一个程序里面生成了新的构件。
2.然后对视图进行刷新后再执行后面的节点。
3.使用uidoc.RefreshActiveView()对视图进行刷新没有报错,但也没有刷新视图。
4.请问dynamo里面应该怎样使用此方法?
RefreshActiveView 函数仅在您想要查看当前地图文档更新的活动视图时使用,需要 arcpy.mapping 下的导出、保存和打印函数会生成预期的更新结果,而无需使用 RefreshActiveView。
这是一个成功的例子:
import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
lyr = arcpy.mapping.ListLayers(mxd, "Cities", df)[0]
# Use the SelectLayerByAttribute tool to select New York and
# zoom to the selection
arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION",
"CITY_NAME = 'New York'")
df.zoomToSelectedFeatures()
# Export the map to a .jpg
arcpy.mapping.ExportToJPEG(mxd, "C:/data/NewYork.jpg")
# Clear the selection and refresh the active view
arcpy.SelectLayerByAttribute_management(lyr, "CLEAR_SELECTION")
arcpy.RefreshActiveView()
del mxd
您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~
如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~
ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632
非常感谢您使用有问必答服务,为了后续更快速的帮您解决问题,现诚邀您参与有问必答体验反馈。您的建议将会运用到我们的产品优化中,希望能得到您的支持与协助!
速戳参与调研>>>https://t.csdnimg.cn/Kf0y