AnsweredAssumed Answered

Can I add Z value from a window, after got XY from mouse click

Question asked by Sebahat on Jan 4, 2016
Latest reply on Jan 5, 2016 by jamesfreddyc

Hi all,

I would like to create a point shape with Z value in ArcMap, for that I was created a tool using python addin toolbar. The tool can get XY coordinates from mouse click on datafreme. Now I want to add Z value as manuel for this point. Can I add Z value from a window by created QWidget or other PyQt4 windows, after got the XY position on dataframe for my point shape. Is there any way to do this using python? Can you kindly give any advices?

 

My current code:

There is global z in my code, it is just a simple solution and I dont want to use it. You know it isn't useful way.

import arcpy
import pythonaddins
arcpy.env.overwriteOutput = True
arcpy.env.addOutputsToMap = True
arcpy.CheckExtension('3D')


class Observation_Point(object):
    """Implementation for addin5_addin.tool (Tool)"""
    def __init__(self):
        self.enabled = True
        self.shape = "NONE"
    def onMouseDown(self, x, y, button, shift):
        pass
    def onMouseDownMap(self, x, y, button, shift):
        #choose XY on dataframe
        mxd = arcpy.mapping.MapDocument("current")
        dataframe = arcpy.mapping.ListDataFrames(mxd)[0]
        global z
        z= 20
        PointGeom = arcpy.PointGeometry(arcpy.Point(x,y,z), None, True, False)
        global A
        A = "C:\\Users\\Casper\\Desktop\\DENEMELER\\obs_point_fromAddin5.shp"
        arcpy.CopyFeatures_management(PointGeom, A)
        print "saved as a point.shp..."
    def onMouseUp(self, x, y, button, shift):
        pass
    def onMouseUpMap(self, x, y, button, shift):
        pass
    def onMouseMove(self, x, y, button, shift):
        pass
    def onMouseMoveMap(self, x, y, button, shift):
        pass
    def onDblClick(self):
        pass
    def onKeyDown(self, keycode, shift):
        pass
    def onKeyUp(self, keycode, shift):
        pass
    def deactivate(self):
        pass
    def onCircle(self, circle_geometry):
        pass
    def onLine(self, line_geometry):
        pass
    def onRectangle(self, rectangle_geometry):
        pass

Outcomes