Command: ColourByAttribute
Description:
Colours a copy of selected objects by a chosen user-text attribute. Supports numeric, datetime, or categorical attributes. For numeric/datetime it creates a colour ramp and optional PNG legend. For categorical, it assigns discrete colours and can export a legend. It duplicates objects into a layer named “By_<attribute>” and applies colours & materials to the duplicates.
Required user inputs:
Select objects to color.
Choose attribute key from those found on the objects.
If numeric: minimum and maximum values for the colour ramp, choose a matplotlib colormap (if available).
Optionally save a PNG legend.
Usage example (one-liner):
Select objects, run ColourByAttribute and pick the attribute “Grade” (or another key); save a legend PNG if desired.
Notes:
Makes a duplicate layer (preserves originals). Requires matplotlib for richer legends; falls back to built-in ramps otherwise.