mirror of
https://github.com/gumyr/build123d.git
synced 2025-12-06 02:30:55 -08:00
Merge branch 'dev' of https://github.com/gumyr/build123d into dev
This commit is contained in:
commit
ad11a97ec3
12 changed files with 13 additions and 13 deletions
|
|
@ -61,7 +61,7 @@ with :math:`B^3 \subset C^3, B^2 \subset C^2` and :math:`B^1 \subset C^1`
|
||||||
* This definition also includes that neither ``-`` nor ``&`` are commutative.
|
* This definition also includes that neither ``-`` nor ``&`` are commutative.
|
||||||
|
|
||||||
|
|
||||||
Locations, planes and location arithmentic
|
Locations, planes and location arithmetic
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
|
|
||||||
**Set definitions:**
|
**Set definitions:**
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ is found within a rod end as shown here:
|
||||||
:emphasize-lines: 40-44,51,53
|
:emphasize-lines: 40-44,51,53
|
||||||
|
|
||||||
Note how limits are defined during the instantiation of the ball joint when ensures that the pin or bolt
|
Note how limits are defined during the instantiation of the ball joint when ensures that the pin or bolt
|
||||||
within the rod end does not interfer with the rod end itself. The ``connect_to`` sets the three angles
|
within the rod end does not interfere with the rod end itself. The ``connect_to`` sets the three angles
|
||||||
(only two are significant in this example).
|
(only two are significant in this example).
|
||||||
|
|
||||||
.. autoclass:: BallJoint
|
.. autoclass:: BallJoint
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ The generic forms of object placement are:
|
||||||
location * alg_compound
|
location * alg_compound
|
||||||
|
|
||||||
2. Placement on the ``plane`` and then moved relative to the ``plane`` by ``location``
|
2. Placement on the ``plane`` and then moved relative to the ``plane`` by ``location``
|
||||||
(the location is relative to the local corrdinate system of the plane).
|
(the location is relative to the local coordinate system of the plane).
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -271,7 +271,7 @@ reoriented, all ``BuildLine`` instances within the scope of ``BuildSketch`` shou
|
||||||
on the default ``Plane.XY``.
|
on the default ``Plane.XY``.
|
||||||
|
|
||||||
***************************************************************
|
***************************************************************
|
||||||
Don't Builders inherit workplane/coordinate sytems when nested
|
Don't Builders inherit workplane/coordinate systems when nested
|
||||||
***************************************************************
|
***************************************************************
|
||||||
|
|
||||||
Some users expect that nested Builders will inherit the workplane or coordinate system from
|
Some users expect that nested Builders will inherit the workplane or coordinate system from
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ For solid or prismatic shapes, extrude the 2D profiles along the necessary axis.
|
||||||
also combine multiple extrusions by intersecting or unionizing them to form complex shapes.
|
also combine multiple extrusions by intersecting or unionizing them to form complex shapes.
|
||||||
Use the resulting geometry as sub-parts if needed.
|
Use the resulting geometry as sub-parts if needed.
|
||||||
|
|
||||||
*The next step in implmenting our design in build123d is to convert the above sketch into
|
*The next step in implementing our design in build123d is to convert the above sketch into
|
||||||
a part by extruding it as shown in this code:*
|
a part by extruding it as shown in this code:*
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class BuildSketch(Builder):
|
||||||
Note that all sketch construction is done within sketch_local on Plane.XY.
|
Note that all sketch construction is done within sketch_local on Plane.XY.
|
||||||
When objects are added to the sketch they must be coplanar to Plane.XY,
|
When objects are added to the sketch they must be coplanar to Plane.XY,
|
||||||
usually handled automatically but may need user input for Edges and Wires
|
usually handled automatically but may need user input for Edges and Wires
|
||||||
since their construction plane isn't alway able to be determined.
|
since their construction plane isn't always able to be determined.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
workplanes (Union[Face, Plane, Location], optional): objects converted to
|
workplanes (Union[Face, Plane, Location], optional): objects converted to
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ class Draft:
|
||||||
"""Convert a raw number to a unit of measurement string based on the class settings"""
|
"""Convert a raw number to a unit of measurement string based on the class settings"""
|
||||||
|
|
||||||
def simplify_fraction(numerator: int, denominator: int) -> tuple[int, int]:
|
def simplify_fraction(numerator: int, denominator: int) -> tuple[int, int]:
|
||||||
"""Mathematically simplify a fraction given a numerator and demoninator"""
|
"""Mathematically simplify a fraction given a numerator and denominator"""
|
||||||
greatest_common_demoninator = gcd(numerator, denominator)
|
greatest_common_demoninator = gcd(numerator, denominator)
|
||||||
return (
|
return (
|
||||||
int(numerator / greatest_common_demoninator),
|
int(numerator / greatest_common_demoninator),
|
||||||
|
|
|
||||||
|
|
@ -1135,7 +1135,7 @@ class Color:
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def __init__(self, color_code: int, alpha: int = 0xFF):
|
def __init__(self, color_code: int, alpha: int = 0xFF):
|
||||||
"""Color from a hexidecimal color code with an optional alpha value
|
"""Color from a hexadecimal color code with an optional alpha value
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
color_code (hexidecimal int): 0xRRGGBB
|
color_code (hexidecimal int): 0xRRGGBB
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ class Mesher:
|
||||||
return meta_data_contents
|
return meta_data_contents
|
||||||
|
|
||||||
def get_meta_data_by_key(self, name_space: str, name: str) -> dict:
|
def get_meta_data_by_key(self, name_space: str, name: str) -> dict:
|
||||||
"""Retrive the metadata value and type for the provided name space and name"""
|
"""Retrieve the metadata value and type for the provided name space and name"""
|
||||||
meta_data_group = self.model.GetMetaDataGroup()
|
meta_data_group = self.model.GetMetaDataGroup()
|
||||||
meta_data_contents = {}
|
meta_data_contents = {}
|
||||||
meta_data = meta_data_group.GetMetaDataByKey(name_space, name)
|
meta_data = meta_data_group.GetMetaDataByKey(name_space, name)
|
||||||
|
|
|
||||||
|
|
@ -997,7 +997,7 @@ class Mixin1D(Shape):
|
||||||
split_result = unwrap_topods_compound(split_result, True)
|
split_result = unwrap_topods_compound(split_result, True)
|
||||||
|
|
||||||
# For speed the user may just want all the objects which they
|
# For speed the user may just want all the objects which they
|
||||||
# can sort more efficiently then the generic algoritm below
|
# can sort more efficiently then the generic algorithm below
|
||||||
if keep == Keep.ALL:
|
if keep == Keep.ALL:
|
||||||
return ShapeList(
|
return ShapeList(
|
||||||
self.__class__.cast(part)
|
self.__class__.cast(part)
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class TestPack(unittest.TestCase):
|
||||||
test_boxes = [
|
test_boxes = [
|
||||||
Box(random.randint(1, 20), random.randint(1, 20), 1) for _ in range(50)
|
Box(random.randint(1, 20), random.randint(1, 20), 1) for _ in range(50)
|
||||||
]
|
]
|
||||||
# Not raising in this call shows successfull non-overlap.
|
# Not raising in this call shows successful non-overlap.
|
||||||
packed = pack(test_boxes, 1)
|
packed = pack(test_boxes, 1)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
"bbox: 0.0 <= x <= 94.0, 0.0 <= y <= 86.0, -0.5 <= z <= 0.5",
|
"bbox: 0.0 <= x <= 94.0, 0.0 <= y <= 86.0, -0.5 <= z <= 0.5",
|
||||||
|
|
@ -54,7 +54,7 @@ class TestPack(unittest.TestCase):
|
||||||
widths = [random.randint(2, 20) for _ in range(50)]
|
widths = [random.randint(2, 20) for _ in range(50)]
|
||||||
heights = [random.randint(1, width - 1) for width in widths]
|
heights = [random.randint(1, width - 1) for width in widths]
|
||||||
inputs = [SlotOverall(width, height) for width, height in zip(widths, heights)]
|
inputs = [SlotOverall(width, height) for width, height in zip(widths, heights)]
|
||||||
# Not raising in this call shows successfull non-overlap.
|
# Not raising in this call shows successful non-overlap.
|
||||||
packed = pack(inputs, 1)
|
packed = pack(inputs, 1)
|
||||||
bb = (Sketch() + packed).bounding_box()
|
bb = (Sketch() + packed).bounding_box()
|
||||||
self.assertEqual(bb.min, Vector(0, 0, 0))
|
self.assertEqual(bb.min, Vector(0, 0, 0))
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ date: Dec 05, 2024
|
||||||
|
|
||||||
desc:
|
desc:
|
||||||
This python script refactors the very large topology.py module into several
|
This python script refactors the very large topology.py module into several
|
||||||
files based on the topological heirarchical order:
|
files based on the topological hierarchical order:
|
||||||
+ shape_core.py - base classes Shape, ShapeList
|
+ shape_core.py - base classes Shape, ShapeList
|
||||||
+ utils.py - utility classes & functions
|
+ utils.py - utility classes & functions
|
||||||
+ zero_d.py - Vertex
|
+ zero_d.py - Vertex
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue