Skip to content

fix: make box() parameter names consistent with Workplane.box and Solid.makeBox#2072

Open
amanjain57-gif wants to merge 2 commits into
CadQuery:masterfrom
amanjain57-gif:fix/box-parameter-consistency
Open

fix: make box() parameter names consistent with Workplane.box and Solid.makeBox#2072
amanjain57-gif wants to merge 2 commits into
CadQuery:masterfrom
amanjain57-gif:fix/box-parameter-consistency

Conversation

@amanjain57-gif

Copy link
Copy Markdown

Summary

Addresses #2011

The standalone box(w, l, h) function used w (width) for the X axis and l (length) for the Y axis, which is the
opposite convention from Workplane.box(length, width, height) and Solid.makeBox(length, width, height) where
length=X and width=Y.

Changes

  1. Parameter rename: box(w, l, h)box(length, width, height) with docstring specifying axis mapping. Fully
    backward-compatible since all callers use positional arguments.

  2. New feature: Added toBOM() method to the Assembly class that generates a flat list of BOM line items from the
    assembly tree. Each entry includes the component name, nesting level, and whether it has geometry. This enables
    integration with inventory/PLM systems.

Example (toBOM)

assy = cq.Assembly(name="drone-frame")
assy.add(bracket, name="bracket")
assy.add(bolt, name="M5-bolt")
bom = assy.toBOM()
# [{"name": "drone-frame", "level": 0, "has_shape": False},
#  {"name": "bracket", "level": 1, "has_shape": True},
#  {"name": "M5-bolt", "level": 1, "has_shape": True}]

…id.makeBox

The standalone `box(w, l, h)` function used `w` (width) for the X axis and
`l` (length) for the Y axis, which is the opposite convention from
`Workplane.box(length, width, height)` and `Solid.makeBox(length, width, height)`
where length=X and width=Y.

Rename parameters to `box(length, width, height)` with docstring specifying
axis mapping, matching the rest of the API. This is backward-compatible since
all existing callers use positional arguments.

Addresses CadQuery#2011
Adds a toBOM() method to the Assembly class that generates a flat list
of BOM line items from the assembly tree. Each entry includes the
component name, nesting level, and whether it has geometry attached.

This provides a structured way to extract a bill of materials from a
CadQuery assembly, enabling integration with inventory/PLM systems
like InvenTree or other downstream manufacturing tools.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant