Skip to content

Inspect

A test surface is read from one side only. A carving and a Simulate study see the side its normal points to: a surface that faces into a building, or a roof that faces down, sees nothing, so the criterion barely protects it and nothing else in the app says so. Inspect shows which way every test surface faces, lets you turn the ones that face the wrong way by clicking them, and gives a short summary of every input mesh file.

Inspect is a workspace beside the pipeline, like Simulate. It runs no engine step, changes no criterion or setting and makes nothing out of date by itself. Only Save and Restore original change a file, and only when you press them.

USC does not decide which way a surface should face. Only you know whether a surface is a roof for PV, a facade, or a soffit that faces down on purpose. Inspect shows the orientation and leaves the choice to you.

Carve, Simulate and Inspect

The switch Carve | Simulate | Inspect in the header, next to the project name, changes the workspace. Inspect hides the steps and gives the 3D view the whole window. Switching away keeps Carve's step and scroll position and Simulate's selection as they were. The Layers menu and the viewer tools are the same in all three; Inspect adds one layer, Surface orientation.

Inspect works while a run of the project is going. Only Save and Restore original wait for it to end, as uploads do.

The first time a test surface file is imported into a project, a prompt under the Site step's Test surfaces box asks to check which way its surfaces face before a run. Open Inspect opens Inspect with that file selected; Not now closes the prompt. Either answer is kept in the project (project.json, inspect_prompt_answered), so the prompt is shown once per project. Drawn and picked sets do not bring it, and neither do files of the other roles: only a test surface is read from one side.

The Geometries panel

The Geometries panel floats over the top left of the 3D view and collapses to an icon. It lists the input mesh files by role: maximum volume, test surfaces, existing surroundings and terrain. The weather file has no geometry and is not listed. Each row gives the file name, its triangle count and its area. A file that cannot be read stays in the list with its problem, for example a broken export, and has nothing to select.

Pressing a row selects the file. The view frames it, in the part of the view the Geometries panel does not cover, and draws the other test surface files faint, so you see what the selected one faces. The selected row also opens the file's summary:

  • Bounds: the minimum and maximum corner in the file's own coordinates. When a corner is more than 10 km from zero, a note says the coordinates look georeferenced and how far they are. The info "i" beside the panel's title says which point the view is drawn around, since the view uses a local origin: "The view is drawn around x -141, y -91.72, z 0 of the files' coordinates."
  • Surfaces, for a test surface file: how many surfaces it has (below).
  • Surfaces a run leaves out, for a test surface file that has any: "3 of 43 surfaces are not flat: a run leaves them out.", and the same for surfaces with no area. The view draws them in the error colour on the selected file. The rule is the one the run's sampling applies (surface_sampling.skip_reasons, the same function the run calls for each surface): a surface whose faces turn more than 5° from its mean normal and leave its plane by more than 0.1 mm is not flat, so a sliver a few micrometres high on a flat face does not count. A surface too small for the grid is known only after a run, since it depends on each criterion's grid step; the Skipped test surfaces layer reports it (ui). Inspect does not repair a surface: split it into flat faces in the modelling tool.

