github gumyr/build123d v0.14.0

one hour ago

Breaking Changes

  • Operations that leave nothing now return an empty shape of the right class instead of None, a bare Compound or an error. BuildPart().part, BuildSketch().sketch and BuildLine().line are never None (test if not builder.part, not is None), intersect() returns an empty ShapeList where it returned None, and a boolean that leaves nothing returns an empty Part, Sketch or Curve. Face.wire() on a face with holes raises instead of returning the outer wire, and exporting an empty shape raises ValueError by @gumyr in #1495.
  • Plane.rotated now takes its angles about the plane's own x, y and z directions, as its docstring said, instead of about the world axes. Planes aligned with the world axes rotate as before; for any other plane, negate the affected angles to get the old result by @gumyr in #1494.
  • Solid(shell) raises ValueError for a shell that is not closed, where it returned an invalid solid by @gumyr in a1ad7263.
  • Face.wrap and Face.wrap_faces are rebuilt on UVFrame: the extension_factor parameter is removed, and tolerance is now the largest 3D error of an interpolated curve by @gumyr in #1465.

Compatibility Notes

These are compatibility-related changes that users should review. They are not necessarily all breaking changes.

  • Upcoming release v0.15.0 will change the kernel binding. The next release replaces the OCP binding with nanocct. Code that only uses the build123d API is not affected; code that calls OCP directly through .wrapped will need to change, mainly where a kernel call has output parameters or writes to a stream.
  • project is deprecated in favor of project_to_plane and project_to_shape, project_workplane in favor of the Plane constructor, Shape.project_to_viewport in favor of drawing_view, and Mixin1D.project in favor of project_to_shape. All keep working with a DeprecationWarning by @gumyr in #1531.
  • SortBy is deprecated: pass the shape property (Edge.length, Face.area, Solid.volume) to sort_by and group_by, or use sort_by_distance by @gumyr in 6beaa619.
  • Renamed, with the old names kept as deprecated aliases: Draft to Drafting, SlotArc to SlotCurve, Solid.make_loft and Shell.make_loft to loft, and Joint.connect_to to attach (with the former now deprecated) by @gumyr in fe78a14c, dcb6c894, af82dd17 and b11fdb29.
  • IntersectingLine is deprecated in favor of PolarLine(start, other, direction=direction), make_brake_formed in favor of BuildSheet, BuildPart.location because a builder has no single location, and Shape.is_null in favor of is_empty by @gumyr in eac695eb, 624c709a, 8258bc73 and #1495.
  • ExportDXF accepts ColorLike values for document and layer colors; ColorIndex values are deprecated by @kforris in #1440.
  • Tapered extrusions are now a straight extrusion followed by a draft: sharp concave corners stay sharp, sides are planes and cones where they were B-splines, and a taper that collapses the profile raises RuntimeError. Wire.offset_2d returns B-spline edges instead of deferred offset curves by @gumyr in #1488.
  • extrude(until=..., taper=...) now applies the taper, which it silently dropped by @gumyr in 02a2a28d.
  • ShapeList.filter_by(Axis) now also matches faces with an axis of rotation parallel to the axis: cylinders, cones, spheres, tori and surfaces of revolution, so a mixed list returns its holes and fillets too by @gumyr in c0fb3a89.
  • Edge.param_at, Edge.param_at_point and Wire.param_at_point now measure a reversed edge or wire from the same end as position_at by @gumyr in 12b4fbe5 and 04ca2f61.
  • Color compares by value and stays hashable, and Color(0x000000) is black instead of white by @gumyr in c9dd8ea6 and @Amadeus415 in #1599.
  • Constrained arcs now run from the first tangency to the second by @Zedas030 in #1588 and @gumyr in 70113186.
  • - now returns the kind of shape it was cut from: Line - Rectangle and Line - Box are a Curve, where they were a Sketch or Part holding only edges by @gumyr in d160021b.
  • + on curves merges a curve that lies on another, where it kept both as a wire that doubled back by @gumyr in ae32652d.
  • Splitting a Shell returns a Shell, or a Compound of shells, instead of a Sketch, and Keep.TOP and Keep.BOTTOM are now honoured for a Shell or Wire by @gumyr in 9fce9fd1 and 37fe6301.
  • Compound.compounds() returns compounds at every depth, so volume, mass and get_type no longer miss nested assemblies; thicken of several faces and mirror of a part return a Part without an extra wrapper by @gumyr in 5a802339.
  • import_step returns a shape that was exported with a location as the shape itself, not wrapped in a Compound, and keeps the punctuation of labels except for / by @gumyr in 71e5466c and 0b47f0c9 and @1915rising in #1593.
  • drawing_view returns linear, circular and elliptical edges as lines, circles and ellipses where hidden-line removal gave splines, and no longer returns edges lying on one another by @gumyr in 2694ce4b and @lakshikaaswal in #1572.
  • Shape.is_manifold skips degenerate edges and requires consistent orientation, so a sphere, a cone and a filleted box now report True and Shell.volume of a sphere's shell is no longer 0 by @gumyr in 098ada80.
  • Joint constructors given neither a part nor a builder return a free joint instead of raising, and joints now follow their part through mirror, scale and booleans by @gumyr in #1517.
  • make_text with a stroke width always returns a Compound; the "singleline" font is now Relief SingleLine Clean and the old font is no longer distributed; fonts of large families are registered as family plus weight by @gumyr in 7d5d514b, #1496 and 862ca94e.
  • Shape.project_faces takes the surface normal from the faces the path lies on, so faces on a path round a bore land on the bore, and a face on a sharp edge folds over it by @gumyr in 6a290d21.
  • scikit-learn and sympy are no longer dependencies, which roughly halves the time of import build123d by @gumyr in d3b12235 and 89fbd7a1.

