Skip to content

Conversation

jsdbroughton
Copy link
Contributor

@jsdbroughton jsdbroughton commented Aug 14, 2025

Status: Discussion / RFC — Not for merge

Scope: Revit mesh conversion only. No changes to other hosts.

Enables per-face colouring by grouping faces by material and building geometry per material. This avoids Revit’s tendency to collapse mixed-material face sets into a single mesh with a single averaged colour.

image image image

Why
Revit meshes carry one MaterialElementId. A single connected build often “browns out” multi-material meshes. Building per material preserves face colours (e.g., Rhino → Speckle → Revit analysis/heatmap meshes).

How (high level)

  • Average vertex colours per face (quantised) → resolve/create material.
  • Group faces by that material.
  • Build geometry per group so Revit emits distinct chunks with distinct materials.

Gating / Performance
This path is gated to avoid surprises on large models. Suggested modes:

  • Off (fast path; current behaviour).
  • Auto (default): enable only when colours exist and predicted material groups are below a cap (e.g., 256) and face count below a threshold.
  • Force: always enable (for Grasshopper / Automate / analysis runs).

What’s not included

  • No view/graphics tweaks; no GraphicsStyle/“hide edges” wiring in this PR. If we ship this for analysis meshes, we could optionally add a “no-edges” subcategory later to clean up visuals in Shaded.
  • No appearance assets (Realistic mode). Shaded is the target for this iteration.

Behaviour notes

  • If an explicit display material exists, vertex colours only override when allowed by settings.
  • Colour quantisation caps material proliferation (defaults can be tuned).
  • Non-planar quads are split; n-gons have a safe fallback triangulation.

Risks / Trade-offs
More geometry objects and more materials are enabled; costs scale with face count and unique colours. Hence the gating.

Questions

  • Is the Auto/Off/Force gating sensible forthe default connector vs. GH/Automate?
  • Reasonable defaults for material cap/face threshold?
  • Appetite to add optional “no-edges” styling in a follow-up specifically for analysis meshes?

Enhances handling of non-planar geometry by triangulating quads and n-gons.
Implements more efficient material management and retrieval.
Cleans up redundant code and improves overall maintainability.
Copy link

codecov bot commented Aug 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 41.20%. Comparing base (ea97630) to head (b1adeb0).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1029   +/-   ##
=======================================
  Coverage   41.20%   41.20%           
=======================================
  Files         109      109           
  Lines        3080     3080           
  Branches      293      293           
=======================================
  Hits         1269     1269           
  Misses       1765     1765           
  Partials       46       46           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@libnypacheco
Copy link

This is wonderful, Jonathon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants