[Otázka] [PythonParts] Handles [Vyřešeno]

Tagy:
  • PythonParts
  • Handles

Hi,

Is it possible to specify a step for the handles (40-50-60-...-300 for example) ?

In pyp file I'm using slider like this :

<Parameter>
<Name>Thickness</Name>
<Text>Épaisseur</Text>
<Value>80</Value>
<MinValue>40</MinValue>
<MaxValue>300</MaxValue>
<ValueType>Integer</ValueType>
<ValueSlider>True</ValueSlider>
<IntervalValue>10</IntervalValue>
</Parameter>

but the handle is "free"

Best

Show solution Hide solution

You can write your own "Handle Intervall" inside the function
def move_handle(build_ele, handle_prop, input_pnt, doc):

There you can override the min-max-values and do some rounding for steps in the measured length.
You can do that after

build_ele.change_property(handle_prop, input_pnt)

but before
return create_element(build_ele, doc)

with:
prop_names = handle_prop.ele_prop_list
    for prop_name in prop_names:
      name = prop_name[0]
      modify_element_property(build_ele, name , None)

and:

def modify_element_property(build_ele, name, value):
    """
    Modify property of element

    Args:
        build_ele:  the building element.
        name:       the name of the property.
        value:      new value for property.

    Returns:
        True/False if palette refresh is necessary
    """
    ret = False
    if name == 'LengthX' or name == 'LengthY':
       ...
       ret = True


    return ret

Přílohy (1)

Type: image/png
Staženo 40
Size: 11,02 KiB

You can write your own "Handle Intervall" inside the function
def move_handle(build_ele, handle_prop, input_pnt, doc):

There you can override the min-max-values and do some rounding for steps in the measured length.
You can do that after

build_ele.change_property(handle_prop, input_pnt)

but before
return create_element(build_ele, doc)

with:
prop_names = handle_prop.ele_prop_list
    for prop_name in prop_names:
      name = prop_name[0]
      modify_element_property(build_ele, name , None)

and:

def modify_element_property(build_ele, name, value):
    """
    Modify property of element

    Args:
        build_ele:  the building element.
        name:       the name of the property.
        value:      new value for property.

    Returns:
        True/False if palette refresh is necessary
    """
    ret = False
    if name == 'LengthX' or name == 'LengthY':
       ...
       ret = True


    return ret

Přílohy (1)

Type: image/png
Staženo 40
Size: 11,02 KiB