POST
|
pyQt and wxPython are popular. It will take some time to learn either, but it sounds like you're ready for that. There are lots of tutorials and documentation for both out there.
... View more
04-12-2014
02:47 PM
|
0
|
0
|
410
|
POST
|
Sorry about the s vs S typo. I don't use that command very often (I prefer sys.argv). But it's too bad that didn't work. I'll throw in one more simplistic suggestion. You could try to get the modified version to open in another instance of Arc (Map? Catalog?). Take the SetParameterAsText stuff out and put in an os.startfile(theFileofInterest) This command launches an instance of the default program associated with that file. I don't think I've tried it with files that are already open in something else. Also, I haven't worked with table views, so I don't know what the default application is.
... View more
04-12-2014
02:43 PM
|
0
|
0
|
1599
|
POST
|
Thanks Matt! I don't know why os.path.abspath(__file__) gave me an empty string before. (Probably the lag time between each edit of the ToolValidator is doing my head in!) In fact, it gives something like this: 'path to toolbox\toolboxName.tbx#scriptToolName.UpdateMessages.py' I can take it from there...
... View more
04-12-2014
02:02 PM
|
0
|
0
|
291
|
POST
|
Nice! At least we can get the toolbox path from that. Thanks.
... View more
04-12-2014
01:28 PM
|
0
|
0
|
414
|
POST
|
Hi All, From inside the ToolValidator in a script tool, is there a way to determine the path of the script to which a script tool is pointing? I'd like to set the default value of an input data file based on its relative path to the script. An acceptable alternative for me would be to detect the location of the toolbox containing the script tool. But the following return empty strings inside the ToolValidator class: os.getcwd
sys.argv[0]
os.path.abspath(__file__)
inspect.getfile(inspect.currentframe()) Thanks!
... View more
04-12-2014
06:59 AM
|
0
|
3
|
397
|
POST
|
I haven't tried it, but you could try making the table view a derived output (set the script tool parameter type and direction properties) and then using arcpy.setParameterAsText(theTableParameterIndex, theTableVariableName) at the end of your script. I believe, that I have found that this does update existing feature class tables when I add a field (in a script tool) to something that's already open.
... View more
04-12-2014
06:57 AM
|
0
|
0
|
1599
|
POST
|
Okay, thanks. So I guess in Python terms, it may be useful to think of the filter list as a tuple instead of a list, since that's more like how it behaves. I didn't realize there's a forum for Python questions now. Should have posted this over there. But I do have an additional question, in case you guys are still following this�?� From inside the ToolValidator, can we access the property that stores the path of the script to which a script tool is pointing? I'd like to set the default value of an input data file based on its relative path to the script. An acceptable alternative for me would be to detect the location of the toolbox containing the script tool. But the following return empty strings inside the ToolValidator class: os.getcwd
sys.argv[0]
os.path.abspath(__file__)
inspect.getfile(inspect.currentframe())
... View more
04-12-2014
06:51 AM
|
0
|
0
|
414
|
POST
|
Hi Folks, Either one of the following statements works to create a spatial reference object (or string) for uses such as calling 'CreatFeatureclass' tool: sr="GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]], \
PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];IsHighPrecision"
or sr = arcpy.SpatialReference('WGS 1984') Then you can do the following to get a new feature class that uses the 'sr' variable: arcpy.CreateFeatureclass_management(mydir,fc, 'POINT','#','#','#', sr) Here's my question: I like using the second statement better. But I don't know how to refer to any other reference systems in this way, because I don't know the handle of any other ones. Is there a list of the short names (or aliases) available for all (or at least the most popular) of the reference systems? Thanks!
... View more
04-01-2014
04:52 AM
|
0
|
0
|
335
|
POST
|
Hi Folks, if you put the following code into a script tool 'toolValidator' class 'updateParameters' method, it only puts 'fee' in the list (no error is thrown). self.params[0].filter.list = ['fee'] self.params[0].filter.list.append('foo') The documentation says the 'list' filter property is a Python list. My question is, why can't I append? (The examples in the documentation all hard code the list... which makes me wonder if the authors know about this problem but didn't have time to fix it). Thanks!
... View more
03-28-2014
02:15 PM
|
0
|
9
|
738
|
POST
|
thanks, Mark. I'm feeling a bit concerned about it not showing up. Could this mean that it's not going to be considered as a bug? I've had several interactions with some Esri folks about this and they pointed out that if you run a script from the command line (or double click it to run in directly with python.exe), this bug doesn't occur. Or if you run it in Pyscripter this bug doesn't occur. So one suggested solution was to switch IDE's --sort of implying that this wasn't really a bug. They pointed out several special cases where all the locks ARE deleted. They said they'd change the documentation to match the current behavior--but they never agreed that the behavior needed to change. This bug even occurs within the ArcGIS Python window, for heavens sake. So...I'm hoping it will get attention very soon.
... View more
04-03-2013
10:37 AM
|
0
|
0
|
156
|
POST
|
Edit: I can't seem to be able to find the NIM entry on the support page though. Is it new? Is there a place to track updates on bugs if we know the number? I'm very interested to see what's going to happen with NIM089529 Apologies if this is stupid questions. I did try googling it for a while, but no luck yet. Thanks
... View more
04-03-2013
07:42 AM
|
0
|
0
|
870
|
POST
|
If you just want squares, all of the same size, can't you just shift the points systematically so that (maybe by modifying the easting and northing values) and then use the centroid tool?
... View more
04-03-2013
07:15 AM
|
0
|
0
|
209
|
POST
|
No, I really don't think the None constant was the problem. I bet it has to do with those special characters in your data. I don't have any data like that to test, but I do have data with <<Null>> values and it worked fine for that. My guess is that the special chars in the the strings were stymieing the len function. Basically, you're just testing if the string is empty or null. So it could be done as: if a! = '' and a =! None:
... View more
03-15-2013
12:44 PM
|
0
|
0
|
149
|
POST
|
Nevermind about the data. I found some of my own that has Nulls... Here's the solution: def count(a,b,c,d,e): x = 0 if len(a) != 0 and a != None: x +=1 if len(b) != 0 and b != None: x +=1 ... and so forth return str(x) None is a built-in Python constant. Not a string spelled 'None'. You have to check against the constant. In fact, a much more sleek (though less transparent) solution would be: def count(a,b,c,d,e): x = 0 if a: x +=1 if b: x +=1 ... and so forth return str(x)
... View more
03-11-2013
06:27 AM
|
0
|
0
|
684
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|