Reorganized for building pip package

This commit is contained in:
Roger Maitland 2022-07-14 11:10:54 -04:00
parent fe7f39bb7c
commit 3ba7793c9a
12 changed files with 17 additions and 114 deletions

14
README.md Normal file
View file

@ -0,0 +1,14 @@
Build123D is an alternate to the [CadQuery](https://cadquery.readthedocs.io/en/latest/index.html)
Fluent API. It has several advantages over this API but the largest one is that Build123D is more
Pythonic than CadQuery 2.x. making it easier to learn and more functional.
The documentation for **build123d** can found at [readthedocs](https://build123d.readthedocs.io/en/latest/index.html).
To install **build123d** from github:
```
python3 -m pip install git+https://github.com/gumyr/build123d.git#egg=build123d
```
To install the working `dev` branch:
```
python3 -m pip install git+https://github.com/gumyr/build123d.git@dev#egg=build123d
```

View file

@ -1,45 +0,0 @@
from cadquery import Vector
from build123d_common import *
from build_line import *
from build_sketch import *
with BuildSketch() as leaf:
with BuildLine() as outline:
l1 = Polyline((0.0000, 0.0771), (0.0187, 0.0771), (0.0094, 0.2569))
l2 = Polyline((0.0325, 0.2773), (0.2115, 0.2458), (0.1873, 0.3125))
RadiusArc(l1 @ 1, l2 @ 0, 0.0271)
l3 = Polyline((0.1915, 0.3277), (0.3875, 0.4865), (0.3433, 0.5071))
TangentArc(l2 @ 1, l3 @ 0, tangent=l2 % 1)
l4 = Polyline((0.3362, 0.5235), (0.375, 0.6427), (0.2621, 0.6188))
SagittaArc(l3 @ 1, l4 @ 0, 0.003)
l5 = Polyline((0.2469, 0.6267), (0.225, 0.6781), (0.1369, 0.5835))
ThreePointArc(l4 @ 1, (l4 @ 1 + l5 @ 0) * 0.5 + Vector(-0.002, -0.002), l5 @ 0)
l6 = Polyline((0.1138, 0.5954), (0.1562, 0.8146), (0.0881, 0.7752))
Spline(l5 @ 1, l6 @ 0, tangents=(l5 % 1, l6 % 0), tangent_scalars=(2, 2))
l7 = Line((0.0692, 0.7808), (0.0000, 0.9167))
TangentArc(l6 @ 1, l7 @ 0, tangent=l6 % 1)
MirrorToLine(*outline.edges(), axis=Axis.Y)
BuildFace(*leaf.pending_edges)
with BuildSketch() as west_field:
PushPointsToSketch((-1, 0))
Rectangle(0.5, 1, centered=(False, False))
with BuildSketch() as east_field:
MirrorToSketch(west_field.sketch, axis=Axis.Y)
with BuildSketch() as centre_field:
Rectangle(1, 1, centered=(True, False))
AddToSketch(leaf.sketch, mode=Mode.SUBTRACTION)
if "show_object" in locals():
show_object(
[west_field.sketch, east_field.sketch, leaf.sketch],
name="flag_red_parts",
options={"color": (255, 0, 0)},
)
show_object(
centre_field.sketch,
name="flag_white_part",
options={"color": (255, 255, 255)},
)

View file

@ -1,46 +0,0 @@
from build_part import *
from build_sketch import *
# 35x7.5mm DIN Rail Dimensions
overall_width, top_width, height, thickness, fillet = 35, 27, 7.5, 1, 0.8
rail_length = 1000
slot_width, slot_length, slot_pitch = 6.2, 15, 25
with BuildPart(workplane=Plane.named("XZ")) as rail:
with BuildSketch() as din:
Rectangle(overall_width, thickness, centered=(True, False))
Rectangle(top_width, height, centered=(True, False))
Rectangle(
top_width - 2 * thickness,
height - thickness,
centered=(True, False),
mode=Mode.SUBTRACTION,
)
inside_vertices = (
din.vertices()
.filter_by_position(Axis.Y, 0.0, height, inclusive=(False, False))
.filter_by_position(
Axis.X,
-overall_width / 2,
overall_width / 2,
inclusive=(False, False),
)
)
FilletSketch(*inside_vertices, radius=fillet)
outside_vertices = list(
filter(
lambda v: (v.Y == 0.0 or v.Y == height)
and -overall_width / 2 < v.X < overall_width / 2,
din.vertices(),
)
)
FilletSketch(*outside_vertices, radius=fillet + thickness)
Extrude(rail_length)
WorkplanesFromFaces(rail.faces().filter_by_normal(Axis.Z)[-1], replace=True)
with BuildSketch() as slots:
RectangularArrayToSketch(0, slot_pitch, 1, rail_length // slot_pitch - 1)
SlotOverall(slot_length, slot_width, rotation=90)
slot_holes = Extrude(-height, mode=Mode.SUBTRACTION)
if "show_object" in locals():
show_object(rail.part, name="rail")

View file

@ -1,5 +1,6 @@
from build_sketch import *
from build_part import *
from build123d import *
# from build_part import *
height, width, thickness, padding = 60, 80, 10, 12
screw_shaft_radius, screw_head_radius, screw_head_height = 1.5, 3, 3

View file

@ -1,21 +0,0 @@
from build_sketch import *
from build_part import *
height, width, thickness, padding = 60, 80, 10, 12
screw_shaft_radius, screw_head_radius, screw_head_height = 1.5, 3, 3
bearing_axle_radius, bearing_radius, bearing_thickness = 4, 11, 7
# Build pillow block as an extruded sketch with counter bore holes
with BuildPart() as pillow_block:
with BuildSketch() as plan:
Rectangle(width, height)
FilletSketch(*plan.vertices(), radius=5)
Extrude(thickness)
WorkplanesFromFaces(pillow_block.faces().filter_by_normal(Axis.Z)[-1])
CounterBoreHole(bearing_axle_radius, bearing_radius, bearing_thickness)
RectangularArrayToPart(width - 2 * padding, height - 2 * padding, 2, 2)
CounterBoreHole(screw_shaft_radius, screw_head_radius, screw_head_height)
# Render the part
if "show_object" in locals():
show_object(pillow_block.part)