From 2d9dea5631666f47b37100161216d30bade84609 Mon Sep 17 00:00:00 2001 From: CMorley Date: Sat, 21 Dec 2024 23:53:46 -0800 Subject: [PATCH] qtvcp -vismachL add HideCollection function hides parts when HAL pin is true --- lib/python/qtvcp/lib/qt_vismach/primitives.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/python/qtvcp/lib/qt_vismach/primitives.py b/lib/python/qtvcp/lib/qt_vismach/primitives.py index 5f3666db680..178176b12cd 100644 --- a/lib/python/qtvcp/lib/qt_vismach/primitives.py +++ b/lib/python/qtvcp/lib/qt_vismach/primitives.py @@ -125,6 +125,25 @@ def set_volume(self, vol): self.vol = vol; +class HideCollection(Collection): + def __init__(self, parts, comp, var): + self.parts = parts + self.comp = comp + self.var = var + self.vol = 0 + + def traverse(self): + try: + if self.comp is None: + v = bool(hal.get_value(self.var)) + else: + v = bool(self.comp[self.var]) + except: + v = 0 + if v: + return + super(HideCollection,self).traverse() + class Translate(Collection): def __init__(self, parts, x, y, z): self.parts = parts