POST
|
I have created a button in a custom toolbar and it keeps disappearing. I followed these instructions: Adding a custom tool to a menu or toolbar Steps: Open the Customize window as described above and click the Commands tab. In the Categories list, scroll down and click [ Geoprocessing Tools ]. Click the Add Tools button. Browse to the toolbox containing the tool you want to add, choose the tool, then click OK. The tool is added to the Commands panel and is available for you to add to any menu or toolbar following the procedure described above for system tools. When I close Arcmap and then reopen it, there is no tool in the custom toolbox. The custom toolbox is there because I saved it to the Normal (mxt), but the icon is gone. I have to then redo all the steps above to get it back. Is there a way to just add a custom tool to a custom toolbar and have them stay where I last left them everytime I open arcmap? I need help. Please ESRI I need your help.
... View more
03-21-2011
01:51 PM
|
0
|
0
|
438
|
POST
|
I have played around with the syntax of my code and have finally had it work. My code now looks like this: #create an empty dictionary areaD = {} import arcpy import arcpy.mapping import os # populate dictionary using indexing and assignment with units and conversion factors relative to sqmeter = 1.0 # to convert x sqmeters to any of the other area units multiply by the factor # to convert x of any of the other area units to sqmeter divide by the factor # to convert x of any area unit to any of the other area units go over interim sqmeter # this minimizes the total number of conversion factors areaD['sqmeter'] = 1.0 areaD['sqmillimeter'] = 1000000.0 areaD['sqcentimeter'] = 10000.0 areaD['sqkilometer'] = 0.000001 areaD['hectare'] = 0.0001 areaD['sqinch'] = 1550.003 areaD['sqfoot'] = 10.76391 areaD['sqyard'] = 1.19599 areaD['acre'] = 0.0002471054 areaD['sqmile'] = 0.0000003861022 def convertArea(x, unit1, unit2): """area conversion with error trapping""" if (unit1 in areaD) and (unit2 in areaD): factor1 = areaD[unit1] factor2 = areaD[unit2] return factor2*x/factor1 else: return False x = int (arcpy.GetParameter (0)) unit1 = arcpy.GetParameterAsText(1) unit2 = arcpy.GetParameterAsText(2) outcome = convertArea(x, unit1, unit2) if outcome is not False: print "%f %s = %f %s" % (x, unit1, outcome, unit2) arcpy.AddMessage("%f %s = %f %s" % (x, unit1, outcome, unit2)) else: print "There was an error converting %s to %s" % (unit1,unit2) arcpy.AddMessage("There was an error converting %s to %s" % (unit1,unit2)) It works in the script tool which is a huge step. But, I am still getting some problems. When I run the tool and give it an number that has a decimal like 5.6 it returns an answer calculated at 5.0000. I don't know why it is droping the .6 and replacing it with .0000. I have included screenshots of both the tool menu and the result page. You can see how it drops the decimal. Does anyone know why? Please help.
... View more
03-18-2011
08:12 AM
|
0
|
0
|
1520
|
POST
|
The error message that I keep getting is as follows: Executing: AreaConversion 1 sqmeter sqfoot Start Time: Thu Mar 17 09:33:04 2011 Running script AreaConversion... <type 'exceptions.EOFError'>: EOF when reading a line Failed to execute (AreaConversion). Failed at Thu Mar 17 09:33:04 2011 (Elapsed Time: 0.00 seconds) Thanks.
... View more
03-17-2011
07:33 AM
|
0
|
0
|
1520
|
POST
|
I have tried adding the script to a custom toolbox that I have made. When I do this the script is added to the toolbox but when I run the tool the tool bombs and gives and error message. I can't get the script tool to run without bombing. Any ideas? Thanks, Kurt
... View more
03-17-2011
06:18 AM
|
0
|
0
|
1520
|
POST
|
I am new to using python scripting and need help making my python script into a script tool. My script converts area measurments into other area units. It runs fine in pythonwin and gives me correct output but when I try to attach it to a script tool it just bombs. I could use all the help that anybody would be willing to give me. Below is my coding for the conversions. Thanks. #create an empty dictionary areaD = {} # populate dictionary using indexing and assignment with units and conversion factors relative to sqmeter = 1.0 # to convert x sqmeters to any of the other area units multiply by the factor # to convert x of any of the other area units to sqmeter divide by the factor # to convert x of any area unit to any of the other area units go over interim sqmeter # this minimizes the total number of conversion factors areaD['sqmeter'] = 1.0 areaD['sqmillimeter'] = 1000000.0 areaD['sqcentimeter'] = 10000.0 areaD['sqkilometer'] = 0.000001 areaD['hectare'] = 0.0001 areaD['sqinch'] = 1550.003 areaD['sqfoot'] = 10.76391 areaD['sqyard'] = 1.19599 areaD['acre'] = 0.0002471054 areaD['sqmile'] = 0.0000003861022 def convertArea(x, unit1, unit2): """area conversion with error trapping""" if (unit1 in areaD) and (unit2 in areaD): factor1 = areaD[unit1] factor2 = areaD[unit2] return factor2*x/factor1 else: return False number=1 while x != 0: number = raw_input ("Number of Units:") unit1 = raw_input ("Unit Converting From:") unit2 = raw_input ("Unit Converting To:") outcome = convertArea(x, unit1, unit2) if outcome is not False: print "%f %s = %f %s" % (x, unit1, outcome, unit2) else: print "There was an error converting %s to %s" % (unit1,unit2)
... View more
03-16-2011
12:55 PM
|
0
|
8
|
4292
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|