An earlier version also counted closed bodies. It was dropped: CAD exports (Rhino's OBJ, for one) keep a corner per face, with that face's normal, so faces share no edges and every face counted as an open body (Allatini's maximum volume: 0 of 24). The voxelizer does not depend on it either: it fills by ray crossings along three axes with a two-of-three vote, so a missing floor or a T-junction does not change the voxels.

The summary is worked out when Inspect asks for it, not at upload, and it is kept until the file changes. The first time, a large file takes seconds to read, and the panel says Reading the files… until the list is there. The test surface and maximum volume files are read as the engine's loader reads them, with their normals made consistent, so the triangles you see are the ones the engine uses. The surroundings and terrain files are read as stored, without that step, as the engine reads them too: nothing reads their orientation, and fixing it takes seconds on a large mesh.

What the colours and face normals mean

Test surfaces are drawn two-sided. The side the normal points to has the test surface colour of the viewport theme. The back side is orange. A surface that is the wrong way round therefore shows orange when you look at it from outside, whichever side of it the camera is on.

The Face normals box in the panel draws one normal per surface, an arrow from its centre along its normal, 0.3 times the square root of its area long, between 1 m and 10 m. One per surface rather than per triangle keeps a large file readable. The normals do not take clicks. A surface you have turned and not saved is drawn, and its normal points, the new way.

The maximum volume is drawn see-through, and the surroundings and the terrain grey, as in Carve. Their orientation is not drawn: nothing reads the orientation of the surroundings and terrain, and the loader turns the closed bodies of the maximum volume outward by itself.

Surfaces, and why a click turns a whole surface

A surface is a set of triangles joined by shared edges, as the engine's loader reads the file. A click in flip mode turns the whole surface under the pointer, not the single triangle. The loader makes neighbouring triangles agree in winding, so a lone triangle turned in the file would be turned back the next time the file is loaded.

For the same reason a test surface file that is closed as a whole cannot be flipped. The loader turns every closed body outward, so its surfaces would come back the way they were. Such a file shows This file is closed as a whole, so its surfaces cannot be flipped. and its Flip mode and Flip all buttons are off.

A set made in the app is not flipped either. A set picked on the context is built again from its picks whenever the context files change, and each face looks toward where it was clicked from, so a flip saved in Inspect would be undone at the next change. Its row says Picked on the context: each face looks toward where it was clicked from. To turn one, pick it again from the other side. A set drawn on the ground is built again from its outline and always faces up; its row says Drawn on the ground: it faces up. Inspect still draws both, so a picked face that looks the wrong way shows orange.

Flipping

Flipping applies to test surface files only. Select a test surface file, then:

  • Flip mode (a toggle on the selected row): a click on a surface turns it, and a second click turns it back.
  • Flip all turns every surface of the file, for a whole export that came out the wrong way round.

Turns are staged. The view shows them at once and the row says, for example, "3 surfaces flipped, not saved". Nothing is written until you press Save, so the criteria go out of date once, not at every click. Discard drops the staged turns.

Save

Save writes the file once, in its own format:

Format What is written
OBJ The coordinates with 10 decimals
PLY float64 coordinates
GLB, STL float32, as these formats hold nothing finer; coordinates are kept as precisely as the format allows

A GLB or STL that another program wrote with coordinates float32 cannot hold exactly may have a corner move by about one float32 step when it is saved: for a GLB that is about 4 µm at 50 m from the file's whole-metre offset, for an STL about 0.25 mm at 4 km from zero. OBJ and PLY corners do not move.

The service then reads the written file back with the engine's loader and compares it with what you turned. If the triangles or their normals are not what was written, or a corner moved by more than 1 µm (for GLB and STL, more than two float32 steps at the file's largest coordinate), nothing is saved and the file stays as it was. A saved file keeps the geometry only. USC reads geometry only, so OBJ groups, materials and texture coordinates and PLY colours are not in the saved file. The original, which is kept (below), still has them.

Save has the effects of uploading the file again through the app:

  • The joined files of the criteria and studies that list the file are built again.
  • Those criteria and studies go out of date, and the criteria after them have to carve again. A run traces the file again. When a criterion that had been analysed goes out of date, the panel says how many and offers Go to Carve.
  • The file's record in project.json is renewed. There is no "changed in the project folder" notice, since you made the change in the app.

Save and Restore original are not available while a run of the project is going. The panel says so beside the buttons.

A file that changed in the project folder

Turns are staged on the version of the file Inspect read, and Save sends that version with them. Before it writes anything, the service builds the files changed in the project folder into the project, as when the window comes back to the front, and compares the file stored now with that version. If you replaced the file by hand meanwhile, even with one that has as many triangles and surfaces and the same bounds, Save writes nothing and says The file changed in the project folder since its surfaces were turned, so nothing was saved. Its staged turns are dropped, since the surfaces of the new version are numbered anew, and Inspect reads the files again. Restore original does the same with The file changed in the project folder since Inspect read it, so nothing was restored., so it never puts an older original over a file you replaced. The kept original of a file replaced by hand is dropped (below), and the file has a "changed in the project folder" notice as any file replaced by hand.

Inspect also reads the files again when the stage status finds a file changed in the project folder, for example when the window comes back to the front, so turns staged on a replaced file are dropped before you press Save.

Restore original

Before the first save of a file, the file as it was is kept in the project folder, in inputs/originals/test_surfaces/. Restore original puts it back byte for byte, with the same effects as a save, and removes the kept copy. The button shows on the selected row while an original is kept.

The kept original is dropped when you upload a file with the same name, when you remove the file in the app, and when you replace the file by hand in the project folder. After that the stored file is the only version, and Restore original is not offered.

Leaving Inspect with turns not saved

Switching to Carve or Simulate, closing the project, or choosing Rename or Reset to the example in the project menu (both open the project afresh) while a file has staged turns, or while a save or restore is under way, asks Save the flipped surfaces before leaving Inspect? with three answers: Save (writes every file with turns, then leaves), Discard (drops them and leaves) and Stay. While a save is under way the dialog says A save is under way., and A restore is under way. while only a restore is; Save and Discard wait for it, and when it is written with nothing left to save the dialog leaves by itself. If a save is refused, the one under way included, for example because a run is going or the file changed in the project folder, the dialog stays open with the reason, so a failed save is never left unseen in another workspace.

A save or restore of a test surface file goes ahead when another stored file cannot be read, for example a context file still being copied or broken; only trouble with the file being saved refuses it.

If a file changed while turns were staged on it (a new version uploaded, or replaced in the project folder), the staged turns are dropped and the panel says The file changed, so its turns not saved were dropped. The surfaces of the new version are numbered anew, so the old turns would not mean the same surfaces.

Surfaces facing into the context

A test surface that faces into the context gives a run no error, but its points are always shaded (the context blocks every ray that meets it), so the criterion barely protects them. A whole export can come out that way. In the summary of a selected test surface file, Find surfaces facing into the context looks for them. Nothing is checked until you press it; while it runs the row says Checking….

For each triangle, the point 5 cm in front of it (along its normal) and the point 5 cm behind it are tested against the context. A triangle faces into the context when its front point is inside it and its back point is not. A surface is found when such triangles hold more than half of its area. So the check finds surfaces lying on the context, within 5 cm of it. Not found, since they may be meant that way or flipping would not help:

  • a surface with both points inside the context, or both outside;
  • a surface facing up, such as ground under a building: turned over it would face down;
  • a surface facing the maximum volume. The maximum volume is what a run carves, not an obstruction: a window facing it is the usual case, and the run cuts the volume away for it.

The direction the context's faces point is not trusted: a point counts as inside it whichever way its faces point. The inside test is the engine's winding number test (solar_check.points_inside).

The row then says, for example, "6 of 43 surfaces face into the context: their points are always shaded, so a run cannot trust them.", "No surface faces into the context." or "There is no context to face into.", and the view draws the surfaces found in the error colour. Flip these stages them as flips, added to the flips staged already; Save or Discard as for any turn. A surface staged to turn is no longer drawn in the error colour, and once all are staged the row says so. A set picked on the context or drawn on the ground gets the sentence but no button, since it cannot be flipped. The result is about the file as stored: it goes when Inspect reads the files again (after a save, a restore, or a file changed), and the button comes back.

Where the service keeps things

The service computes all of this in local_web_service/inspection.py, with trimesh, from the stored files as the engine's loader returns them, so the view and a flip use the triangles the engine uses. Flips use no engine function; the check for surfaces facing into the context (local_web_service/facing_into_mass.py) uses the engine's solar_check.points_inside. Routes (all under /api):

Route What it does
GET /projects/{name}/inspect The summary of every mesh file of the project; allowed while a run is going
GET /projects/{name}/inspect/test_surfaces/{file}/geometry The triangles of a test surface file with a surface number per triangle, as one binary (layout in inspection.inspection_geometry)
GET /projects/{name}/inspect/test_surfaces/{file}/facing-into-mass The surfaces of the file that face into the context (surfaces, their area_m2, masses: ["context"], or empty without a context, the file's version), worked out only when asked and kept until the file or the context file changes; allowed while a run is going
POST /projects/{name}/inspect/test_surfaces/{file}/turn Turn the surfaces named in surfaces of the file of version and save the file; 409 while a run of the project is active, or with stored_file_changed: true when the file stored now is not that version; 422 for a file closed as a whole, a set picked on the context or drawn on the ground (made_in_app in the summary), one that cannot be read, a surface that does not exist, or a file changed in the folder that cannot be read; 500 when the written file does not read as turned
POST /projects/{name}/inspect/test_surfaces/{file}/restore Put the kept original back in place of the file of version; 404 when none is kept, 409 while a run is active or (stored_file_changed) when the file stored now is another

Each file of the summary has a version, the sha256 of its bytes. A turn or a restore names it, and both first build the files changed in the project folder into the project. The service keeps the summary of each file it read, and for a test surface file its triangles and their surfaces, up to 32 files and 5 million kept triangles, the least recently used leaving first.

Not in Inspect

Inspect does not change axes, units, mirroring, heights or coordinates: those are fixed in the modelling program (Preparing geometry). Besides the summary and the surfaces a run leaves out, it checks one thing, and only when you ask: test surfaces facing into the context, which a run cannot trust and which a flip fixes. Overlapping bodies, surfaces inside a mass and the columns the context takes are valid modelling choices and are not checked. It does not inspect the envelope, the massing or the joined files.