Select to view content in your preferred language

Add an arcpy class with availabes enums of CLSID

104
2
Friday
Status: Open
HildermesJoséMedeirosFilho
Occasional Contributor

https://pro.arcgis.com/en/pro-app/latest/arcpy/geoprocessing_and_python/parameter-controls.htm

It would be helpful if something like arcpy.parameters.appearance.multiline_text_clsid (or similar) existed. This would make it easier to programmatically access control CLSIDs. Such an approach would improve usability and maintainability, as developers wouldn't need to search for or manually input CLSIDs.

Having a structured API like this would make programming more efficient and less error-prone.

Tags (3)
2 Comments
DavidSolari

I'm a simple man, I see "add an enum to arcpy", I hit the thumbs up button.

HaydenWelch

I usually just slap this code into a module or at the top of my toolfile:

 

class ControlCLSID(Enum):
    """ See [Parameter Controls](https://pro.arcgis.com/en/pro-app/latest/arcpy/geoprocessing_and_python/parameter-controls.htm)
        documentation for more information on parameter controls.
    """
    EXCLUDE_INTERSECT_AND_UNION = '{15F0D1C1-F783-49BC-8D16-619B8E92F668}'
    SLIDER_RANGE = '{C8C46E43-3D27-4485-9B38-A49F3AC588D9}'
    LARGE_NUMBER = '{7A47E79C-9734-4167-9698-BFB00F43AE41}'
    COMPOSITE_SWITCH = '{BEDF969C-20D2-4C41-96DA-32408CA72BF6}'
    MULTILINE = '{E5456E51-0C41-4797-9EE4-5269820C6F0E}'
    MULTIVALUE_CHECKBOX = '{172840BF-D385-4F83-80E8-2AC3B79EB0E0}'
    MULTIVALUE_CHECK_ALL = '{38C34610-C7F7-11D5-A693-0008C711C8C1}'
    FEATURE_LAYER_CREATE = '{60061247-BCA8-473E-A7AF-A2026DDE1C2D}'
    HORIZONTAL_VALUE_TABLE = '{1AA9A769-D3F3-4EB0-85CB-CC07C79313C8}'
    SINGLE_VALUE_TABLE = '{1A1CA7EC-A47A-4187-A15C-6EDBA4FE0CF7}'

 

 

I think there are still some hidden/undocumented ones, so having a version of that maintained by Esri in arcpy proper would be great

 

You can also just use a dictionary so you don't need to have the Enum class and you can get some intelisense since it's a constant:

ControlCLSID = {
    'EXCLUDE_INTERSECT_AND_UNION':'{15F0D1C1-F783-49BC-8D16-619B8E92F668}',
    'SLIDER_RANGE':'{C8C46E43-3D27-4485-9B38-A49F3AC588D9}',
    'LARGE_NUMBER':'{7A47E79C-9734-4167-9698-BFB00F43AE41}',
    'COMPOSITE_SWITCH':'{BEDF969C-20D2-4C41-96DA-32408CA72BF6}',
    'MULTILINE':'{E5456E51-0C41-4797-9EE4-5269820C6F0E}',
    'MULTIVALUE_CHECKBOX':'{172840BF-D385-4F83-80E8-2AC3B79EB0E0}',
    'MULTIVALUE_CHECK_ALL':'{38C34610-C7F7-11D5-A693-0008C711C8C1}',
    'FEATURE_LAYER_CREATE':'{60061247-BCA8-473E-A7AF-A2026DDE1C2D}',
    'HORIZONTAL_VALUE_TABLE':'{1AA9A769-D3F3-4EB0-85CB-CC07C79313C8}',
    'SINGLE_VALUE_TABLE':'{1A1CA7EC-A47A-4187-A15C-6EDBA4FE0CF7}',
}