[Frage] [PythonParts] Dynamic CheckBox using ControlProperties [Gelöst]

Schlagworte:
  • Pythonpart
  • Interactor
  • CheckBox
  • ControlProperties

Hi,

In a Interactor PythonPart, I'm using ControlPropertiesUtil like in this link

It's working great for String but not for Checkbox

print(self.build_ele_list[0].MyCheckBox.value)
return 0 or 1 (int)

I tried :

ctrl_prop_util.set_value_list('MyCheckBox', 1)

ctrl_prop_util.set_value_list('MyCheckBox', True)

What's the correct syntaxt ?

Best

Lösung anzeigen Lösung verbergen

PS

I can also create another variable :

self.is_hor_mirror = True / False
self.is_vert_mirror = True / False

...

if event_id == 2001:
    self.is_vert_mirror = not self.is_vert_mirror
...

For my personal curiosity, I like to explore some possible solutions keeping in mind what it's possible or not to do with this API

Best

Hi,

a Checkbox has no value list.

Why do you need this call? What's your purpose behind it?

Best regards
Horst

Hi,

I'm developing a script in which the user will have the possibility to apply a symmetry of the object vertically or horizontally via buttons (event_id 2000 and 2001 for example).

The symmetry via the vertical axis determines the opening direction (right or left).

The symmetry along the horizontal axis will place the joinery on the other side of the wall.

I created 2 parameters to check what the user wish, one String placed below for the direction (will be placed in attribute too) and I tried with a CheckBox (no need to be assign in an attribute).

In my script I created a condition :

...

if MyString.value == "droite":
    
    if MyCheckBox.value:
    
    ....



....

The checkbox doesn't have a value_list so I replaced the CheckBox by hidden String in the palette indicating True or False.

Best

Anhänge (1)

Typ: image/jpeg
24-mal heruntergeladen
Größe: 21,32 KiB

PS

I can also create another variable :

self.is_hor_mirror = True / False
self.is_vert_mirror = True / False

...

if event_id == 2001:
    self.is_vert_mirror = not self.is_vert_mirror
...

For my personal curiosity, I like to explore some possible solutions keeping in mind what it's possible or not to do with this API

Best