Updated examples

This commit is contained in:
Roger Maitland 2022-07-25 10:33:50 -04:00
parent 2bbf418859
commit b3383f2327
10 changed files with 24 additions and 41 deletions

View file

@ -26,9 +26,7 @@ license:
limitations under the License.
"""
from cadquery import Vector
from build123d.build123d_common import *
from build123d.build_sketch import *
from build123d.build_line import *
from build123d import *
with BuildSketch() as leaf:
with BuildLine() as outline:
@ -45,19 +43,19 @@ with BuildSketch() as leaf:
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)
Mirror(*outline.edges(), axis=Axis.Y)
BuildFace(*leaf.pending_edges)
with BuildSketch() as west_field:
PushPointsToSketch((-1, 0))
PushPoints((-1, 0))
Rectangle(0.5, 1, centered=(False, False))
with BuildSketch() as east_field:
MirrorToSketch(west_field.sketch, axis=Axis.Y)
Mirror(west_field.sketch, axis=Axis.Y)
with BuildSketch() as centre_field:
Rectangle(1, 1, centered=(True, False))
AddToSketch(leaf.sketch, mode=Mode.SUBTRACT)
Add(leaf.sketch, mode=Mode.SUBTRACT)
if "show_object" in locals():
show_object(

View file

@ -24,10 +24,7 @@ license:
See the License for the specific language governing permissions and
limitations under the License.
"""
from cadquery import Vector
from build123d.build123d_common import *
from build123d.build_line import *
from build123d.build_sketch import *
from build123d import *
clock_radius = 10
with BuildSketch() as minute_indicator:
@ -41,12 +38,12 @@ with BuildSketch() as minute_indicator:
with BuildSketch() as clock_face:
Circle(clock_radius)
PolarArrayToSketch(0, 0, 360, 60)
AddToSketch(minute_indicator.sketch, mode=Mode.SUBTRACT)
PolarArrayToSketch(clock_radius * 0.875, 0, 360, 12)
PolarArray(0, 0, 360, 60)
Add(minute_indicator.sketch, mode=Mode.SUBTRACT)
PolarArray(clock_radius * 0.875, 0, 360, 12)
SlotOverall(clock_radius * 0.05, clock_radius * 0.025, mode=Mode.SUBTRACT)
for hour in range(1, 13):
PolarArrayToSketch(clock_radius * 0.75, -hour * 30 + 90, 360, 1, rotate=False)
PolarArray(clock_radius * 0.75, -hour * 30 + 90, 360, 1, rotate=False)
Text(
str(hour),
fontsize=clock_radius * 0.175,

View file

@ -26,9 +26,8 @@ license:
See the License for the specific language governing permissions and
limitations under the License.
"""
from build123d.build123d_common import *
from build123d.build_sketch import *
from build123d.build_part import *
from cadquery import Plane
from build123d import *
# 35x7.5mm DIN Rail Dimensions
overall_width, top_width, height, thickness, fillet = 35, 27, 7.5, 1, 0.8
@ -67,7 +66,7 @@ with BuildPart(workplane=Plane.named("XZ")) as rail:
Extrude(rail_length)
WorkplanesFromFaces(rail.faces().filter_by_axis(Axis.Z)[-1], replace=True)
with BuildSketch() as slots:
RectangularArrayToSketch(0, slot_pitch, 1, rail_length // slot_pitch - 1)
RectangularArray(0, slot_pitch, 1, rail_length // slot_pitch - 1)
SlotOverall(slot_length, slot_width, rotation=90)
slot_holes = Extrude(-height, mode=Mode.SUBTRACT)

View file

@ -25,9 +25,7 @@ license:
See the License for the specific language governing permissions and
limitations under the License.
"""
from build123d.build123d_common import *
from build123d.build_sketch import *
from build123d.build_part import *
from build123d import *
with BuildPart() as pipes:
Box(10, 10, 10, rotation=(10, 20, 30))

View file

@ -25,9 +25,9 @@ license:
See the License for the specific language governing permissions and
limitations under the License.
"""
from build123d.build123d_common import *
from build123d.build_sketch import *
from build123d.build_part import *
from math import pi, sin
from cadquery import Plane
from build123d import *
with BuildPart() as art:
slice_count = 10

View file

@ -1,5 +1,4 @@
from build123d.build123d_common import *
from build123d.build_part import *
from build123d import *
with BuildPart() as obj:
Box(5, 5, 1)
@ -8,4 +7,3 @@ with BuildPart() as obj:
if "show_object" in locals():
show_object(obj.part)

View file

@ -25,9 +25,7 @@ license:
See the License for the specific language governing permissions and
limitations under the License.
"""
from build123d.build123d_common import *
from build123d.build_sketch import *
from build123d.build_part import *
from build123d import *
height, width, thickness, padding = 60, 80, 10, 12
screw_shaft_radius, screw_head_radius, screw_head_height = 1.5, 3, 3
@ -41,7 +39,7 @@ with BuildPart() as pillow_block:
Extrude(thickness)
WorkplanesFromFaces(pillow_block.faces().filter_by_axis(Axis.Z)[-1])
CounterBoreHole(bearing_axle_radius, bearing_radius, bearing_thickness)
RectangularArrayToPart(width - 2 * padding, height - 2 * padding, 2, 2)
RectangularArray(width - 2 * padding, height - 2 * padding, 2, 2)
CounterBoreHole(screw_shaft_radius, screw_head_radius, screw_head_height)
# Render the part

View file

@ -25,8 +25,7 @@ license:
See the License for the specific language governing permissions and
limitations under the License.
"""
from build123d.build123d_common import *
from build123d.build_line import *
from build123d import *
with BuildLine() as roller_coaster:
powerup = Spline(
@ -43,4 +42,3 @@ with BuildLine() as roller_coaster:
if "show_object" in locals():
show_object(roller_coaster.line, name="roller_coaster")

View file

@ -26,10 +26,7 @@ license:
limitations under the License.
"""
from cadquery import Vector
from build123d.build123d_common import *
from build123d.build_line import *
from build123d.build_sketch import *
from build123d.build_part import *
from build123d import *
with BuildPart() as vase:
with BuildSketch() as profile:

View file

@ -3,7 +3,7 @@ from build123d.build_common import *
from build123d.build_line import BuildLine
from build123d.build_sketch import BuildSketch
from build123d.build_part import BuildPart
from cadquery import Shape, Vertex
from cadquery import Shape, Vertex, Plane
from cadquery.occ_impl.shapes import VectorLike
@ -301,7 +301,7 @@ class Mirror(Compound):
current_context = Builder._get_context()
if isinstance(current_context, BuildLine):
current_context._add_to_context(*mirrored_edges, mode=mode)
elif isinstance(current_context, BuildLine):
elif isinstance(current_context, BuildSketch):
current_context._add_to_context(*mirrored_edges, mode=mode)
current_context._add_to_context(*mirrored_faces, mode=mode)
else: