Native-only mesh operations¶
These operations wrap PythonSCAD builtins that BOSL2 has no counterpart for, exposed as
first-class Bosl2Solid methods (and one 2-D→3-D constructor) so they chain
fluently and keep their anchoring metadata, rather than leaking raw native handles. They execute
only inside the real PythonSCAD app; under the numeric test mock they degrade to identity/AABB
stand-ins, so the pure-Python fast suite still runs and the real geometry is covered by the STL
render tests.
Operation |
Kind |
What it does |
|---|---|---|
|
solid → solid |
Force the mesh watertight, healing gaps and non-manifold edges. |
|
solid → solid |
Subdivide every facet n-fold (e.g. to smooth a subsequent bend). |
|
solid → solid |
Pull the material on the |
|
solid → solid |
Wrap the solid around a cylinder of radius r (bends +X into the circumference). |
|
solid → list of solids |
Split a solid of disconnected lumps into its connected components. |
|
solid → bool |
Test whether a point lies inside the solid. |
|
2-D → solid |
Raise a hip roof over a 2-D outline via its straight skeleton. |
Note
wrap() is a valid operation but meshing/exporting a wrapped solid is very slow in the
Manifold backend, so it has no render test (only mock-level coverage). Call
oversample() first if you need the bend to look smooth.
Examples¶
A hip roof raised over a square outline (a pyramid; over any polygon it is a proper straight-skeleton roof):
s3.roof(s2.square([30, 30], center=True)).show()
Oversampling subdivides a solid’s facets without changing its shape – useful before a bend or a displacement:
s3.cuboid([30, 30, 12]).oversample(3).show()
Pulling a block apart stretches the material between the halves:
s3.cuboid([24, 24, 12]).pull([0, 0, 1], 8).show()
API reference¶
The methods live on Bosl2Solid
(repair(), oversample(),
pull(), wrap(),
separate(), inside()); the roof
constructor is roof().
- bosl2.shapes3d.roof(shape, method='straight')[source]
Raise a hip roof over a 2-D shape via its straight skeleton (native
roof()).Like
linear_sweep(), this turns a 2-D outline into a 3-D solid, but the top is a peaked roof (each edge slopes inward at 45 degrees to the skeleton) rather than a flat extrusion. shape is any 2-D object – a nativesquare/circle/polygon, aPath.polygon(), or aBosl2Solidwrapping one. method selects the skeleton algorithm. PythonSCAD-only (no BOSL2 counterpart); covered by the STL render tests.- Parameters:
method (str)
- Return type: