diff --git a/docs/assets/selectors_operators/filter_all_edges_circle.png b/docs/assets/topology_selection/filter_all_edges_circle.png similarity index 100% rename from docs/assets/selectors_operators/filter_all_edges_circle.png rename to docs/assets/topology_selection/filter_all_edges_circle.png diff --git a/docs/assets/selectors_operators/filter_axisplane.png b/docs/assets/topology_selection/filter_axisplane.png similarity index 100% rename from docs/assets/selectors_operators/filter_axisplane.png rename to docs/assets/topology_selection/filter_axisplane.png diff --git a/docs/assets/selectors_operators/filter_dot_axisplane.png b/docs/assets/topology_selection/filter_dot_axisplane.png similarity index 100% rename from docs/assets/selectors_operators/filter_dot_axisplane.png rename to docs/assets/topology_selection/filter_dot_axisplane.png diff --git a/docs/assets/selectors_operators/filter_geomtype_cylinder.png b/docs/assets/topology_selection/filter_geomtype_cylinder.png similarity index 100% rename from docs/assets/selectors_operators/filter_geomtype_cylinder.png rename to docs/assets/topology_selection/filter_geomtype_cylinder.png diff --git a/docs/assets/selectors_operators/filter_geomtype_line.png b/docs/assets/topology_selection/filter_geomtype_line.png similarity index 100% rename from docs/assets/selectors_operators/filter_geomtype_line.png rename to docs/assets/topology_selection/filter_geomtype_line.png diff --git a/docs/assets/selectors_operators/filter_inner_wire_count.png b/docs/assets/topology_selection/filter_inner_wire_count.png similarity index 100% rename from docs/assets/selectors_operators/filter_inner_wire_count.png rename to docs/assets/topology_selection/filter_inner_wire_count.png diff --git a/docs/assets/selectors_operators/filter_inner_wire_count_linear.png b/docs/assets/topology_selection/filter_inner_wire_count_linear.png similarity index 100% rename from docs/assets/selectors_operators/filter_inner_wire_count_linear.png rename to docs/assets/topology_selection/filter_inner_wire_count_linear.png diff --git a/docs/assets/selectors_operators/filter_nested.png b/docs/assets/topology_selection/filter_nested.png similarity index 100% rename from docs/assets/selectors_operators/filter_nested.png rename to docs/assets/topology_selection/filter_nested.png diff --git a/docs/assets/selectors_operators/filter_shape_properties.png b/docs/assets/topology_selection/filter_shape_properties.png similarity index 100% rename from docs/assets/selectors_operators/filter_shape_properties.png rename to docs/assets/topology_selection/filter_shape_properties.png diff --git a/docs/assets/selectors_operators/group_axis_with.png b/docs/assets/topology_selection/group_axis_with.png similarity index 100% rename from docs/assets/selectors_operators/group_axis_with.png rename to docs/assets/topology_selection/group_axis_with.png diff --git a/docs/assets/selectors_operators/group_axis_without.png b/docs/assets/topology_selection/group_axis_without.png similarity index 100% rename from docs/assets/selectors_operators/group_axis_without.png rename to docs/assets/topology_selection/group_axis_without.png diff --git a/docs/assets/selectors_operators/group_hole_area.png b/docs/assets/topology_selection/group_hole_area.png similarity index 100% rename from docs/assets/selectors_operators/group_hole_area.png rename to docs/assets/topology_selection/group_hole_area.png diff --git a/docs/assets/selectors_operators/group_length_key.png b/docs/assets/topology_selection/group_length_key.png similarity index 100% rename from docs/assets/selectors_operators/group_length_key.png rename to docs/assets/topology_selection/group_length_key.png diff --git a/docs/assets/selectors_operators/group_radius_key.png b/docs/assets/topology_selection/group_radius_key.png similarity index 100% rename from docs/assets/selectors_operators/group_radius_key.png rename to docs/assets/topology_selection/group_radius_key.png diff --git a/docs/assets/selectors_operators/operators_filter_z_normal.png b/docs/assets/topology_selection/operators_filter_z_normal.png similarity index 100% rename from docs/assets/selectors_operators/operators_filter_z_normal.png rename to docs/assets/topology_selection/operators_filter_z_normal.png diff --git a/docs/assets/selectors_operators/operators_group_area.png b/docs/assets/topology_selection/operators_group_area.png similarity index 100% rename from docs/assets/selectors_operators/operators_group_area.png rename to docs/assets/topology_selection/operators_group_area.png diff --git a/docs/assets/selectors_operators/operators_sort_x.png b/docs/assets/topology_selection/operators_sort_x.png similarity index 100% rename from docs/assets/selectors_operators/operators_sort_x.png rename to docs/assets/topology_selection/operators_sort_x.png diff --git a/docs/assets/topology_selection/selectors_new_edges.png b/docs/assets/topology_selection/selectors_new_edges.png new file mode 100644 index 0000000..b7c5fb0 Binary files /dev/null and b/docs/assets/topology_selection/selectors_new_edges.png differ diff --git a/docs/assets/selectors_operators/selectors_select_all.png b/docs/assets/topology_selection/selectors_select_all.png similarity index 100% rename from docs/assets/selectors_operators/selectors_select_all.png rename to docs/assets/topology_selection/selectors_select_all.png diff --git a/docs/assets/selectors_operators/selectors_select_last.png b/docs/assets/topology_selection/selectors_select_last.png similarity index 100% rename from docs/assets/selectors_operators/selectors_select_last.png rename to docs/assets/topology_selection/selectors_select_last.png diff --git a/docs/assets/selectors_operators/selectors_select_new.png b/docs/assets/topology_selection/selectors_select_new.png similarity index 100% rename from docs/assets/selectors_operators/selectors_select_new.png rename to docs/assets/topology_selection/selectors_select_new.png diff --git a/docs/assets/selectors_operators/selectors_select_new_fillet.png b/docs/assets/topology_selection/selectors_select_new_fillet.png similarity index 100% rename from docs/assets/selectors_operators/selectors_select_new_fillet.png rename to docs/assets/topology_selection/selectors_select_new_fillet.png diff --git a/docs/assets/selectors_operators/selectors_select_new_none.png b/docs/assets/topology_selection/selectors_select_new_none.png similarity index 100% rename from docs/assets/selectors_operators/selectors_select_new_none.png rename to docs/assets/topology_selection/selectors_select_new_none.png diff --git a/docs/assets/selectors_operators/sort_along_wire.png b/docs/assets/topology_selection/sort_along_wire.png similarity index 100% rename from docs/assets/selectors_operators/sort_along_wire.png rename to docs/assets/topology_selection/sort_along_wire.png diff --git a/docs/assets/selectors_operators/sort_axis.png b/docs/assets/topology_selection/sort_axis.png similarity index 100% rename from docs/assets/selectors_operators/sort_axis.png rename to docs/assets/topology_selection/sort_axis.png diff --git a/docs/assets/selectors_operators/sort_distance_from_largest.png b/docs/assets/topology_selection/sort_distance_from_largest.png similarity index 100% rename from docs/assets/selectors_operators/sort_distance_from_largest.png rename to docs/assets/topology_selection/sort_distance_from_largest.png diff --git a/docs/assets/selectors_operators/sort_distance_from_origin.png b/docs/assets/topology_selection/sort_distance_from_origin.png similarity index 100% rename from docs/assets/selectors_operators/sort_distance_from_origin.png rename to docs/assets/topology_selection/sort_distance_from_origin.png diff --git a/docs/assets/selectors_operators/sort_not_along_wire.png b/docs/assets/topology_selection/sort_not_along_wire.png similarity index 100% rename from docs/assets/selectors_operators/sort_not_along_wire.png rename to docs/assets/topology_selection/sort_not_along_wire.png diff --git a/docs/assets/selectors_operators/sort_sortby_distance.png b/docs/assets/topology_selection/sort_sortby_distance.png similarity index 100% rename from docs/assets/selectors_operators/sort_sortby_distance.png rename to docs/assets/topology_selection/sort_sortby_distance.png diff --git a/docs/assets/selectors_operators/sort_sortby_length.png b/docs/assets/topology_selection/sort_sortby_length.png similarity index 100% rename from docs/assets/selectors_operators/sort_sortby_length.png rename to docs/assets/topology_selection/sort_sortby_length.png diff --git a/docs/assets/selectors_operators/thumb_filter_all_edges_circle.png b/docs/assets/topology_selection/thumb_filter_all_edges_circle.png similarity index 100% rename from docs/assets/selectors_operators/thumb_filter_all_edges_circle.png rename to docs/assets/topology_selection/thumb_filter_all_edges_circle.png diff --git a/docs/assets/selectors_operators/thumb_filter_axisplane.png b/docs/assets/topology_selection/thumb_filter_axisplane.png similarity index 100% rename from docs/assets/selectors_operators/thumb_filter_axisplane.png rename to docs/assets/topology_selection/thumb_filter_axisplane.png diff --git a/docs/assets/selectors_operators/thumb_filter_geomtype.png b/docs/assets/topology_selection/thumb_filter_geomtype.png similarity index 100% rename from docs/assets/selectors_operators/thumb_filter_geomtype.png rename to docs/assets/topology_selection/thumb_filter_geomtype.png diff --git a/docs/assets/selectors_operators/thumb_filter_inner_wire_count.png b/docs/assets/topology_selection/thumb_filter_inner_wire_count.png similarity index 100% rename from docs/assets/selectors_operators/thumb_filter_inner_wire_count.png rename to docs/assets/topology_selection/thumb_filter_inner_wire_count.png diff --git a/docs/assets/selectors_operators/thumb_filter_nested.png b/docs/assets/topology_selection/thumb_filter_nested.png similarity index 100% rename from docs/assets/selectors_operators/thumb_filter_nested.png rename to docs/assets/topology_selection/thumb_filter_nested.png diff --git a/docs/assets/selectors_operators/thumb_filter_shape_properties.png b/docs/assets/topology_selection/thumb_filter_shape_properties.png similarity index 100% rename from docs/assets/selectors_operators/thumb_filter_shape_properties.png rename to docs/assets/topology_selection/thumb_filter_shape_properties.png diff --git a/docs/assets/selectors_operators/thumb_group_axis.png b/docs/assets/topology_selection/thumb_group_axis.png similarity index 100% rename from docs/assets/selectors_operators/thumb_group_axis.png rename to docs/assets/topology_selection/thumb_group_axis.png diff --git a/docs/assets/selectors_operators/thumb_group_hole_area.png b/docs/assets/topology_selection/thumb_group_hole_area.png similarity index 100% rename from docs/assets/selectors_operators/thumb_group_hole_area.png rename to docs/assets/topology_selection/thumb_group_hole_area.png diff --git a/docs/assets/selectors_operators/thumb_group_properties_with_keys.png b/docs/assets/topology_selection/thumb_group_properties_with_keys.png similarity index 100% rename from docs/assets/selectors_operators/thumb_group_properties_with_keys.png rename to docs/assets/topology_selection/thumb_group_properties_with_keys.png diff --git a/docs/assets/selectors_operators/thumb_sort_along_wire.png b/docs/assets/topology_selection/thumb_sort_along_wire.png similarity index 100% rename from docs/assets/selectors_operators/thumb_sort_along_wire.png rename to docs/assets/topology_selection/thumb_sort_along_wire.png diff --git a/docs/assets/selectors_operators/thumb_sort_axis.png b/docs/assets/topology_selection/thumb_sort_axis.png similarity index 100% rename from docs/assets/selectors_operators/thumb_sort_axis.png rename to docs/assets/topology_selection/thumb_sort_axis.png diff --git a/docs/assets/selectors_operators/thumb_sort_distance.png b/docs/assets/topology_selection/thumb_sort_distance.png similarity index 100% rename from docs/assets/selectors_operators/thumb_sort_distance.png rename to docs/assets/topology_selection/thumb_sort_distance.png diff --git a/docs/assets/selectors_operators/thumb_sort_sortby.png b/docs/assets/topology_selection/thumb_sort_sortby.png similarity index 100% rename from docs/assets/selectors_operators/thumb_sort_sortby.png rename to docs/assets/topology_selection/thumb_sort_sortby.png diff --git a/docs/index.rst b/docs/index.rst index 2ca15bc..0af6014 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -113,8 +113,8 @@ Table Of Contents introductory_examples.rst tutorials.rst objects.rst - selectors_operators.rst operations.rst + topology_selection.rst builders.rst joints.rst assemblies.rst diff --git a/docs/selectors_operators.rst b/docs/topology_selection.rst similarity index 77% rename from docs/selectors_operators.rst rename to docs/topology_selection.rst index 9199af6..f1ef50e 100644 --- a/docs/selectors_operators.rst +++ b/docs/topology_selection.rst @@ -1,8 +1,11 @@ -####################### -Selectors and Operators -####################### +##################################### +Topology Selection and Exploration +##################################### -Selectors and operators are powerful methods to select and organize CAD objects for +:ref:`topology` is the structure of build123d geometric features and traversing the +topology of a part is often required to specify objects for an operation or to locate a +CAD feature. :ref:`selectors` allow selection of topology objects into a |ShapeList|. +:ref:`operators` are powerful methods further explore and refine a |ShapeList| for subsequent operations. .. _selectors: @@ -13,7 +16,7 @@ Selectors Selectors provide methods to extract all or a subset of a feature type in the referenced object. These methods select Edges, Faces, Solids, Vertices, or Wires in Builder objects -or from Shape objects themselves. All of these methods return a :class:`~topology.ShapeList`, +or from Shape objects themselves. All of these methods return a |ShapeList|, which is a subclass of ``list`` and may be sorted, grouped, or filtered by :ref:`operators`. @@ -53,10 +56,10 @@ a feature as long as they can contain the feature being selected. # Create sketch out of context Rectangle(1, 1).edges() -Select In Build Objects +Select In Build Context ======================== -Build objects track the last operation and their selector methods can take +Build contexts track the last operation and their selector methods can take :class:`~build_enums.Select` as criteria to specify a subset of features to extract. By default, a selector will select ``ALL`` of a feature, while ``LAST`` selects features created or altered by the most recent operation. |edges| can @@ -97,7 +100,7 @@ Create a simple part to demonstrate selectors. Select using the default criteria part.edges(Select.ALL) part.faces(Select.ALL) -.. figure:: assets/selectors_operators/selectors_select_all.png +.. figure:: assets/topology_selection/selectors_select_all.png :align: center The default ``Select.ALL`` features @@ -114,7 +117,7 @@ Select features changed in the last operation with criteria ``Select.LAST``. part.edges(Select.LAST) part.faces(Select.LAST) -.. figure:: assets/selectors_operators/selectors_select_last.png +.. figure:: assets/topology_selection/selectors_select_last.png :align: center ``Select.LAST`` features @@ -130,7 +133,7 @@ available for a ``ShapeList`` of edges! part.edges(Select.NEW) -.. figure:: assets/selectors_operators/selectors_select_new.png +.. figure:: assets/topology_selection/selectors_select_new.png :align: center ``Select.NEW`` edges where box and cylinder intersect @@ -147,7 +150,7 @@ edges are reused? part.edges(Select.NEW) -.. figure:: assets/selectors_operators/selectors_select_new_none.png +.. figure:: assets/topology_selection/selectors_select_new_none.png :align: center ``Select.NEW`` edges when box and cylinder don't intersect @@ -158,7 +161,8 @@ only completely new edges created by the operation. .. note:: - Chamfer and fillet modify the current object, but do not have new edges. + Chamfer and fillet modify the current object, but do not have new edges via + ``Select.NEW``. .. code-block:: python @@ -170,11 +174,44 @@ only completely new edges created by the operation. part.edges(Select.NEW) - .. figure:: assets/selectors_operators/selectors_select_new_fillet.png + .. figure:: assets/topology_selection/selectors_select_new_fillet.png :align: center Left, ``Select.NEW`` returns no edges after fillet. Right, ``Select.LAST`` +Select New Edges In Algebra Mode +================================ + +The utility method ``new_edges`` compares one or more shape objects to a +another "combined" shape object and returns the edges new to the combined shape. +``new_edges`` is available both Algebra mode or Builder mode, but is necessary in +Algebra Mode where ``Select.NEW`` is unavailable + +.. code-block:: python + + box = Box(5, 5, 1) + circle = Cylinder(2, 5) + part = box + circle + edges = new_edges(box, circle, combined=part) + +.. figure:: assets/topology_selection/selectors_new_edges.png + :align: center + +``new_edges`` can also find edges created during a chamfer or fillet operation by +comparing the object before the operation to the "combined" object. + +.. code-block:: python + + box = Box(5, 5, 1) + circle = Cylinder(2, 5) + part_before = box + circle + edges = part_before.edges().filter_by(lambda a: a.length == 1) + part = fillet(edges, 1) + edges = new_edges(part_before, combined=part) + +.. figure:: assets/topology_selection/operators_group_area.png + :align: center + .. _operators: ********* @@ -230,7 +267,7 @@ subclass of ``list``, so any list slice can be used. part.vertices().sort_by(Axis.X)[-4:] -.. figure:: assets/selectors_operators/operators_sort_x.png +.. figure:: assets/topology_selection/operators_sort_x.png :align: center | @@ -242,28 +279,28 @@ Examples :maxdepth: 2 :hidden: - selectors_operators/sort_examples + topology_selection/sort_examples .. grid:: 3 :gutter: 3 .. grid-item-card:: SortBy - :img-top: assets/selectors_operators/thumb_sort_sortby.png + :img-top: assets/topology_selection/thumb_sort_sortby.png :link: sort_sortby :link-type: ref .. grid-item-card:: Along Wire - :img-top: assets/selectors_operators/thumb_sort_along_wire.png + :img-top: assets/topology_selection/thumb_sort_along_wire.png :link: sort_along_wire :link-type: ref .. grid-item-card:: Axis - :img-top: assets/selectors_operators/thumb_sort_axis.png + :img-top: assets/topology_selection/thumb_sort_axis.png :link: sort_axis :link-type: ref .. grid-item-card:: Distance From - :img-top: assets/selectors_operators/thumb_sort_distance.png + :img-top: assets/topology_selection/thumb_sort_distance.png :link: sort_distance_from :link-type: ref @@ -272,10 +309,11 @@ Group A ShapeList can be grouped and sorted with the |group_by| method based on a grouping criteria. Grouping can be a great way to organize features without knowing the values of -specific feature properties. Rather than returning a ``Shapelist``, |group_by| returns -a ``GroupBy`` which can be indexed to retrieve a ``Shapelist`` for further operations. -``GroupBy`` groups can also be accessed using a key with the ``group`` method. If the -keys are unknown they can be discovered with ``key_to_group_index``. +specific feature properties. Rather than returning a ``ShapeList``, |group_by| returns +a ``GroupBy``, a list of ``ShapeList`` objects sorted by the grouping criteria. +``GroupBy`` can be printed to view the members of each group, indexed like a list to +retrieve a ``ShapeList``, and be accessed using a key with the ``group`` method. If the +group keys are unknown they can be discovered with ``key_to_group_index``. If we want only the edges from the smallest faces by area we can get the faces, then group by ``SortBy.AREA``. The ``ShapeList`` of smallest faces is available from the first @@ -286,7 +324,7 @@ return a new list of all edges in the previous list. part.faces().group_by(SortBy.AREA)[0].edges()) -.. figure:: assets/selectors_operators/operators_group_area.png +.. figure:: assets/topology_selection/operators_group_area.png :align: center | @@ -298,23 +336,23 @@ Examples :maxdepth: 2 :hidden: - selectors_operators/group_examples + topology_selection/group_examples .. grid:: 3 :gutter: 3 .. grid-item-card:: Axis and Length - :img-top: assets/selectors_operators/thumb_group_axis.png + :img-top: assets/topology_selection/thumb_group_axis.png :link: group_axis :link-type: ref .. grid-item-card:: Hole Area - :img-top: assets/selectors_operators/thumb_group_hole_area.png + :img-top: assets/topology_selection/thumb_group_hole_area.png :link: group_hole_area :link-type: ref .. grid-item-card:: Properties with Keys - :img-top: assets/selectors_operators/thumb_group_properties_with_keys.png + :img-top: assets/topology_selection/thumb_group_properties_with_keys.png :link: group_properties_with_keys :link-type: ref @@ -334,7 +372,7 @@ each face can be checked against a vector direction and filtered accordingly. part.faces().filter_by(lambda f: f.normal_at() == Vector(0, 0, 1)) -.. figure:: assets/selectors_operators/operators_filter_z_normal.png +.. figure:: assets/topology_selection/operators_filter_z_normal.png :align: center | @@ -346,38 +384,38 @@ Examples :maxdepth: 2 :hidden: - selectors_operators/filter_examples + topology_selection/filter_examples .. grid:: 3 :gutter: 3 .. grid-item-card:: GeomType - :img-top: assets/selectors_operators/thumb_filter_geomtype.png + :img-top: assets/topology_selection/thumb_filter_geomtype.png :link: filter_geomtype :link-type: ref .. grid-item-card:: All Edges Circle - :img-top: assets/selectors_operators/thumb_filter_all_edges_circle.png + :img-top: assets/topology_selection/thumb_filter_all_edges_circle.png :link: filter_all_edges_circle :link-type: ref .. grid-item-card:: Axis and Plane - :img-top: assets/selectors_operators/thumb_filter_axisplane.png + :img-top: assets/topology_selection/thumb_filter_axisplane.png :link: filter_axis_plane :link-type: ref .. grid-item-card:: Inner Wire Count - :img-top: assets/selectors_operators/thumb_filter_inner_wire_count.png + :img-top: assets/topology_selection/thumb_filter_inner_wire_count.png :link: filter_inner_wire_count :link-type: ref .. grid-item-card:: Nested Filters - :img-top: assets/selectors_operators/thumb_filter_nested.png + :img-top: assets/topology_selection/thumb_filter_nested.png :link: filter_nested :link-type: ref .. grid-item-card:: Shape Properties - :img-top: assets/selectors_operators/thumb_filter_shape_properties.png + :img-top: assets/topology_selection/thumb_filter_shape_properties.png :link: filter_shape_properties :link-type: ref @@ -391,3 +429,4 @@ Examples .. |group_by| replace:: :meth:`~topology.ShapeList.group_by` .. |filter_by| replace:: :meth:`~topology.ShapeList.filter_by` .. |filter_by_position| replace:: :meth:`~topology.ShapeList.filter_by_position` +.. |ShapeList| replace:: :class:`~topology.ShapeList` diff --git a/docs/selectors_operators/examples/filter_all_edges_circle.py b/docs/topology_selection/examples/filter_all_edges_circle.py similarity index 95% rename from docs/selectors_operators/examples/filter_all_edges_circle.py rename to docs/topology_selection/examples/filter_all_edges_circle.py index 4099962..2531158 100644 --- a/docs/selectors_operators/examples/filter_all_edges_circle.py +++ b/docs/topology_selection/examples/filter_all_edges_circle.py @@ -4,7 +4,7 @@ from build123d import * from ocp_vscode import * working_path = os.path.dirname(os.path.abspath(__file__)) -filedir = os.path.join(working_path, "..", "..", "assets", "selectors_operators") +filedir = os.path.join(working_path, "..", "..", "assets", "topology_selection") with BuildPart() as part: with BuildSketch() as s: diff --git a/docs/selectors_operators/examples/filter_axisplane.py b/docs/topology_selection/examples/filter_axisplane.py similarity index 94% rename from docs/selectors_operators/examples/filter_axisplane.py rename to docs/topology_selection/examples/filter_axisplane.py index 2477360..3bb08ff 100644 --- a/docs/selectors_operators/examples/filter_axisplane.py +++ b/docs/topology_selection/examples/filter_axisplane.py @@ -4,7 +4,7 @@ from build123d import * from ocp_vscode import * working_path = os.path.dirname(os.path.abspath(__file__)) -filedir = os.path.join(working_path, "..", "..", "assets", "selectors_operators") +filedir = os.path.join(working_path, "..", "..", "assets", "topology_selection") axis = Axis.Z plane = Plane.XY diff --git a/docs/selectors_operators/examples/filter_geomtype.py b/docs/topology_selection/examples/filter_geomtype.py similarity index 87% rename from docs/selectors_operators/examples/filter_geomtype.py rename to docs/topology_selection/examples/filter_geomtype.py index 245ec2d..cb791cd 100644 --- a/docs/selectors_operators/examples/filter_geomtype.py +++ b/docs/topology_selection/examples/filter_geomtype.py @@ -4,7 +4,7 @@ from build123d import * from ocp_vscode import * working_path = os.path.dirname(os.path.abspath(__file__)) -filedir = os.path.join(working_path, "..", "..", "assets", "selectors_operators") +filedir = os.path.join(working_path, "..", "..", "assets", "topology_selection") with BuildPart() as part: Box(5, 5, 1) diff --git a/docs/selectors_operators/examples/filter_inner_wire_count.py b/docs/topology_selection/examples/filter_inner_wire_count.py similarity index 94% rename from docs/selectors_operators/examples/filter_inner_wire_count.py rename to docs/topology_selection/examples/filter_inner_wire_count.py index c938b18..7f8ef68 100644 --- a/docs/selectors_operators/examples/filter_inner_wire_count.py +++ b/docs/topology_selection/examples/filter_inner_wire_count.py @@ -5,7 +5,7 @@ from build123d import * from ocp_vscode import * working_path = os.path.dirname(os.path.abspath(__file__)) -filedir = os.path.join(working_path, "..", "..", "assets", "selectors_operators") +filedir = os.path.join(working_path, "..", "..", "assets", "topology_selection") bracket = import_step(os.path.join(working_path, "nema-17-bracket.step")) faces = bracket.faces() diff --git a/docs/selectors_operators/examples/filter_nested.py b/docs/topology_selection/examples/filter_nested.py similarity index 92% rename from docs/selectors_operators/examples/filter_nested.py rename to docs/topology_selection/examples/filter_nested.py index 95ebfe3..dba8293 100644 --- a/docs/selectors_operators/examples/filter_nested.py +++ b/docs/topology_selection/examples/filter_nested.py @@ -5,7 +5,7 @@ from build123d import * from ocp_vscode import * working_path = os.path.dirname(os.path.abspath(__file__)) -filedir = os.path.join(working_path, "..", "..", "assets", "selectors_operators") +filedir = os.path.join(working_path, "..", "..", "assets", "topology_selection") with BuildPart() as part: Cylinder(15, 2, align=(Align.CENTER, Align.CENTER, Align.MIN)) diff --git a/docs/selectors_operators/examples/filter_shape_properties.py b/docs/topology_selection/examples/filter_shape_properties.py similarity index 91% rename from docs/selectors_operators/examples/filter_shape_properties.py rename to docs/topology_selection/examples/filter_shape_properties.py index e87a757..7a1f39c 100644 --- a/docs/selectors_operators/examples/filter_shape_properties.py +++ b/docs/topology_selection/examples/filter_shape_properties.py @@ -4,7 +4,7 @@ from build123d import * from ocp_vscode import * working_path = os.path.dirname(os.path.abspath(__file__)) -filedir = os.path.join(working_path, "..", "..", "assets", "selectors_operators") +filedir = os.path.join(working_path, "..", "..", "assets", "topology_selection") with BuildPart() as open_box_builder: Box(20, 20, 5) diff --git a/docs/selectors_operators/examples/group_axis.py b/docs/topology_selection/examples/group_axis.py similarity index 89% rename from docs/selectors_operators/examples/group_axis.py rename to docs/topology_selection/examples/group_axis.py index 24c200d..4e95757 100644 --- a/docs/selectors_operators/examples/group_axis.py +++ b/docs/topology_selection/examples/group_axis.py @@ -5,7 +5,7 @@ from build123d import * from ocp_vscode import * working_path = os.path.dirname(os.path.abspath(__file__)) -filedir = os.path.join(working_path, "..", "..", "assets", "selectors_operators") +filedir = os.path.join(working_path, "..", "..", "assets", "topology_selection") with BuildPart() as fins: with GridLocations(4, 6, 4, 4): diff --git a/docs/selectors_operators/examples/group_hole_area.py b/docs/topology_selection/examples/group_hole_area.py similarity index 92% rename from docs/selectors_operators/examples/group_hole_area.py rename to docs/topology_selection/examples/group_hole_area.py index f404db7..43cd53c 100644 --- a/docs/selectors_operators/examples/group_hole_area.py +++ b/docs/topology_selection/examples/group_hole_area.py @@ -5,7 +5,7 @@ from build123d import * from ocp_vscode import * working_path = os.path.dirname(os.path.abspath(__file__)) -filedir = os.path.join(working_path, "..", "..", "assets", "selectors_operators") +filedir = os.path.join(working_path, "..", "..", "assets", "topology_selection") with BuildPart() as part: Cylinder(10, 30, rotation=(90, 0, 0)) diff --git a/docs/selectors_operators/examples/group_properties_with_keys.py b/docs/topology_selection/examples/group_properties_with_keys.py similarity index 96% rename from docs/selectors_operators/examples/group_properties_with_keys.py rename to docs/topology_selection/examples/group_properties_with_keys.py index 85824f7..85c4eaf 100644 --- a/docs/selectors_operators/examples/group_properties_with_keys.py +++ b/docs/topology_selection/examples/group_properties_with_keys.py @@ -5,7 +5,7 @@ from build123d import * from ocp_vscode import * working_path = os.path.dirname(os.path.abspath(__file__)) -filedir = os.path.join(working_path, "..", "..", "assets", "selectors_operators") +filedir = os.path.join(working_path, "..", "..", "assets", "topology_selection") with BuildPart() as part: with BuildSketch(Plane.XZ) as sketch: diff --git a/docs/selectors_operators/examples/selectors_operators.py b/docs/topology_selection/examples/selectors_operators.py similarity index 91% rename from docs/selectors_operators/examples/selectors_operators.py rename to docs/topology_selection/examples/selectors_operators.py index 8cda0b5..e19e613 100644 --- a/docs/selectors_operators/examples/selectors_operators.py +++ b/docs/topology_selection/examples/selectors_operators.py @@ -5,7 +5,7 @@ from build123d import * from ocp_vscode import * working_path = os.path.dirname(os.path.abspath(__file__)) -filedir = os.path.join(working_path, "..", "..", "assets", "selectors_operators") +filedir = os.path.join(working_path, "..", "..", "assets", "topology_selection") selectors = [solids, vertices, edges, faces] line = Line((-9, -9), (9, 9)) @@ -91,3 +91,10 @@ save_screenshot(os.path.join(filedir, "operators_group_area.png")) faces = part.faces().filter_by(lambda f: f.normal_at() == Vector(0, 0, 1)) show(part, [f.translate(f.normal_at() * 0.01) for f in faces]) save_screenshot(os.path.join(filedir, "operators_filter_z_normal.png")) + +box = Box(5, 5, 1) +circle = Cylinder(2, 5) +part = box + circle +edges = new_edges(box, circle, combined=part) +show(part, edges) +save_screenshot(os.path.join(filedir, "selectors_new_edges.png")) \ No newline at end of file diff --git a/docs/selectors_operators/examples/sort_along_wire.py b/docs/topology_selection/examples/sort_along_wire.py similarity index 90% rename from docs/selectors_operators/examples/sort_along_wire.py rename to docs/topology_selection/examples/sort_along_wire.py index 654e096..0870d51 100644 --- a/docs/selectors_operators/examples/sort_along_wire.py +++ b/docs/topology_selection/examples/sort_along_wire.py @@ -4,7 +4,7 @@ from build123d import * from ocp_vscode import * working_path = os.path.dirname(os.path.abspath(__file__)) -filedir = os.path.join(working_path, "..", "..", "assets", "selectors_operators") +filedir = os.path.join(working_path, "..", "..", "assets", "topology_selection") with BuildSketch() as along_wire: Rectangle(48, 16, align=Align.MIN) diff --git a/docs/selectors_operators/examples/sort_axis.py b/docs/topology_selection/examples/sort_axis.py similarity index 91% rename from docs/selectors_operators/examples/sort_axis.py rename to docs/topology_selection/examples/sort_axis.py index 198a597..62074a6 100644 --- a/docs/selectors_operators/examples/sort_axis.py +++ b/docs/topology_selection/examples/sort_axis.py @@ -5,7 +5,7 @@ from build123d import * from ocp_vscode import * working_path = os.path.dirname(os.path.abspath(__file__)) -filedir = os.path.join(working_path, "..", "..", "assets", "selectors_operators") +filedir = os.path.join(working_path, "..", "..", "assets", "topology_selection") with BuildPart() as part: with BuildSketch(Plane.YZ) as profile: diff --git a/docs/selectors_operators/examples/sort_distance_from.py b/docs/topology_selection/examples/sort_distance_from.py similarity index 88% rename from docs/selectors_operators/examples/sort_distance_from.py rename to docs/topology_selection/examples/sort_distance_from.py index 25e853d..8f82b6f 100644 --- a/docs/selectors_operators/examples/sort_distance_from.py +++ b/docs/topology_selection/examples/sort_distance_from.py @@ -5,7 +5,7 @@ from build123d import * from ocp_vscode import * working_path = os.path.dirname(os.path.abspath(__file__)) -filedir = os.path.join(working_path, "..", "..", "assets", "selectors_operators") +filedir = os.path.join(working_path, "..", "..", "assets", "topology_selection") boxes = ShapeList( Box(1, 1, 1).scale(0.75 if (i, j) == (1, 2) else 0.25).translate((i, j, 0)) diff --git a/docs/selectors_operators/examples/sort_sortby.py b/docs/topology_selection/examples/sort_sortby.py similarity index 94% rename from docs/selectors_operators/examples/sort_sortby.py rename to docs/topology_selection/examples/sort_sortby.py index 28cbf48..9500e0b 100644 --- a/docs/selectors_operators/examples/sort_sortby.py +++ b/docs/topology_selection/examples/sort_sortby.py @@ -4,7 +4,7 @@ from build123d import * from ocp_vscode import * working_path = os.path.dirname(os.path.abspath(__file__)) -filedir = os.path.join(working_path, "..", "..", "assets", "selectors_operators") +filedir = os.path.join(working_path, "..", "..", "assets", "topology_selection") with BuildPart() as part: Box(5, 5, 1) diff --git a/docs/selectors_operators/filter_examples.rst b/docs/topology_selection/filter_examples.rst similarity index 89% rename from docs/selectors_operators/filter_examples.rst rename to docs/topology_selection/filter_examples.rst index 85bdb9d..f7233b8 100644 --- a/docs/selectors_operators/filter_examples.rst +++ b/docs/topology_selection/filter_examples.rst @@ -25,7 +25,7 @@ operations, and are sometimes necessary e.g. before sorting or filtering by radi :language: python :lines: 15 -.. figure:: ../assets/selectors_operators/filter_geomtype_line.png +.. figure:: ../assets/topology_selection/filter_geomtype_line.png :align: center | @@ -34,7 +34,7 @@ operations, and are sometimes necessary e.g. before sorting or filtering by radi :language: python :lines: 17 -.. figure:: ../assets/selectors_operators/filter_geomtype_cylinder.png +.. figure:: ../assets/topology_selection/filter_geomtype_cylinder.png :align: center | @@ -59,7 +59,7 @@ circular edges selects the counterbore faces that meet the joint criteria. :language: python :lines: 43-47 -.. figure:: ../assets/selectors_operators/filter_all_edges_circle.png +.. figure:: ../assets/topology_selection/filter_all_edges_circle.png :align: center | @@ -86,7 +86,7 @@ Plane will select faces parallel to the plane. part.faces().filter_by(Axis.Z) part.faces().filter_by(Plane.XY) -.. figure:: ../assets/selectors_operators/filter_axisplane.png +.. figure:: ../assets/topology_selection/filter_axisplane.png :align: center | @@ -101,7 +101,7 @@ to 0. The result is faces parallel to the axis or perpendicular to the plane. part.faces().filter_by(lambda f: abs(f.normal_at().dot(Axis.Z.direction) < 1e-6) part.faces().filter_by(lambda f: abs(f.normal_at().dot(Plane.XY.z_dir)) < 1e-6) -.. figure:: ../assets/selectors_operators/filter_dot_axisplane.png +.. figure:: ../assets/topology_selection/filter_dot_axisplane.png :align: center | @@ -129,7 +129,7 @@ and then filtering for the specific inner wire by radius. :language: python :lines: 18-21 -.. figure:: ../assets/selectors_operators/filter_inner_wire_count.png +.. figure:: ../assets/topology_selection/filter_inner_wire_count.png :align: center | @@ -143,7 +143,7 @@ select the top face, and then filter for the circular edges of the inner wires. :language: python :lines: 25-32 -.. figure:: ../assets/selectors_operators/filter_inner_wire_count_linear.png +.. figure:: ../assets/topology_selection/filter_inner_wire_count_linear.png :align: center | @@ -170,7 +170,7 @@ any line edges. :language: python :lines: 26-32 -.. figure:: ../assets/selectors_operators/filter_nested.png +.. figure:: ../assets/topology_selection/filter_nested.png :align: center | @@ -189,7 +189,7 @@ to highlight the resulting fillets. :language: python :lines: 3-4, 8-22 -.. figure:: ../assets/selectors_operators/filter_shape_properties.png +.. figure:: ../assets/topology_selection/filter_shape_properties.png :align: center | \ No newline at end of file diff --git a/docs/selectors_operators/group_examples.rst b/docs/topology_selection/group_examples.rst similarity index 90% rename from docs/selectors_operators/group_examples.rst rename to docs/topology_selection/group_examples.rst index 3653ce7..3f0057b 100644 --- a/docs/selectors_operators/group_examples.rst +++ b/docs/topology_selection/group_examples.rst @@ -17,7 +17,7 @@ result knowing how many edges to expect. :language: python :lines: 4, 9-17 -.. figure:: ../assets/selectors_operators/group_axis_without.png +.. figure:: ../assets/topology_selection/group_axis_without.png :align: center | @@ -29,7 +29,7 @@ group again by length. In both cases, you can select the desired edges from the :language: python :lines: 21-22 -.. figure:: ../assets/selectors_operators/group_axis_with.png +.. figure:: ../assets/topology_selection/group_axis_with.png :align: center | @@ -53,7 +53,7 @@ with the largest hole. :language: python :lines: 21-24 -.. figure:: ../assets/selectors_operators/group_hole_area.png +.. figure:: ../assets/topology_selection/group_hole_area.png :align: center | @@ -79,7 +79,7 @@ then the desired groups are selected with the ``group`` method using the lengths :language: python :lines: 30, 31 -.. figure:: ../assets/selectors_operators/group_length_key.png +.. figure:: ../assets/topology_selection/group_length_key.png :align: center | @@ -101,7 +101,7 @@ and then further specify only the edges the bearings and pins are installed from :language: python :lines: 47-50 -.. figure:: ../assets/selectors_operators/group_radius_key.png +.. figure:: ../assets/topology_selection/group_radius_key.png :align: center | diff --git a/docs/selectors_operators/sort_examples.rst b/docs/topology_selection/sort_examples.rst similarity index 87% rename from docs/selectors_operators/sort_examples.rst rename to docs/topology_selection/sort_examples.rst index 91284a9..a4779fc 100644 --- a/docs/selectors_operators/sort_examples.rst +++ b/docs/topology_selection/sort_examples.rst @@ -30,7 +30,7 @@ be used with``group_by``. :language: python :lines: 19-22 -.. figure:: ../assets/selectors_operators/sort_sortby_length.png +.. figure:: ../assets/topology_selection/sort_sortby_length.png :align: center | @@ -39,7 +39,7 @@ be used with``group_by``. :language: python :lines: 24-27 -.. figure:: ../assets/selectors_operators/sort_sortby_distance.png +.. figure:: ../assets/topology_selection/sort_sortby_distance.png :align: center | @@ -64,7 +64,7 @@ the order is random. :language: python :lines: 14-15 -.. figure:: ../assets/selectors_operators/sort_not_along_wire.png +.. figure:: ../assets/topology_selection/sort_not_along_wire.png :align: center | @@ -76,7 +76,7 @@ radii now increase in order. :language: python :lines: 26-28 -.. figure:: ../assets/selectors_operators/sort_along_wire.png +.. figure:: ../assets/topology_selection/sort_along_wire.png :align: center | @@ -101,7 +101,7 @@ edge can be found sorting along y-axis. :language: python :lines: 22-24 -.. figure:: ../assets/selectors_operators/sort_axis.png +.. figure:: ../assets/topology_selection/sort_axis.png :align: center | @@ -125,7 +125,7 @@ Here we are sorting the boxes by distance from the origin, using an empty ``Vert :language: python :lines: 15-16 -.. figure:: ../assets/selectors_operators/sort_distance_from_origin.png +.. figure:: ../assets/topology_selection/sort_distance_from_origin.png :align: center | @@ -138,7 +138,7 @@ their distance from the largest box. :language: python :lines: 19-20 -.. figure:: ../assets/selectors_operators/sort_distance_from_largest.png +.. figure:: ../assets/topology_selection/sort_distance_from_largest.png :align: center | \ No newline at end of file