Notable Changes

  • Added sheet metal modelling: the BuildSheet builder (and Algebra mode) models a constant-thickness part as a reference Shell, with the flange, hem, bend, jog, miter, bend_relief and corner_relief operations, SheetMetalParameters for thickness, bend radius and k-factor, thicken to make the solid and unfold to develop the flat pattern, holes on bends included. Based on the proof of concept by @GabrielJMS in #1381, by @gumyr in #1434 and related commits, and @GabrielJMS in #1584.
  • Reworked projection: project_to_plane and project_to_shape replace project, a Hit enum (ALL, NEAREST, FARTHEST, VISIBLE) selects which surfaces a projection keeps, sketches get the true silhouette of a solid, drawing_view replaces project_to_viewport and returns a DrawingViewOutput of visible and hidden edges, and Face.silhouette_edges is new by @gumyr in #1531.
  • Added UVFrame, a flat coordinate system laid onto a face, with Face.uv_frame, write_edge, write_wire, write_face and punch: a shape drawn on Plane.XY is written into the face's parameter space and lies on the surface by construction, exactly on planes, cylinders and cones. Face.wrap and Face.wrap_faces now work on every surface type and across seams by @gumyr in #1465.
  • Added Face.offset_2d, and offset() of a non-planar face: a face on a cylinder, cone, sphere, torus or spline surface can be grown or shrunk within its surface by @gumyr in #1595; a planar offset whose holes split the face returns every piece by @BiNeurale in #1596.
  • Joints are now algebra objects: a joint can be made free and placed with *, bound by assigning into part.joints (a JointDict) or added with +, made once per location in a Locations context, and it follows its part through transforms, copies and booleans by @gumyr in #1517, @Sean-yh in #1556 and @vladyr in #1490.
  • Every shape class now has an empty value (Solid(), Face(), Part(), Sketch(), Curve(), Vertex()) that operations return for "nothing", with is_empty to test for it by @gumyr in #1495.
  • Rebuilt extrude(until=...): the extrusion stops at the nearest surface everywhere across a target of several faces, works from a sketch drawn on the target, and handles a profile that straddles a step by @gumyr in ab8c0198, 55e3c76b and 19f1962e.
  • Tapered extrusions are now made by extruding the profile and drafting its side faces, which fixes tapers that went the wrong way or returned something that was not a solid by @gumyr in #1488, building on a draft by @jdegenstein.
  • LocationList is now a list, and location lists compose with *: GridLocations(...) * PolarLocations(...) works as a builder context and as an Algebra placement by @gumyr in 2e637199 and 35155099.
  • Relocating and copying shapes no longer copies their geometry, and assemblies keep their place and their children's shared geometry when children change or the assembly is copied by @gumyr in 16c63104 and bd9ba44a and @vladyr in #1540, #1518 and #1509.
  • Hole, CounterBoreHole and CounterSinkHole take a point_angle for a drill point by @GabrielJMS in #1536.
  • Added ShapeList.filter_by_value to select by a measured value such as Edge.length or Face.radius by @sybeeria in #1524, and GroupBy.first and GroupBy.last by @kforris in #1448.
  • split accepts several tools at once by @gumyr in 67ff680e.
  • Builders gained color and material attributes that are applied to their output, as label is by @gumyr in 5f9bbd91.
  • Added FrameMethod.CONTINUOUS, a frame carried along a Wire without rolling between edges, and a deflection parameter to locations for many locations on long wires by @gumyr in 6f07399a and de316731.
  • export_brep gained binary, version and triangulation options, and import_brep reads from streams by @DavidMStraub in #1555.
  • Face can be built on a curved surface from wires that lie on it with the surface keyword, and Shell takes a sewing tolerance by @gumyr in 96763050 and 2b1f2610.
  • Matrix can be built from any affine values and applied to a Vector by @gumyr in #1461.
  • The documentation is reorganized into Tutorials, How-to Guides, Reference and Explanation, with the tutorials rewritten as a series in both builder and algebra modes, and new pages including sheet metal, projection, geometry and topology, and a spiral ramp tutorial by @gumyr in #1585, 9c06071f and 3c5552fb.
  • The open OpenCascade defects are tracked by expected-failure tests that will flag when a kernel release fixes one by @zalo in #1507.

Selected Other Changes

  • Fixed fillet and chamfer of an outward offset with openings by @gumyr in #1463.
  • Fixed export_step when exporting a child of an assembly by @slobberingant in #1458.
  • Propagated labels to unlabeled nested shapes in export_step by @cycsmail in #1459.
  • Supported local two-tuples in Plane.shift_origin by @kforris in #1449.
  • Exposed the resolved label text of DimensionLine and ExtensionLine as label_str by @kforris in #1450.
  • Fixed the ConstrainedArcs Axis overload annotation by @kforris in #1418.
  • Documented the Part, Sketch and Curve geometry containers by @kforris in #1457.
  • Fixed do_children_intersect for nested assemblies and Shape.located for vertices by @vladyr in #1470.
  • Avoided calling register_font on directories from register_folder by @snoyer in #1472.
  • Placed a Compound's children in global space before intersecting by @sparr in #1473.
  • Fixed mangled non-ASCII labels in glTF and STEP export by @wstates in #1476.
  • Wire.edges() now reports every edge of a branching wire by @zalo in #1479.
  • Kept the holes of a face when chamfering its corners by @zalo in #1482.
  • Documented that fillets propagate along tangent edge chains by @zalo in #1483.
  • Made the font and glTF material tests safe under xdist by @zalo in #1484.
  • Made the order of de-duplicated ShapeList results deterministic by @Erfouni in #1489.
  • Skipped faces without triangulation in Shape.tessellate by @yeicor in #1519.
  • A failed 3D fillet now names the faulty edges by @sybeeria in #1525.
  • Closed the XCAF document created by each STEP and glTF export by @theluckystrike in #1526.
  • Added normalize=False to param_at_point for native curve parameters by @RanaPriyansh in #1530.
  • Kept a vertex's location when it is copied by @vladyr in #1538.
  • Added GitHub edit links to the documentation by @kforris in #1539.
  • Added a regression test for STEP profiles inserted into a sketch by @alteralto in #1546.
  • Fixed argument names in docstrings to match signatures by @mmporong in #1553.
  • Fixed pytest version constraints and the macOS runner by @jdegenstein in #1557 and #1566.
  • Fixed JernArc start tangents for negative full turns by @RanaPriyansh in #1558.
  • Added Vector.is_parallel, is_normal and is_opposite by @LiShuochen in #1561.
  • Fixed import_dxf for SOLID, TRACE and 3DFACE entities by @fixfon in #1564.
  • make_hull and Wire.make_convex_hull accept vertices by @lucas-santos-f in #1567.
  • Made Wire keep the first of near-coincident end vertices by @usman7384 in #1573.
  • fillet_2d failures are reported in the original vertex coordinates by @javimixet in #1574.
  • Fixed fractional inch labels for whole lengths by @fixfon in #1576.
  • Gave Shape's type parameter a default so a bare Shape reads as Shape[Any] under pyright by @restlessronin in #1577.
  • Fixed two typos in the docs by @jeis4wpi in #1579.
  • Added interior_edges to Face.make_surface_patch by @lucas-santos-f in #1580.
  • Made Curve.wire() agree with Curve.wires() by @sahilmaniyar888 in #1589.
  • Added text-to-cad to the external tools documentation by @earthtojake in #1590.
  • Transformed a BoundBox as a whole when a Plane relocates it by @Amadeus415 in #1598.
  • Mentioned the caret operator (^) across docs and docstrings by @lyn1dev in #1603.
  • Preserved the SVG circular arc sweep in generated BuildLine code by @aevumworks in #1604.
  • sweep, revolve and loft now clean the shapes they return inside a builder by @gumyr in 8c1ecc64.
  • A custom object unwraps to a Part, not to a new object of its own class by @gumyr in e22d34da.
  • Each font of a collection file, and each named instance of a variable font, is registered as its own face by @gumyr in 1def87ed.
  • The mesher reports faces it cannot triangulate instead of crashing, and a null offset result raises instead of segfaulting by @gumyr in dd23d714 and 6b807669.
  • Shapes that carry a history record can be pickled by @gumyr in 2aec5679.
  • Fixed project_to_plane of a straight edge tilted to the plane by @gumyr in f2695861.
  • Fixed Hit.VISIBLE projection onto a sphere seen just off its equator by @gumyr in 440f2c0b.
  • Refused sweep profiles with a degenerate edge, and warned when a sweep creates an invalid solid by @gumyr in 64c95b76 and 1e44a969.

New Contributors

Thanks to the following first-time contributors:

Contributors

Thanks to everyone who contributed to this release:

@1915rising, @aevumworks, @alteralto, @Amadeus415, @BiNeurale, @cycsmail, @DavidMStraub, @deximple, @earthtojake, @Erfouni, @fixfon, @GabrielJMS, @gumyr, @javimixet, @jdegenstein, @jeis4wpi, @kforris, @kmanoochehri1978-dev, @lakshikaaswal, @LiShuochen, @lucas-santos-f, @lyn1dev, @mmporong, @RanaPriyansh, @restlessronin, @sahilmaniyar888, @Sean-yh, @slobberingant, @snoyer, @sparr, @sybeeria, @theluckystrike, @usman7384, @vladyr, @wstates, @yeicor, @zalo, and @Zedas030.

Full Changelog

Full Changelog: v0.13.0...v0.14.0

Don't miss a new build123d release

NewReleases is sending notifications on new releases.