Repository navigation
Show the family types of an .rfa page and compute them in the page - #100
Merged
Merged
Conversation
An HTML page of a Revit family carries its types (ViewerDocument.FamilyTypes): their parameters, and for each type its meshes or the reason it has none. With two or more types the viewer opens a Family type panel; choosing a type shows its geometry and parameters, and selection, measurement, sections and fitting see the chosen type only. Viewer JSON, .ivmesh and --add outputs keep the saved type only and the CLI says so. On such a page the vertex positions are written as float32 instead of on the 1/1024 m grid, which moved a vertex by up to half a millimetre, and each material is drawn slightly nearer than the one before it. Faces of two parts that coincide (a flange bore on the ring it sits on) no longer alternate between the two parts per pixel. Other pages are written and drawn as before.
Revit shades a part with no material grey 127 and, in its shots of a sample valve, a flange of material colour 120 comes out at 0.945 of it. The viewer draws a part with no colour 200, a tone close to Revit's, so the plain flange (0.6 of it) was much darker than in Revit. The colours of a family page are now scaled by 200 / 127, which makes 120 into 189. Pages of other documents and parts with no colour are not changed.
A page of a family is now lit by one light fixed to the view, applied to the colour values of the screen and fitted to Revit's shots of a sample valve, and a part with no material is grey 127; the colour gain of the previous commit is gone. Highlight, tint and white mode keep the viewer's lights, since the brighter formula would clip them. The viewer also keeps the float32 positions of such a page. It snapped merged vertices back to the 1/1024 m grid, which folded the narrow facets of circles into dark lines on cylinders and speckle on cones. Other pages are written and drawn as before.
The materials of a family page are told apart by a depth bias where their faces coincide. Its part by slope moved a face seen at a grazing angle far more than the others and drew end faces through the bore of a flange as thin dark lines that Revit does not draw. The bias is now in units of the depth buffer only. Without a graphics card some coinciding faces still show as dashes at a grazing angle, most when the parts over them are hidden by hand.
A family page now holds the saved type and the program of RvtIO.Scene that computes the others (ViewerFamilyTypes.Program), so it no longer grows with the number of types. The CLI exports an .rfa this way; --bake-family-types stores the meshes of every type as before. The program starts at the first change of type. Until it is ready the panel is busy and the page keeps what it shows, then shows the type chosen last. A type the program refuses says why, and so does every type when the program cannot start. A computed type replaces the geometry of the scene: hidden, highlighted and tinted elements, the clipping and the order of the materials stay. The release of RvtIO.Scene that has the program is not out yet, so Directory.Packages.props is not changed.
Merged
2 of 4 tasks
Both sides are kept: the family types, and the CAD lines, annotations, sheets and element table of main. A computed family type replaces the geometries of the page, so a page that computes its types now refuses lines as it refuses points. The chosen annotation sheet stays when the geometry is replaced.
mahach666
marked this pull request as ready for review
December 4, 2026 02:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes and why
An HTML page of a Revit family (
.rfa) should show the types of the family and let the reader switch between them. This is the viewer side of IOExtend/RvtIO#358.ViewerDocument.FamilyTypescarries the types and their parameters. With two or more types the viewer opens a Family type panel; choosing a type shows its geometry and parameters, and selection, measurement, sections and fitting see the chosen type only. A type without geometry says why. Viewer JSON,.ivmeshand--addoutputs keep the saved type only, and the CLI says so.ViewerFamilyTypes.Program), so the page does not grow with the number of types.--bake-family-typesstores the meshes of every type instead. The program starts at the first change of type; until it is ready the panel is busy and then shows the type chosen last. Such a page holds no points and no lines (a document with them is refused), since a computed type replaces the geometries of the page.How the generated HTML changes: the page embeds the rebuilt viewer script and the template has a place for the family program. A family page with a program holds two more script blocks. Pages of other documents hold no program and are meant to be written and drawn as before.
Not ready to merge
RvtIO.Scenethat contains Read the types of a family and compute the shape of each one from the file RvtIO#358.Directory.Packages.propsis not changed (a lower bound is committed only once the version is on nuget.org), so the CI build fails until then.DecompressionStream.How it was checked
dotnet build IOViewer.slnx -c Releasehas no warningsdotnet test IOViewer.slnx -c Releasepassesmain: 269 passed, 1 skipped, on net8.0 and net10.0. It does not build with the version pinned now.main:npm run buildleavesdist/viewer.jsas committed;npm test230 passed; the whole Chromium end-to-end set passed (191). Firefox was not run.THIRD-PARTY-NOTICES.md