Skip to content

Commit

Permalink
Merge pull request gumyr#667 from jdegenstein/docfixes
Browse files Browse the repository at this point in the history
Updating and fixing some documentation issues
  • Loading branch information
jdegenstein authored Sep 9, 2024
2 parents 1c653f8 + 269451b commit 235260a
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 43 deletions.
8 changes: 4 additions & 4 deletions docs/assemblies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,24 @@ Consider this example where 100 screws are added to an assembly:

.. code::
screw = Compound.import_step("M6-1x12-countersunk-screw.step")
screw = import_step("M6-1x12-countersunk-screw.step")
locs = HexLocations(6, 10, 10).local_locations
screw_copies = [copy.deepcopy(screw).locate(loc) for loc in locs]
copy_assembly = Compound(children=screw_copies)
copy_assembly.export_step("copy_assembly.step")
export_step(copy_assembly, "copy_assembly.step")
which takes about 5 seconds to run (on an older computer) and produces
a file of size 51938 KB. However, if a shallow copy is used instead:

.. code::
screw = Compound.import_step("M6-1x12-countersunk-screw.step")
screw = import_step("M6-1x12-countersunk-screw.step")
locs = HexLocations(6, 10, 10).local_locations
screw_references = [copy.copy(screw).locate(loc) for loc in locs]
reference_assembly = Compound(children=screw_references)
reference_assembly.export_step("reference_assembly.step")
export_step(reference_assembly, "reference_assembly.step")
this takes about ¼ second and produces a file of size 550 KB - just over
1% of the size of the ``deepcopy()`` version and only 12% larger than the
Expand Down
8 changes: 4 additions & 4 deletions docs/cheat_sheet.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ Cheat Sheet
+----------+-----------------------------------------------------------------------------------+------------------------------------------------+
| Operator | Operand | Method |
+==========+===================================================================================+================================================+
| > | :class:`~build_enums.SortBy`, :class:`~geometry.Axis` | :meth:`~topology.ShapeList.sort_by` |
| > | :class:`~geometry.Axis`, :class:`~topology.Edge`, :class:`~topology.Wire`, :class:`~build_enums.SortBy` | :meth:`~topology.ShapeList.sort_by` |
+----------+-----------------------------------------------------------------------------------+------------------------------------------------+
| < | :class:`~build_enums.SortBy`, :class:`~geometry.Axis` | :meth:`~topology.ShapeList.sort_by` |
| < | :class:`~geometry.Axis`, :class:`~topology.Edge`, :class:`~topology.Wire`, :class:`~build_enums.SortBy` | :meth:`~topology.ShapeList.sort_by` |
+----------+-----------------------------------------------------------------------------------+------------------------------------------------+
| >> | :class:`~build_enums.SortBy`, :class:`~geometry.Axis` | :meth:`~topology.ShapeList.group_by`\[-1\] |
| >> | :class:`~geometry.Axis`, :class:`~topology.Edge`, :class:`~topology.Wire`, :class:`~build_enums.SortBy` | :meth:`~topology.ShapeList.group_by`\[-1\] |
+----------+-----------------------------------------------------------------------------------+------------------------------------------------+
| << | :class:`~build_enums.SortBy`, :class:`~geometry.Axis` | :meth:`~topology.ShapeList.group_by`\[0\] |
| << | :class:`~geometry.Axis`, :class:`~topology.Edge`, :class:`~topology.Wire`, :class:`~build_enums.SortBy` | :meth:`~topology.ShapeList.group_by`\[0\] |
+----------+-----------------------------------------------------------------------------------+------------------------------------------------+
| \| | :class:`~geometry.Axis`, :class:`~geometry.Plane`, :class:`~build_enums.GeomType` | :meth:`~topology.ShapeList.filter_by` |
+----------+-----------------------------------------------------------------------------------+------------------------------------------------+
Expand Down
13 changes: 6 additions & 7 deletions docs/external.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@ VS Code.
See: `ocp-vscode <https://github.com/bernhard-42/vscode-ocp-cad-viewer>`_
(formerly known as cq_vscode)

Watch John Degenstein create three build123d designs in realtime with Visual
Studio Code and the ocp-vscode viewer in a timed event from the TooTallToby 2023 Leadership
Challenge:
`build123d May 2023 TooTallToby Leaderboard Challenge <https://www.youtube.com/watch?v=fH8aW27jEiw>`_
Watch Jern create three build123d designs in realtime with Visual
Studio Code and the ocp-vscode viewer extension in a timed event from the TooTallToby 2024 Spring Open Tournament:
`build123d entry video<https://www.youtube.com/watch?v=UhUmMInlJic>`_

cq-editor
cq-editor fork
=========

GUI editor based on PyQT.
GUI editor based on PyQT. This fork has changes from jdegenstein to allow easier use with build123d.

See: `cq-editor <https://github.com/jdegenstein/jmwright-CQ-Editor>`_
See: `jdegenstein's fork of cq-editor <https://github.com/jdegenstein/jmwright-CQ-Editor>`_

yet-another-cad-viewer
======================
Expand Down
24 changes: 12 additions & 12 deletions docs/general_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def write_svg():
with BuildPart() as ex8:
with BuildSketch(Plane.YZ) as ex8_sk:
with BuildLine() as ex8_ln:
Polyline(*pts)
Polyline(pts)
mirror(ex8_ln.line, about=Plane.YZ)
make_face()
extrude(amount=L)
Expand Down Expand Up @@ -238,7 +238,7 @@ def write_svg():
##########################################
# 12. Defining an Edge with a Spline
# [Ex. 12]
sPnts = [
pts = [
(55, 30),
(50, 35),
(40, 30),
Expand All @@ -251,7 +251,7 @@ def write_svg():
with BuildPart() as ex12:
with BuildSketch() as ex12_sk:
with BuildLine() as ex12_ln:
l1 = Spline(*sPnts)
l1 = Spline(pts)
l2 = Line((55, 30), (60, 0))
l3 = Line((60, 0), (0, 0))
l4 = Line((0, 0), (0, 20))
Expand Down Expand Up @@ -288,7 +288,7 @@ def write_svg():
with BuildLine() as ex14_ln:
l1 = JernArc(start=(0, 0), tangent=(0, 1), radius=a, arc_size=180)
l2 = JernArc(start=l1 @ 1, tangent=l1 % 1, radius=a, arc_size=-90)
l3 = Line(l2 @ 1, l2 @ 1 + Vector(-a, a))
l3 = Line(l2 @ 1, l2 @ 1 + (-a, a))
with BuildSketch(Plane.XZ) as ex14_sk:
Rectangle(b, b)
sweep()
Expand All @@ -307,10 +307,10 @@ def write_svg():
with BuildSketch() as ex15_sk:
with BuildLine() as ex15_ln:
l1 = Line((0, 0), (a, 0))
l2 = Line(l1 @ 1, l1 @ 1 + Vector(0, b))
l3 = Line(l2 @ 1, l2 @ 1 + Vector(-c, 0))
l4 = Line(l3 @ 1, l3 @ 1 + Vector(0, -c))
l5 = Line(l4 @ 1, Vector(0, (l4 @ 1).Y))
l2 = Line(l1 @ 1, l1 @ 1 + (0, b))
l3 = Line(l2 @ 1, l2 @ 1 + (-c, 0))
l4 = Line(l3 @ 1, l3 @ 1 + (0, -c))
l5 = Line(l4 @ 1, (0, (l4 @ 1).Y))
mirror(ex15_ln.line, about=Plane.YZ)
make_face()
extrude(amount=c)
Expand Down Expand Up @@ -466,7 +466,7 @@ def write_svg():
with BuildPart() as ex23:
with BuildSketch(Plane.XZ) as ex23_sk:
with BuildLine() as ex23_ln:
l1 = Polyline(*pts)
l1 = Polyline(pts)
l2 = Line(l1 @ 1, l1 @ 0)
make_face()
with Locations((0, 35)):
Expand Down Expand Up @@ -574,7 +574,7 @@ def write_svg():
with BuildLine() as ex29_ow_ln:
l1 = Line((0, 0), (0, w / 2))
l2 = ThreePointArc(l1 @ 1, (L / 2.0, w / 2.0 + t), (L, w / 2.0))
l3 = Line(l2 @ 1, Vector((l2 @ 1).X, 0, 0))
l3 = Line(l2 @ 1, ((l2 @ 1).X, 0, 0))
mirror(ex29_ow_ln.line)
make_face()
extrude(amount=h + b)
Expand Down Expand Up @@ -615,8 +615,8 @@ def write_svg():
with BuildPart() as ex30:
with BuildSketch() as ex30_sk:
with BuildLine() as ex30_ln:
l0 = Polyline(*pts)
l1 = Bezier(*pts, weights=wts)
l0 = Polyline(pts)
l1 = Bezier(pts, weights=wts)
make_face()
extrude(amount=10)
# [Ex. 30]
Expand Down
22 changes: 11 additions & 11 deletions docs/general_examples_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
(0, H / -2.0),
]

ln = Polyline(*pts)
ln = Polyline(pts)
ln += mirror(ln, Plane.YZ)

sk8 = make_face(Plane.YZ * ln)
Expand Down Expand Up @@ -180,7 +180,7 @@
##########################################
# 12. Defining an Edge with a Spline
# [Ex. 12]
sPnts = [
pts = [
(55, 30),
(50, 35),
(40, 30),
Expand All @@ -190,7 +190,7 @@
(0, 20),
]

l1 = Spline(*sPnts)
l1 = Spline(pts)
l2 = Line(l1 @ 0, (60, 0))
l3 = Line(l2 @ 1, (0, 0))
l4 = Line(l3 @ 1, l1 @ 1)
Expand Down Expand Up @@ -231,7 +231,7 @@

l1 = JernArc(start=(0, 0), tangent=(0, 1), radius=a, arc_size=180)
l2 = JernArc(start=l1 @ 1, tangent=l1 % 1, radius=a, arc_size=-90)
l3 = Line(l2 @ 1, l2 @ 1 + Vector(-a, a))
l3 = Line(l2 @ 1, l2 @ 1 + (-a, a))
ex14_ln = l1 + l2 + l3

sk14 = Plane.XZ * Rectangle(b, b)
Expand All @@ -246,10 +246,10 @@
a, b, c = 80, 40, 20

l1 = Line((0, 0), (a, 0))
l2 = Line(l1 @ 1, l1 @ 1 + Vector(0, b))
l3 = Line(l2 @ 1, l2 @ 1 + Vector(-c, 0))
l4 = Line(l3 @ 1, l3 @ 1 + Vector(0, -c))
l5 = Line(l4 @ 1, Vector(0, (l4 @ 1).Y))
l2 = Line(l1 @ 1, l1 @ 1 + (0, b))
l3 = Line(l2 @ 1, l2 @ 1 + (-c, 0))
l4 = Line(l3 @ 1, l3 @ 1 + (0, -c))
l5 = Line(l4 @ 1, (0, (l4 @ 1).Y))
ln = Curve() + [l1, l2, l3, l4, l5]
ln += mirror(ln, Plane.YZ)

Expand Down Expand Up @@ -384,7 +384,7 @@
(-15, 35),
]

l1 = Polyline(*pts)
l1 = Polyline(pts)
l2 = Line(l1 @ 1, l1 @ 0)
sk23 = make_face(l1, l2)

Expand Down Expand Up @@ -471,7 +471,7 @@

l1 = Line((0, 0), (0, w / 2))
l2 = ThreePointArc(l1 @ 1, (L / 2.0, w / 2.0 + t), (L, w / 2.0))
l3 = Line(l2 @ 1, Vector((l2 @ 1).X, 0, 0))
l3 = Line(l2 @ 1, ((l2 @ 1).X, 0, 0))
ln29 = l1 + l2 + l3
ln29 += mirror(ln29)
sk29 = make_face(ln29)
Expand Down Expand Up @@ -508,7 +508,7 @@
1.0,
]

