feat: add optional color override to Mesh.from_solid#3169
feat: add optional color override to Mesh.from_solid#3169jmcouffin merged 2 commits intopyrevitlabs:developfrom
Conversation
There was a problem hiding this comment.
PR Summary:
- Adds optional
colorparameter (DB.ColorWithTransparency, defaultNone) toMesh.from_solid - When provided, the color is applied uniformly to all faces, bypassing per-face material lookup
- Original per-face material color behaviour preserved when
color=None - Developer example UI updated with a
CheckBoxto toggle color override inbutton_select
Review Summary:
The core logic change in dc3dserver.py is clean and correct — renaming the loop variable from color to face_color properly avoids shadowing the new parameter. The conditional priority (color override → by-category fallback → material lookup) is correct.
Two minor bugs were found in the example/demo code: the CheckBox.IsChecked nullable bool check is non-idiomatic for IronPython WPF interop, and the checkbox lacks Grid.ColumnSpan="2" in the XAML causing it to render in only the narrow label column. A docstring inconsistency was also flagged: Raises: TypeError is documented but the exception is silently swallowed by the bare except: block.
Follow-up suggestions:
@devloaifix the identified issues (nullable bool check, ColumnSpan, and misleading Raises docstring)
...ension/pyRevitDev.tab/Developer Examples.panel/DirectContext3D.pushbutton/dc3dtest_script.py
Show resolved
Hide resolved
...evTools.extension/pyRevitDev.tab/Developer Examples.panel/DirectContext3D.pushbutton/ui.xaml
Show resolved
Hide resolved
|
another good one! |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2048-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2106-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2130-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26086+2004-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26088+1318-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26089+1231-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+0549-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1533-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1536-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1540-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1540-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1556-wip |
|
📦 New public release are available for 6.2.0.26090+1754 |
Description
Adds a color parameter (
DB.ColorWithTransparency, defaultNone) toMesh.from_solid. When supplied, the given color is applied uniformly to all faces, bypassing per-face material lookup. WhenNone, existing behaviour is preserved — faces use their material color, falling back to white for<By Category>.Checklist
Before submitting your pull request, ensure the following requirements are met:
pipenv run black {source_file_or_directory}