10C Inc 3 + 4: I/O and text — the app's whole OCP surface is bound

138/138 symbols across 53 modules. New: IFSelect, Interface, XSControl,
IGESData, STEPControl, IGESControl, RWStl, Graphic3d, NCollection, StdPrs.

**The full app suite passes against this wheel: 1797 passed, 1 skipped — the
same result as the stock wheel**, run from the parity venv.

Getting there needed six methods that no static analysis could have found:
`inventory --check` only sees symbols reached through an import, so a method
called on an instance is invisible to it. The suite found them in one pass, and
one of them (gp_Vec.Reverse, which every outward-normal probe calls) accounted
for 311 of the 255 failing tests on its own. The others: gp_Trsf.SetMirror over
a plane and a point, Geom_Surface.D0, BRep_Builder.MakeFace from a
triangulation, MakePipeShell.SetMode with a fixed binormal, and MakeFace from a
surface plus tolerance.

Open question **S5 is settled: no**. The wheel does not need OCCT's share/
resources. test_inc3_io.py asserts no CSF_* variable is set and then round-trips
STEP and IGES, reading the declared units back off both — which is exactly the
resource-less container the question was about.

The XSTEP readers keep the GIL, amending the blanket "file readers and writers"
line in design.md's GIL policy. STEP and IGES traffic in process-global
Interface_Static state, the IGES reader is documented as not thread-safe, and
the app already serialises imports behind a lock — so holding it costs nothing
and removes a class of question. RWStl, which touches no global state, releases.

XSControl_Reader and IGESData are registered although the app imports neither:
they are the reader base both concrete readers inherit their transfer surface
from, and the model-to-global-section chain the IGES unit probe walks.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DfriM8XUkn7uYf5Dwe2xo6
This commit is contained in:
2026-08-10 20:31:15 +02:00
parent 0ce43a94aa
commit 01a5bcf188
20 changed files with 723 additions and 1 deletions

View File

@@ -0,0 +1,57 @@
/*
OCP.StdPrs — glyph outlines as BRep.
Text emboss loads a bundled font and asks the builder for the text as a
compound of face outlines, holes already subtracted, which it then extrudes
into or out of the model.
These live in TKService, and both classes are real in 7.9.3 rather than the
deprecated typedefs of Font_BRepFont/Font_BRepTextBuilder that OCCT 8.0
turns them into — so the 8.0 port is a rename here and nothing else. The
builder image already asserts TKService links without libGL or libX11, so
binding them costs the runtime image nothing.
Rendering a glyph is FreeType work with no Python in it, so it releases the
GIL.
*/
#include "../common/occt_module.h"
#include "../common/occt_policies.h"
#include "../common/occt_transient.h"
#include <NCollection_String.hxx>
#include <StdPrs_BRepFont.hxx>
#include <StdPrs_BRepTextBuilder.hxx>
#include <TopoDS_Shape.hxx>
#include <gp_Ax3.hxx>
void register_StdPrs(nb::module_ &root) {
nb::module_ m = ocp_submodule(root, "StdPrs");
nb::class_<StdPrs_BRepFont, Standard_Transient>(m, "StdPrs_BRepFont")
.def(ocp_new<StdPrs_BRepFont>())
.def(
"Init",
[](StdPrs_BRepFont &self, const NCollection_String &path,
const Standard_Real size, const Standard_Integer faceId) {
return self.Init(path, size, faceId);
},
"theFontPath"_a, "theSize"_a, "theFaceId"_a, OCP_NOGIL)
.def("Release", &StdPrs_BRepFont::Release)
.def("Ascender", &StdPrs_BRepFont::Ascender)
.def("Descender", &StdPrs_BRepFont::Descender);
nb::class_<StdPrs_BRepTextBuilder>(m, "StdPrs_BRepTextBuilder")
.def(nb::init<>())
.def(
"Perform",
[](StdPrs_BRepTextBuilder &self, StdPrs_BRepFont &font,
const NCollection_String &text, const gp_Ax3 &penLoc,
const Graphic3d_HorizontalTextAlignment hAlign,
const Graphic3d_VerticalTextAlignment vAlign) {
return self.Perform(font, text, penLoc, hAlign, vAlign);
},
"theFont"_a, "theString"_a, "thePenLoc"_a = gp_Ax3(),
"theHAlign"_a = Graphic3d_HTA_LEFT,
"theVAlign"_a = Graphic3d_VTA_BOTTOM, OCP_RETURN_COPY, OCP_NOGIL);
}