ex30_ln = Polyline(*pts) + Bezier(*pts, weights=wts)
ex30_ln = Polyline(pts) + Bezier(pts, weights=wts)
ex30_sk = make_face(ex30_ln)
ex30 = extrude(ex30_sk, -10)
# [Ex. 30]
Expand Down
4 changes: 2 additions & 2 deletions docs/import_export.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For example:
with BuildPart() as box_builder:
Box(1, 1, 1)
box_builder.part.export_step("box.step")
export_step(box_builder.part, "box.step")
File Formats
============
Expand Down Expand Up @@ -217,7 +217,7 @@ ExportSVG
--------------

Both 3MF and STL export (and import) are provided with the :class:`~mesher.Mesher` class.
As mentioned above the 3MF format provides is feature-rich and therefore has a slightly
As mentioned above, the 3MF format it provides is feature-rich and therefore has a slightly
more complex API than the simple Shape exporters.

For example:
Expand Down
3 changes: 1 addition & 2 deletions docs/location_arithmetic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ For the following use the helper function:
.. code-block:: python
def location_symbol(self, l=1) -> Compound:
axes = SVG.axes(axes_scale=l).locate(self)
return Compound.make_compound(axes)
return Compound.make_triad(axes_scale=l).locate(self)
1. **Positioning at a location**
Expand Down
2 changes: 1 addition & 1 deletion src/build123d/operations_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ def sweep(
multisection (bool, optional): sweep multiple on path. Defaults to False.
is_frenet (bool, optional): use frenet algorithm. Defaults to False.
transition (Transition, optional): discontinuity handling option.
Defaults to Transition.RIGHT.
Defaults to Transition.TRANSFORMED.
normal (VectorLike, optional): fixed normal. Defaults to None.
binormal (Union[Edge, Wire], optional): guide rotation along path. Defaults to None.
clean (bool, optional): Remove extraneous internal structure. Defaults to True.
Expand Down

0 comments on commit 235260a

Please sign in to comment.