From b18af27e13ee46f85da67f0073a81415a33a06c1 Mon Sep 17 00:00:00 2001 From: gumyr Date: Sun, 26 Nov 2023 11:35:52 -0500 Subject: [PATCH] Adding IntersectingLine Issue #336 --- docs/assets/buildline_example_5.svg | 2 +- docs/assets/buildline_example_7.svg | 7 +++++++ docs/assets/helix_example.svg | 10 +++++----- docs/assets/intersecting_line_example.svg | 12 ++++++++++++ docs/assets/jern_arc_example.svg | 2 +- docs/assets/polar_line_example.svg | 2 +- docs/assets/tangent_arc_example.svg | 2 +- docs/objects.rst | 8 ++++++++ docs/objects_1d.py | 23 +++++++++++++++++------ 9 files changed, 53 insertions(+), 15 deletions(-) create mode 100644 docs/assets/intersecting_line_example.svg diff --git a/docs/assets/buildline_example_5.svg b/docs/assets/buildline_example_5.svg index eeb26d8..ea53d99 100644 --- a/docs/assets/buildline_example_5.svg +++ b/docs/assets/buildline_example_5.svg @@ -10,7 +10,7 @@ - + diff --git a/docs/assets/buildline_example_7.svg b/docs/assets/buildline_example_7.svg index 2f4428a..e6f7ced 100644 --- a/docs/assets/buildline_example_7.svg +++ b/docs/assets/buildline_example_7.svg @@ -21,5 +21,12 @@ + + + + + + + \ No newline at end of file diff --git a/docs/assets/helix_example.svg b/docs/assets/helix_example.svg index 5ab24c7..bf48766 100644 --- a/docs/assets/helix_example.svg +++ b/docs/assets/helix_example.svg @@ -1,8 +1,8 @@ - + - - + + @@ -17,8 +17,8 @@ - - + + diff --git a/docs/assets/intersecting_line_example.svg b/docs/assets/intersecting_line_example.svg new file mode 100644 index 0000000..1deae87 --- /dev/null +++ b/docs/assets/intersecting_line_example.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/assets/jern_arc_example.svg b/docs/assets/jern_arc_example.svg index 13dcbf3..0410ecc 100644 --- a/docs/assets/jern_arc_example.svg +++ b/docs/assets/jern_arc_example.svg @@ -5,7 +5,7 @@ - + diff --git a/docs/assets/polar_line_example.svg b/docs/assets/polar_line_example.svg index bee604b..1bd9d2b 100644 --- a/docs/assets/polar_line_example.svg +++ b/docs/assets/polar_line_example.svg @@ -5,7 +5,7 @@ - + diff --git a/docs/assets/tangent_arc_example.svg b/docs/assets/tangent_arc_example.svg index 53903ed..6de57f7 100644 --- a/docs/assets/tangent_arc_example.svg +++ b/docs/assets/tangent_arc_example.svg @@ -6,7 +6,7 @@ - + diff --git a/docs/objects.rst b/docs/objects.rst index 83a007d..9e95cef 100644 --- a/docs/objects.rst +++ b/docs/objects.rst @@ -111,6 +111,13 @@ The following objects all can be used in BuildLine contexts. Note that +++ Helix defined pitch, radius and height + .. grid-item-card:: :class:`~objects_curve.IntersectingLine` + + .. image:: assets/intersecting_line_example.svg + + +++ + Intersecting line defined by start, direction & other line + .. grid-item-card:: :class:`~objects_curve.JernArc` .. image:: assets/jern_arc_example.svg @@ -185,6 +192,7 @@ Reference .. autoclass:: EllipticalCenterArc .. autoclass:: FilletPolyline .. autoclass:: Helix +.. autoclass:: IntersectingLine .. autoclass:: JernArc .. autoclass:: Line .. autoclass:: PolarLine diff --git a/docs/objects_1d.py b/docs/objects_1d.py index 939cbde..d4c8332 100644 --- a/docs/objects_1d.py +++ b/docs/objects_1d.py @@ -40,7 +40,7 @@ with BuildLine() as example_5: # [Ex. 5] s = 100 / max(*example_5.line.bounding_box().size) svg = ExportSVG(scale=s) -svg.add_layer("dashed", line_type=LineType.DASHED) +svg.add_layer("dashed", line_type=LineType.ISO_DASH_SPACE) svg.add_shape(example_5.line) svg.add_shape(dot.moved(Location(l1 @ 1))) svg.add_shape(dot.moved(Location(l2 @ 1))) @@ -139,7 +139,7 @@ with BuildLine() as jern_arc: JernArc((1, 1), (1, 0.5), 2, 100) s = 100 / max(*jern_arc.line.bounding_box().size) svg = ExportSVG(scale=s) -svg.add_layer("dashed", line_type=LineType.DASHED) +svg.add_layer("dashed", line_type=LineType.ISO_DASH_SPACE) svg.add_shape(jern_arc.line) svg.add_shape(dot.moved(Location(Vector((1, 1))))) svg.add_shape(PolarLine((1, 1), 0.5, direction=(1, 0.5)), "dashed") @@ -158,7 +158,7 @@ with BuildLine() as polar_line: PolarLine((1, 1), 2.5, 60) s = 100 / max(*polar_line.line.bounding_box().size) svg = ExportSVG(scale=s) -svg.add_layer("dashed", line_type=LineType.DASHED) +svg.add_layer("dashed", line_type=LineType.ISO_DASH_SPACE) svg.add_shape(polar_line.line) svg.add_shape(dot.moved(Location(Vector((1, 1))))) svg.add_shape(PolarLine((1, 1), 4, angle=60), "dashed") @@ -188,7 +188,7 @@ with BuildLine() as radius_arc: RadiusArc((1, 1), (3, 3), 2) s = 100 / max(*radius_arc.line.bounding_box().size) svg = ExportSVG(scale=s) -svg.add_layer("dashed", line_type=LineType.DASHED) +svg.add_layer("dashed", line_type=LineType.ISO_DASH_SPACE) svg.add_shape(radius_arc.line) svg.add_shape(dot.moved(Location(Vector((1, 1))))) svg.add_shape(dot.moved(Location(Vector((3, 3))))) @@ -219,7 +219,7 @@ with BuildLine() as tangent_arc: TangentArc((1, 1), (3, 3), tangent=(1, 0)) s = 100 / max(*tangent_arc.line.bounding_box().size) svg = ExportSVG(scale=s) -svg.add_layer("dashed", line_type=LineType.DASHED) +svg.add_layer("dashed", line_type=LineType.ISO_DASH_SPACE) svg.add_shape(tangent_arc.line) svg.add_shape(dot.moved(Location(Vector((1, 1))))) svg.add_shape(dot.moved(Location(Vector((3, 3))))) @@ -235,7 +235,18 @@ svg.add_shape(dot.moved(Location(Vector((1, 1))))) svg.add_shape(dot.moved(Location(Vector((1.5, 2))))) svg.add_shape(dot.moved(Location(Vector((3, 3))))) svg.write("assets/three_point_arc_example.svg") -# + +with BuildLine() as intersecting_line: + other = Line((2, 0), (2, 2), mode=Mode.PRIVATE) + IntersectingLine((1, 0), (1, 1), other) +s = 100 / max(*intersecting_line.line.bounding_box().size) +svg = ExportSVG(scale=s) +svg.add_layer("dashed", line_type=LineType.ISO_DASH_SPACE) +svg.add_shape(other, "dashed") +svg.add_shape(intersecting_line.line) +svg.add_shape(dot.moved(Location(Vector((1, 0))))) +svg.write("assets/intersecting_line_example.svg") +show(other, intersecting_line) # show_object(example_1.line, name="Ex. 1") # show_object(example_2.line, name="Ex. 2") # show_object(example_3.line, name="Ex. 3")