mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 20:00:02 +00:00
You can now specify custom min/max for quantitative legends
This commit is contained in:
@@ -264,8 +264,10 @@ class ColourByProperty(Operator):
|
|||||||
colourscheme = {}
|
colourscheme = {}
|
||||||
|
|
||||||
obj_values = {}
|
obj_values = {}
|
||||||
min_value = None
|
min_mode = props.min_mode
|
||||||
max_value = None
|
max_mode = props.max_mode
|
||||||
|
min_value = props.min_value if min_mode == "MANUAL" else None
|
||||||
|
max_value = props.max_value if max_mode == "MANUAL" else None
|
||||||
|
|
||||||
if is_qualitative and len(props.colourscheme):
|
if is_qualitative and len(props.colourscheme):
|
||||||
colourscheme = {cs.name: {"colour": cs.colour[0:3], "total": 0} for cs in props.colourscheme}
|
colourscheme = {cs.name: {"colour": cs.colour[0:3], "total": 0} for cs in props.colourscheme}
|
||||||
@@ -292,10 +294,12 @@ class ColourByProperty(Operator):
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
value = float(value)
|
value = float(value)
|
||||||
if min_value is None or value < min_value:
|
if min_mode == "AUTO":
|
||||||
min_value = value
|
if min_value is None or value < min_value:
|
||||||
if max_value is None or value > max_value:
|
min_value = value
|
||||||
max_value = value
|
if max_mode == "AUTO":
|
||||||
|
if max_value is None or value > max_value:
|
||||||
|
max_value = value
|
||||||
obj_values[obj] = value
|
obj_values[obj] = value
|
||||||
except:
|
except:
|
||||||
obj.color = (0, 0, 0, 1)
|
obj.color = (0, 0, 0, 1)
|
||||||
|
|||||||
@@ -142,6 +142,22 @@ class BIMSearchProperties(PropertyGroup):
|
|||||||
],
|
],
|
||||||
name="Palette",
|
name="Palette",
|
||||||
)
|
)
|
||||||
|
min_mode: EnumProperty(
|
||||||
|
items=[
|
||||||
|
("AUTO", "Automatic", "Automatically determine the minimum value"),
|
||||||
|
("MANUAL", "Manual", "Manually specify the minimum value"),
|
||||||
|
],
|
||||||
|
name="Min Mode",
|
||||||
|
)
|
||||||
|
max_mode: EnumProperty(
|
||||||
|
items=[
|
||||||
|
("AUTO", "Automatic", "Automatically determine the maximum value"),
|
||||||
|
("MANUAL", "Manual", "Manually specify the maximum value"),
|
||||||
|
],
|
||||||
|
name="Max Mode",
|
||||||
|
)
|
||||||
|
min_value: FloatProperty(name="Min Value", default=100)
|
||||||
|
max_value: FloatProperty(name="Max Value", default=100)
|
||||||
colourscheme: CollectionProperty(type=BIMColour)
|
colourscheme: CollectionProperty(type=BIMColour)
|
||||||
active_colourscheme_index: IntProperty(name="Active Colourscheme Index")
|
active_colourscheme_index: IntProperty(name="Active Colourscheme Index")
|
||||||
filter_type: StringProperty(name="Filter Type")
|
filter_type: StringProperty(name="Filter Type")
|
||||||
|
|||||||
@@ -88,6 +88,17 @@ class BIM_PT_colour_by_property(Panel):
|
|||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
row.prop(props, "palette")
|
row.prop(props, "palette")
|
||||||
|
|
||||||
|
if props.palette not in ("tab10", "paired"):
|
||||||
|
row = self.layout.row(align=True)
|
||||||
|
row.prop(props, "min_mode", text="Min Value")
|
||||||
|
if props.min_mode == "MANUAL":
|
||||||
|
row.prop(props, "min_value", text="")
|
||||||
|
|
||||||
|
row = self.layout.row(align=True)
|
||||||
|
row.prop(props, "max_mode", text="Max Value")
|
||||||
|
if props.max_mode == "MANUAL":
|
||||||
|
row.prop(props, "max_value", text="")
|
||||||
|
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.operator("bim.colour_by_property", icon="BRUSH_DATA")
|
row.operator("bim.colour_by_property", icon="BRUSH_DATA")
|
||||||
row.operator("bim.reset_object_colours")
|
row.operator("bim.reset_object_colours")
|
||||||
|
|||||||
Reference in New Issue
Block a user