Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6859859
Measure a cold BLDC assembly and preserve per-part geometry references
NiJingzhe Nov 21, 2026
7e12d7a
Index sketch components once and borrow topology witnesses when traci…
NiJingzhe Nov 21, 2026
40220ee
Compute mass and centroid from the same integration during artifact v…
NiJingzhe Nov 21, 2026
39f99b6
Select the requested Windows kernel and run the portable parity asser…
NiJingzhe Nov 21, 2026
7ec63a2
Preserve point intervals and complete editor lifecycle checks on Windows
NiJingzhe Nov 21, 2026
2aaab74
Honor Windows addon shell and notebook locking contracts
NiJingzhe Nov 21, 2026
8503499
Own raster scratch for exactly one render worker
NiJingzhe Nov 21, 2026
64a78be
Exercise renderer worker teardown through the Python extension
NiJingzhe Nov 21, 2026
25bae10
Share exact entity measurements inside each topology snapshot traversal
NiJingzhe Nov 21, 2026
6ecebc5
Skip redundant validation when a Boolean clean-up returns the very sa…
NiJingzhe Nov 21, 2026
70229f9
Reap the timeout fixture worker before removing its locked notebook
NiJingzhe Nov 21, 2026
5f8f795
Keep the module-wide MinGW C++ allocator experimental
NiJingzhe Nov 21, 2026
311087a
Publish cold BLDC timings, complete binary geometry comparison and re…
NiJingzhe Nov 21, 2026
28ac193
Address notebook state through Windows extended-length paths
NiJingzhe Nov 21, 2026
cf9240c
Check effective hydraulic face names on the finished parts
NiJingzhe Nov 21, 2026
fe3ab22
Keep editor cache observability inside its test workspace
NiJingzhe Nov 21, 2026
9d08c47
Verify the delivered long-path wheel against all 29 stock BLDC bodies
NiJingzhe Nov 21, 2026
45eec53
Record expanded wheel acceptance with FreeCAD, editor kernels and lar…
NiJingzhe Nov 21, 2026
767ba2b
Keep build123d capture and SDK validation on their own OCCT bindings
NiJingzhe Nov 21, 2026
0b82f53
Separate factory-only ABBA from BLDC and retain the slow factory results
NiJingzhe Nov 21, 2026
62f36d0
Build the locked 38-toolkit OCCT overlay in CI, development installs …
NiJingzhe Nov 22, 2026
9a8eb8d
Drop unused IGES and retain compiled OCCT objects across kernel revis…
NiJingzhe Nov 22, 2026
d331ff8
Keep render material tables alive and bound scanlines before narrowin…
NiJingzhe Nov 22, 2026
4efdf68
Accept bounded edge-pixel quantization and stop asserting OCCT face s…
NiJingzhe Nov 22, 2026
3b84b9c
Constrain renderer thread-count differences to low-amplitude edge pixels
NiJingzhe Nov 22, 2026
a353cef
Measure thread-count image noise without a final-resolution edge mask
NiJingzhe Nov 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 35 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,39 @@ jobs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/occt
key: occt-ci-linux-${{ hashFiles('src/cpp/tools/build_occt.py') }}
key: occt-ci-linux-${{ hashFiles('src/cpp/tools/build_occt.py', 'src/cpp/tools/occt_patches.py', 'src/cpp/patches/occt/**', 'src/cpp/cmake/ScadOcct.cmake') }}

- name: Install compiler cache on a kernel-prefix miss
if: steps.cache.outputs.cache-hit != 'true'
run: sudo apt-get update -qq && sudo apt-get install -y ccache

- name: Reuse individual OCCT translation units
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: ~/.cache/scad-occt-ccache
key: occt-objects-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('src/cpp/tools/build_occt.py', 'src/cpp/tools/occt_patches.py', 'src/cpp/patches/occt/**', 'src/cpp/cmake/ScadOcct.cmake') }}
restore-keys: occt-objects-v1-${{ runner.os }}-${{ runner.arch }}-

- name: Build OpenCASCADE
if: steps.cache.outputs.cache-hit != 'true'
run: python3 src/cpp/tools/build_occt.py --prefix "$HOME/occt"
env:
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
CCACHE_COMPILERCHECK: content
CCACHE_MAXSIZE: 2G
run: |
export CCACHE_DIR="$HOME/.cache/scad-occt-ccache"
export CCACHE_BASEDIR="$RUNNER_TEMP/scad-occt"
ccache --zero-stats
python3 src/cpp/tools/build_occt.py --prefix "$HOME/occt" --work "$CCACHE_BASEDIR"
ccache --show-stats

- name: Link the installed kernel and exercise native surface operators
run: |
cmake -S src/cpp/tools/occt-smoke -B build/kernel-check -G Ninja -DCMAKE_BUILD_TYPE=Release -DOpenCASCADE_DIR="$HOME/occt/lib/cmake/opencascade"
cmake --build build/kernel-check
ctest --test-dir build/kernel-check --output-on-failure

format:
# No OpenCASCADE needed: runs in seconds, ahead of the heavy jobs.
Expand Down Expand Up @@ -82,7 +110,7 @@ jobs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/occt
key: occt-ci-linux-${{ hashFiles('src/cpp/tools/build_occt.py') }}
key: occt-ci-linux-${{ hashFiles('src/cpp/tools/build_occt.py', 'src/cpp/tools/occt_patches.py', 'src/cpp/patches/occt/**', 'src/cpp/cmake/ScadOcct.cmake') }}
fail-on-cache-miss: true

- name: Configure
Expand Down Expand Up @@ -112,7 +140,7 @@ jobs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/occt
key: occt-ci-linux-${{ hashFiles('src/cpp/tools/build_occt.py') }}
key: occt-ci-linux-${{ hashFiles('src/cpp/tools/build_occt.py', 'src/cpp/tools/occt_patches.py', 'src/cpp/patches/occt/**', 'src/cpp/cmake/ScadOcct.cmake') }}
fail-on-cache-miss: true

- name: Configure
Expand Down Expand Up @@ -151,7 +179,7 @@ jobs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/occt
key: occt-ci-linux-${{ hashFiles('src/cpp/tools/build_occt.py') }}
key: occt-ci-linux-${{ hashFiles('src/cpp/tools/build_occt.py', 'src/cpp/tools/occt_patches.py', 'src/cpp/patches/occt/**', 'src/cpp/cmake/ScadOcct.cmake') }}
fail-on-cache-miss: true

- name: Install clang-tidy
Expand Down Expand Up @@ -203,7 +231,7 @@ jobs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/occt
key: occt-ci-linux-${{ hashFiles('src/cpp/tools/build_occt.py') }}
key: occt-ci-linux-${{ hashFiles('src/cpp/tools/build_occt.py', 'src/cpp/tools/occt_patches.py', 'src/cpp/patches/occt/**', 'src/cpp/cmake/ScadOcct.cmake') }}
fail-on-cache-miss: true

- name: Install locked dependencies and build the C++ module
Expand Down Expand Up @@ -259,7 +287,7 @@ jobs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/occt
key: occt-ci-linux-${{ hashFiles('src/cpp/tools/build_occt.py') }}
key: occt-ci-linux-${{ hashFiles('src/cpp/tools/build_occt.py', 'src/cpp/tools/occt_patches.py', 'src/cpp/patches/occt/**', 'src/cpp/cmake/ScadOcct.cmake') }}
fail-on-cache-miss: true

- name: Install locked dependencies and build the C++ module
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ jobs:
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ matrix.occt_cache }}
key: occt-${{ matrix.name }}-${{ hashFiles('src/cpp/tools/build_occt.py') }}
key: occt-${{ matrix.name }}-${{ hashFiles('src/cpp/tools/build_occt.py', 'src/cpp/tools/occt_patches.py', 'src/cpp/patches/occt/**', 'src/cpp/cmake/ScadOcct.cmake') }}

- name: Prepare the OpenCASCADE cache directory (Linux)
if: runner.os == 'Linux'
Expand Down Expand Up @@ -246,12 +246,12 @@ jobs:
SKBUILD_BUILD_TOOL_ARGS="-k;0"

- name: Save the static OpenCASCADE build
if: always() && steps.occt.outputs.cache-hit != 'true'
if: success() && steps.occt.outputs.cache-hit != 'true'
continue-on-error: true
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ matrix.occt_cache }}
key: occt-${{ matrix.name }}-${{ hashFiles('src/cpp/tools/build_occt.py') }}
key: occt-${{ matrix.name }}-${{ hashFiles('src/cpp/tools/build_occt.py', 'src/cpp/tools/occt_patches.py', 'src/cpp/patches/occt/**', 'src/cpp/cmake/ScadOcct.cmake') }}

- name: Keep the wheels
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ sandbox-envs/
design-docs/

# local, not part of the SDK
/out/
examples/workspace/
phase2-contract-review.md

Expand Down
8 changes: 8 additions & 0 deletions design-docs/geometry-throughput.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Geometry throughput (2026-11-22)

Owner request: branch from latest dev, retain tolerances and behavior, measure actual BLDC and standard parts, use the new kernel without replacing the reference installation. Base: fetched `origin/dev` at `389d4306`.

1. Keep raw batch timings and cold model construction separate from a profiler trace. Copy example inputs only to an empty folder, run the notebook and capture the validated package. Use every part definition's geometry interface hash and tolerance profile, plus assembly counts, as A/B controls. Do not infer universal speedup from a subset of operations.
2. Profile of the unmodified BLDC found 38,366 label calls, 29.09 s cumulative, and repeated integration of mass/centroid, plus 53.17 s in package validation under cProfile. Fuse the *measurement*, not the CAD bodies: use the same OCCT quadratures and degenerate-center fallback; reuse the body label. Use the existing native JCS encoder on parsed builtin JSON and retain the original fallback.
3. Extract the connected components of sketch edges with one endpoint index. Preserve edge order and component order; do not use distances or change the solver. Avoid copying witness trees for read-only traversals and avoid traversing topology kinds absent from the delta.
4. Use the new prefix as a separately selected development installation. Shared Windows builds need DLL resolution before native import; `SCAD_OCCT_PREFIX` also selects that runtime in subprocesses. Preserve the stock build as a detached reference. Existing Windows portability failures must be distinguished from numerical regressions, never removed by broadening numeric tolerances.
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ build-dir = "src/cpp/build/wheel/{wheel_tag}"
wheel.packages = ["src/simplecadapi"]
wheel.exclude = ["**/__pycache__/**", "**/*.pyc"]
sdist.include = [
"/src/cpp/patches",
"/src/cpp/tools/build_occt.py",
"/src/cpp/tools/occt_patches.py",
"/tools/build_backend",
"/src/simplecadapi/editor/webui",
"/skillproj.toml",
Expand Down Expand Up @@ -171,6 +174,9 @@ dev = [
# machine) whenever a cache key changed. uv's default key is pyproject.toml, so a version bump or a dependency edit forced
# a rebuild nobody needed. Rebuild only when the C++ module's inputs change.
cache-keys = [
{ file = "src/cpp/patches/**" },
{ file = "src/cpp/tools/build_occt.py" },
{ file = "src/cpp/tools/occt_patches.py" },
{ file = "src/cpp/CMakeLists.txt" },
{ file = "src/cpp/cmake/**" },
{ file = "src/cpp/include/**" },
Expand Down
4 changes: 4 additions & 0 deletions src/cpp/bindings/python/bind_sdk_compat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ void bind_shape_internals(py::module_& m) {
add_state_dicts<sp::Constraint>(m, "Constraint");
add_state_dicts<sp::ScalarLimit>(m, "ScalarLimit");
py::class_<Shape> any = py::reinterpret_borrow<py::class_<Shape>>(m.attr("AnyShape"));
any.def("_mass_and_center", [](const Shape& s) {
const auto [mass, c] = kernel::mass_and_center(s.wrapped());
return py::make_tuple(mass, py::make_tuple(c.x, c.y, c.z));
});
any.def("_metadata_dict", [](const Shape& s) { return pybind::value_to_python(s.metadata()); });
any.def("_runtime_dict", [](const Shape& s) { return pybind::value_to_python(s.runtime()); });
any.def(
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/cmake/ScadOcct.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ set(SCAD_OCCT_TOOLKITS
# Modeling algorithms
TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKShHealing TKFillet TKOffset TKFeat TKMesh TKHLR
# Data exchange: STEP / STL / BREP-adjacent readers and writers
TKDE TKXSBase TKDESTEP TKDESTL TKDEIGES
TKDE TKXSBase TKDESTEP TKDESTL
# XCAF is what STEP assemblies read into.
TKXCAF TKCAF TKLCAF TKCDF TKService TKRWMesh TKXmlXCAF TKBinXCAF TKBin TKBinL TKXml TKXmlL TKStd TKStdL TKVCAF TKV3d)

Expand Down
2 changes: 2 additions & 0 deletions src/cpp/include/scad/kernel/properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <utility>

#include "scad/core/vec.hpp"

Expand All @@ -25,6 +26,7 @@ double volume(const TopoDS_Shape& solid);
// comparisons that only need the answer when it is not close to a threshold. `volume` stays the
// precise one.
double volume_estimate(const TopoDS_Shape& shape);
std::pair<double, Vec3> mass_and_center(const TopoDS_Shape& solid_face_or_edge);

// Centre of mass using the routine that matches the shape's own dimension.
Vec3 center_of_mass(const TopoDS_Shape& shape);
Expand Down
53 changes: 53 additions & 0 deletions src/cpp/patches/occt/0001-tangent-end.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
diff --git a/src/ChFi3d/ChFi3d_Builder_0.cxx b/src/ChFi3d/ChFi3d_Builder_0.cxx
index 18354eee..808d85ee 100644
--- a/src/ChFi3d/ChFi3d_Builder_0.cxx
+++ b/src/ChFi3d/ChFi3d_Builder_0.cxx
@@ -418,7 +418,19 @@ ChFiDS_State ChFi3d_EdgeState(TopoDS_Edge* E, const ChFiDS_Map& EFMap)
if (o01 == o11 && o02 == o21 && o12 == o22)
sst = ChFiDS_AllSame;
else if (o12 == o22 || i == 10 || j == 10)
+ {
sst = ChFiDS_OnDiff;
+ // Backport of OCCT PR #1642: a tangent end has no intrinsic
+ // convexity. Its extended end face trims one free contact point.
+ if (i != 10 && j != 10
+ && (ChFi3d::IsTangentFaces(E[0], F1, F2) ? 1 : 0)
+ + (ChFi3d::IsTangentFaces(E[1], F3, F4) ? 1 : 0)
+ + (ChFi3d::IsTangentFaces(E[2], F5, F6) ? 1 : 0)
+ == 1)
+ {
+ sst = ChFiDS_OnSame;
+ }
+ }
else
sst = ChFiDS_OnSame;
}
diff --git a/src/ChFi3d/ChFi3d_Builder_C1.cxx b/src/ChFi3d/ChFi3d_Builder_C1.cxx
index 90d1a1ab..4fc4b8ab 100644
--- a/src/ChFi3d/ChFi3d_Builder_C1.cxx
+++ b/src/ChFi3d/ChFi3d_Builder_C1.cxx
@@ -1320,6 +1320,8 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
throw Standard_ConstructionError("Failed to get p-curve of edge");
pop1 = Hc->Value(parVtx);
pop2 = Fiop.PCurveOnFace()->Value(Fiop.Parameter(isfirst));
+ // Keep both ends in the same periodic chart (OCCT PR #1642).
+ ChFi3d_Recale(Bop, pop1, pop2, Standard_False);
Hc = BRep_Tool::CurveOnSurface(Arcprol, Fv, Ubid, Ubid);
if (Hc.IsNull())
throw Standard_ConstructionError("Failed to get p-curve of edge");
@@ -1373,11 +1375,13 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
BRepLib_MakeEdge Bedge(zob3d);
TopoDS_Edge edg = Bedge.Edge();
BRepExtrema_ExtCC extCC(edgecouture, edg);
- if (extCC.IsDone() && extCC.NbExt() != 0)
+ if (extCC.IsDone() && !extCC.IsParallel() && extCC.NbExt() != 0)
{
for (Standard_Integer i = 1; i <= extCC.NbExt() && !intcouture; i++)
{
- if (extCC.SquareDistance(i) <= 1.e-8)
+ if (extCC.SquareDistance(i) <= 1.e-8
+ && extCC.PointOnE1(i).Distance(zob3d->Value(Udeb)) > tolapp3d
+ && extCC.PointOnE1(i).Distance(zob3d->Value(Ufin)) > tolapp3d)
{
par1 = extCC.ParameterOnE1(i);
par2 = extCC.ParameterOnE2(i);
54 changes: 54 additions & 0 deletions src/cpp/patches/occt/0002-root-solid-orientation.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
diff --git a/src/ChFi3d/ChFi3d_Builder_1.cxx b/src/ChFi3d/ChFi3d_Builder_1.cxx
index ca92eef1..f4e40aa1 100644
--- a/src/ChFi3d/ChFi3d_Builder_1.cxx
+++ b/src/ChFi3d/ChFi3d_Builder_1.cxx
@@ -20,6 +20,7 @@
#include <Blend_FuncInv.hxx>
#include <Blend_RstRstFunction.hxx>
#include <BRepBlend_Line.hxx>
+#include <BRep_Builder.hxx>
#include <BRepLProp_SLProps.hxx>
#include <BRepTopAdaptor_TopolTool.hxx>
#include <ChFi3d.hxx>
@@ -55,6 +56,8 @@
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
+#include <TopoDS_Solid.hxx>
+#include <TopoDS_Iterator.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopOpeBRepBuild_HBuilder.hxx>
#include <TopOpeBRepDS_HDataStructure.hxx>
@@ -316,11 +319,27 @@ ChFi3d_Builder::ChFi3d_Builder(const TopoDS_Shape& S, const Standard_Real Ta)
{
myDS = new TopOpeBRepDS_HDataStructure();
myCoup = new TopOpeBRepBuild_HBuilder(mkbuildtool());
- myEFMap.Fill(S, TopAbs_EDGE, TopAbs_FACE);
- myESoMap.Fill(S, TopAbs_EDGE, TopAbs_SOLID);
- myEShMap.Fill(S, TopAbs_EDGE, TopAbs_SHELL);
- myVFMap.Fill(S, TopAbs_VERTEX, TopAbs_FACE);
- myVEMap.Fill(S, TopAbs_VERTEX, TopAbs_EDGE);
+ // The reconstruction merges material with TopAbs_IN and assumes a forward
+ // solid container. A valid solid may instead carry its orientation at the
+ // root (e.g. BRepLib::OrientClosedSolid after sewing). Distribute that root
+ // orientation to its shells without reversing the material or copying any
+ // geometry. All face/edge TShapes and their cumulative orientations survive.
+ if (S.ShapeType() == TopAbs_SOLID && S.Orientation() == TopAbs_REVERSED)
+ {
+ BRep_Builder aBuilder;
+ TopoDS_Solid aSolid;
+ aBuilder.MakeSolid(aSolid);
+ for (TopoDS_Iterator anIt(S); anIt.More(); anIt.Next())
+ {
+ aBuilder.Add(aSolid, anIt.Value());
+ }
+ myShape = aSolid;
+ }
+ myEFMap.Fill(myShape, TopAbs_EDGE, TopAbs_FACE);
+ myESoMap.Fill(myShape, TopAbs_EDGE, TopAbs_SOLID);
+ myEShMap.Fill(myShape, TopAbs_EDGE, TopAbs_SHELL);
+ myVFMap.Fill(myShape, TopAbs_VERTEX, TopAbs_FACE);
+ myVEMap.Fill(myShape, TopAbs_VERTEX, TopAbs_EDGE);
SetParams(Ta, 1.0e-4, 1.e-5, 1.e-4, 1.e-5, 1.e-3);
SetContinuity(GeomAbs_C1, Ta);
}
Loading