Quantcast
Channel: Forums - Geoprocessing
Viewing all articles
Browse latest Browse all 1952

ArcTool: simulating 'Use selected features' option

$
0
0
I have an ArcTool that runs a Python script. One thing I've always liked about out-of-the-box tools in ArcMap is that they often have the 'Use Selected Features' checkbox. If nothing else they warn the user that the process may only be applied to part of the layer instead of the entire thing.

This checkbox needs to be enabled when the input is a featurelayer. The box is automatically checked when there is already a selection on that layer. If the layer is a featureclass, then the checkbox is disabled.

I've tried programming that into the Tool Validation class and it sort of works, but using GetCount to compare the featurelayer recordcount to the featureclass record count is way too slow for large datasets. This causes the tool to 'hang' for quite a while.

I really don't care how many records are selected, just if there is a selection- True or False. Does anybody have a suggestion for quickly finding out if a selection has been applied? I'm hoping there's a layer property in arcpy.mapping that might work, but I don't see anything obvious.


-Steve

Viewing all articles
Browse latest Browse all 1952

Trending Articles