Das Wissen aller Anwender nutzen

Im Allplan Connect Forum tauschen sich Anwender aus, geben wertvolle Tipps oder beraten sich bei ganz konkreten Aufgabenstellungen − auch international.
Und damit wirklich keine Frage unbeantwortet bleibt, unterstützen die Mitarbeiter des Technischen Supports ebenfalls aktiv das Forum.

Es erwarten Sie:

  • Foren-Vielfalt aus CAD Architektur, CAD Ingenieurbau uvm.
  • Tipps von User für User
  • international: Deutsch, Englisch, Italienisch, Französisch und Tschechisch

Melden Sie sich jetzt an und diskutieren Sie mit!

Zur Registrierung

[Frage] [PythonParts] Background Color

Schlagworte:
  • Pythonpart
  • BackgroundColor

Hi,

I have some issues with a dynamic background in a standard PythonPart.

I had set 3 « Double » for rebars :

1) As min
2) As real
3) As max

I'd like to be notified if the value is too low or too high.

So, based on the example I had :


<BackgroundColor>(255, 0,0) if AsReal &lt; AsMin or AsReal &gt; AsMax else (-1, -1, -1)</BackgroundColor>

This works great, but when I close the PythonPart and open it later, the background color disappears until I change one of these values to recalculate.

I don't know how to "refresh" the color calculation when launching the PythonPart.

Best regards

Hi Christophe!

Is your PythonPart designed an interactor or a standard PythonPart? I presume, with the first one it would be easier to solve your problem.

Best!
Bart

Hi,

It's a standard PythonPart (spoiler alert the code will be 100% open source via APIHub )

So, it's not a blocking problem, I'd just like the background color to stay

Hello,

The problem would not be a problem to solve with an interactor, because you as the developer are responsible for starting the palette. You could recalculate it on start. In a Standard PythonPart, you could try to implement some actions inside the initialize_control_properties. Through this function you have the access to the ControPropertiesUtil object, which have the method set_background_color. You can additionally set the initial background color there. Hope, that helps.

Best,
Bart

Hi,

same problem with :

if build_ele.AsRealDouble.value < build_ele.AsMinDouble.value or build_ele.AsRealDouble.value > build_ele.AsMaxDouble.value:
        ctrl_prop_util.set_background_color("AsRealDouble", "(255, 0, 0)")

in the initialize_control_properties