I have a dll and I'd like to call it in python. The dll needs of parameters. Do you know how to pass a radiobutton parameter and a checkbox parameter? thanks
|
|
I am assuming you mean by your question that your Arc tool has a radiobutton and checkbox parameter in the interface (rather than 'radiobutton' and 'checkbox' being native types in whatever language you write the DLL in). So - do you really need your DLL to know what flavour of user interface element the parameter came from, or would it be better if the DLL was agnostic of how it was called, and just did the computation? Checkboxes pass from arc to python as booleans. Radio buttons - I didn't know you could make them, I thought you had to use a string with an input filter. Play around with the tool properties dialog to achieve this; create your parameters, select the string parameter, and then clicking on the '...' after 'Filter' will allow you to enter the values you want available. Then in the python:
Ctypes will automatically convert
I assume you'll have other parameters and may also have to use ctypes to set a return type for dll.run, if it has one. Alternatively, convert your strings to integers in the python, e.g.
and pass them to the dll as integers; though you'll then need to keep three representations in sync: the script parameter dialog, that list in the python and a matching enum in the C. |
|||||
|