Skip to content

Commit 11a517f

Browse files
committed
Adding 1D objects ConstrainedArcs & ConstrainedLines
1 parent 1f7c976 commit 11a517f

File tree

9 files changed

+595
-21
lines changed

9 files changed

+595
-21
lines changed
Lines changed: 19 additions & 0 deletions
Loading
Lines changed: 15 additions & 0 deletions
Loading

docs/cheat_sheet.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Cheat Sheet
2121
| :class:`~objects_curve.Bezier`
2222
| :class:`~objects_curve.BlendCurve`
2323
| :class:`~objects_curve.CenterArc`
24+
| :class:`~objects_curve.ConstrainedArcs`
25+
| :class:`~objects_curve.ConstrainedLines`
2426
| :class:`~objects_curve.DoubleTangentArc`
2527
| :class:`~objects_curve.EllipticalCenterArc`
2628
| :class:`~objects_curve.ParabolicCenterArc`

docs/objects.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,22 @@ The following objects all can be used in BuildLine contexts. Note that
104104
+++
105105
Arc defined by center, radius, & angles
106106

107+
108+
.. grid-item-card:: :class:`~objects_curve.ConstrainedArcs`
109+
110+
.. image:: assets/constrained_arcs_example.svg
111+
112+
+++
113+
Arc(s) constrained by other geometric objects
114+
115+
116+
.. grid-item-card:: :class:`~objects_curve.ConstrainedLines`
117+
118+
.. image:: assets/constrained_lines_example.svg
119+
120+
+++
121+
Line(s) constrained by other geometric objects
122+
107123
.. grid-item-card:: :class:`~objects_curve.DoubleTangentArc`
108124

109125
.. image:: assets/double_tangent_line_example.svg
@@ -253,6 +269,8 @@ Reference
253269
.. autoclass:: Bezier
254270
.. autoclass:: BlendCurve
255271
.. autoclass:: CenterArc
272+
.. autoclass:: ConstrainedArcs
273+
.. autoclass:: ConstrainedLines
256274
.. autoclass:: DoubleTangentArc
257275
.. autoclass:: EllipticalCenterArc
258276
.. autoclass:: ParabolicCenterArc

docs/objects_1d_constrained.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# [Setup]
2+
from build123d import *
3+
4+
# from ocp_vscode import *
5+
6+
dot = Circle(0.05)
7+
8+
with BuildLine() as arcs:
9+
c1 = CenterArc((4, 0), 2, 0, 360)
10+
c2 = CenterArc((0, 2), 1.5, 0, 360)
11+
a1 = ConstrainedArcs(c1, c2, radius=6)
12+
13+
s = 100 / max(*arcs.line.bounding_box().size)
14+
svg = ExportSVG(scale=s)
15+
svg.add_layer("dashed", line_type=LineType.ISO_DASH_SPACE)
16+
svg.add_shape(c1, "dashed")
17+
svg.add_shape(c2, "dashed")
18+
svg.add_shape(a1)
19+
svg.write("assets/constrained_arcs_example.svg")
20+
21+
22+
with BuildLine() as lines:
23+
c1 = CenterArc((4, 0), 2, 0, 360)
24+
c2 = CenterArc((0, 2), 1.5, 0, 360)
25+
l1 = ConstrainedLines(c1, c2)
26+
27+
s = 100 / max(*lines.line.bounding_box().size)
28+
svg = ExportSVG(scale=s)
29+
svg.add_layer("dashed", line_type=LineType.ISO_DASH_SPACE)
30+
svg.add_shape(c1, "dashed")
31+
svg.add_shape(c2, "dashed")
32+
svg.add_shape(l1)
33+
svg.write("assets/constrained_lines_example.svg")
34+
35+
# show_all()

src/build123d/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@
8585
"Bezier",
8686
"BlendCurve",
8787
"CenterArc",
88+
"ConstrainedArcs",
89+
"ConstrainedLines",
8890
"DoubleTangentArc",
8991
"EllipticalCenterArc",
9092
"EllipticalStartArc",

0 commit comments

Comments
 (0)