update state
This commit is contained in:
parent
d678faa305
commit
e6e040fdf4
89
SyncGrips.py
Normal file
89
SyncGrips.py
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
#%%
|
||||||
|
from build123d import *
|
||||||
|
from ocp_vscode import *
|
||||||
|
|
||||||
|
|
||||||
|
import copy
|
||||||
|
set_defaults(reset_camera=Camera.KEEP, render_joints=True, helper_scale=8)
|
||||||
|
#%%
|
||||||
|
sensor_width = 35
|
||||||
|
r_sens = 6
|
||||||
|
wall_thickness = 3
|
||||||
|
t = 2.5 # sheet thickness
|
||||||
|
w1 = sensor_width + 2* wall_thickness #sensor casing
|
||||||
|
w2 = 150 #sensors center placed at corners of w2*w2 square
|
||||||
|
h = 85 # total height
|
||||||
|
h1 = 20 # sensor casing height
|
||||||
|
h2 = 12
|
||||||
|
h3 = 35# sensor casing + mpu height
|
||||||
|
r = 25 # grip radius
|
||||||
|
w3 = 20 # upper mount dx
|
||||||
|
r1 = 8 # bending radius
|
||||||
|
locs = ((0,h+10), (-10,h-10),(10,h-10)) #locations of screws
|
||||||
|
handle_len = w2+w1
|
||||||
|
l = w2/2+sensor_width+r1+5 # half of the length
|
||||||
|
|
||||||
|
#%%
|
||||||
|
with BuildPart() as part_builder:
|
||||||
|
with BuildSketch() as profile_sketch:
|
||||||
|
with BuildLine() as line_builder:
|
||||||
|
line = Polyline((-w3, h+r/2),(-w3, h-r),(-l, 0),\
|
||||||
|
(l,0),(w3,h-r), (w3,h+r/2), close=False)
|
||||||
|
line1 = fillet(radius=r1,objects=line.vertices())
|
||||||
|
w = offset(amount=t)
|
||||||
|
make_face()
|
||||||
|
extrude(amount=w1)
|
||||||
|
|
||||||
|
with BuildPart() as holes:
|
||||||
|
with BuildSketch(part_builder.faces().filter_by(Plane.YZ)[0]) as hole_sk:
|
||||||
|
dh = 10
|
||||||
|
dl = 5
|
||||||
|
with Locations((-dl,-dh),(dl,dh),(-dl,dh),(dl,-dh)):
|
||||||
|
Circle(2.05)
|
||||||
|
#SlotCenterToCenter(4,4, rotation=90)
|
||||||
|
extrude(amount=-50, both=True)
|
||||||
|
|
||||||
|
with BuildPart() as handle:
|
||||||
|
with BuildSketch(Plane.XY) as profile_sk:
|
||||||
|
with Locations((0,h)):
|
||||||
|
Circle(r)
|
||||||
|
extrude(amount=handle_len)
|
||||||
|
ch = r-w3+4
|
||||||
|
with Locations((w3+ch/2-t,h,w1/2), (-w3-ch/2+t,h,w1/2), (w3+ch/2-t,h,w2+w1/2), (-w3-ch/2+t,h,w2+w1/2)):
|
||||||
|
Box(ch, r*2, w1, mode=Mode.SUBTRACT)
|
||||||
|
add(holes, mode=Mode.SUBTRACT)
|
||||||
|
|
||||||
|
with BuildPart() as sensor_cutout:
|
||||||
|
with BuildSketch(Plane.XZ) as sensor_sk1:
|
||||||
|
d = 0
|
||||||
|
Rectangle(22,26)
|
||||||
|
|
||||||
|
sensor_space = extrude(amount=-14)
|
||||||
|
faces = (sensor_space.edges().group_by(Axis.Y)[-1] | Axis.Z)
|
||||||
|
#chamfer(objects=faces, length=6)
|
||||||
|
|
||||||
|
with BuildPart() as sensorhole:
|
||||||
|
with BuildSketch(Plane.XZ) as sensorhole_sk:
|
||||||
|
with Locations((-sensor_width/2,0)):
|
||||||
|
Circle(1.55)
|
||||||
|
extrude(amount=-14)
|
||||||
|
|
||||||
|
with BuildPart() as sensors:
|
||||||
|
dz = -5
|
||||||
|
ds = 4
|
||||||
|
with Locations((w2/2+ds,dz,w1/2), (w2/2+ds,dz,w2+w1/2)):
|
||||||
|
#Box(w1, 5, w1, mode=Mode.ADD)
|
||||||
|
add(sensor_cutout)
|
||||||
|
with Locations(((-w2/2-ds,dz,w1/2),(-w2/2-ds,dz,w2+w1/2))):
|
||||||
|
add(sensor_cutout.part.mirror(Plane.YZ))
|
||||||
|
|
||||||
|
upper_sheet = part_builder.part - holes.part - sensors.part
|
||||||
|
lower_sheet = Location((0,0,handle_len-w1))*upper_sheet
|
||||||
|
show(upper_sheet, lower_sheet,handle.part,reset_camera=False)
|
||||||
|
|
||||||
|
#%%
|
||||||
|
|
||||||
|
|
||||||
|
#%%
|
||||||
|
|
||||||
|
syncgrips = Compound(children=[sensor_cutout.part, sensor_cutout.part.mirror(Plane.YZ)])
|
||||||
39
dempf.py
Normal file
39
dempf.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#%%
|
||||||
|
from build123d import *
|
||||||
|
from ocp_vscode import *
|
||||||
|
|
||||||
|
|
||||||
|
import copy
|
||||||
|
set_defaults(reset_camera=Camera.KEEP, render_joints=True, helper_scale=8)
|
||||||
|
#%%
|
||||||
|
|
||||||
|
with BuildPart() as p:
|
||||||
|
with BuildSketch() as pipe:
|
||||||
|
Circle(20)
|
||||||
|
Circle(19, mode=Mode.SUBTRACT)
|
||||||
|
extrude(amount=20)
|
||||||
|
with BuildSketch() as s:
|
||||||
|
with PolarLocations(20,8):
|
||||||
|
Rectangle(5,2)
|
||||||
|
extrude(amount=2, mode=Mode.SUBTRACT)
|
||||||
|
|
||||||
|
show(p)
|
||||||
|
|
||||||
|
#%%
|
||||||
|
rf = 8
|
||||||
|
l = 70
|
||||||
|
with BuildPart() as handle:
|
||||||
|
with BuildSketch(Plane.XZ) as handle_sk:
|
||||||
|
RectangleRounded(l,90.10)
|
||||||
|
with BuildLine() as outline:
|
||||||
|
|
||||||
|
make_face()
|
||||||
|
with BuildSketch(Plane(j2 @ 0, z_dir=j2 % 0)) as x_section:
|
||||||
|
Circle(8)
|
||||||
|
sweep()
|
||||||
|
#illet(handle_sk.vertices().group_by(Axis.X)[0],radius=1)
|
||||||
|
|
||||||
|
show(handle_sk)
|
||||||
|
# %%
|
||||||
|
show(handle_sk.vertices().group_by(Axis.X)[0])
|
||||||
|
# %%
|
||||||
54
roller_coaster.py
Normal file
54
roller_coaster.py
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
#%%
|
||||||
|
from build123d import *
|
||||||
|
from ocp_vscode import show
|
||||||
|
import numpy as np
|
||||||
|
#%%
|
||||||
|
with BuildLine() as roller_coaster:
|
||||||
|
powerup = Spline(
|
||||||
|
(0, 0, 0),
|
||||||
|
(50, 0, 50),
|
||||||
|
(100, 0, 0),
|
||||||
|
tangents=((1, 0, 0), (1, 0, 0)),
|
||||||
|
tangent_scalars=(0.5, 2),
|
||||||
|
)
|
||||||
|
corner = RadiusArc(powerup @ 1, (100, 60, 0), -30)
|
||||||
|
screw = Helix(75, 150, 15, center=(75, 40, 15), direction=(-1, 0, 0), mode=Mode.PRIVATE)
|
||||||
|
Spline(corner @ 1, screw @ 0, tangents=(corner % 1, screw % 0))
|
||||||
|
add(screw)
|
||||||
|
Spline(screw @ 1, (-100, 30, 10), powerup @ 0, tangents=(screw % 1, powerup % 0))
|
||||||
|
show(roller_coaster)
|
||||||
|
|
||||||
|
# %%
|
||||||
|
with BuildPart() as coaster:
|
||||||
|
thepath = powerup
|
||||||
|
n = int(thepath.length/4)
|
||||||
|
r0 = 90
|
||||||
|
r1 = 45
|
||||||
|
d = 2
|
||||||
|
d1 = 0.4
|
||||||
|
locs_l = ((-d/2.,0))
|
||||||
|
locs_r = ((d/2.,0))
|
||||||
|
p1 = Plane(thepath @ 0, z_dir=thepath % 0).rotated((r0,0,0))
|
||||||
|
p2 = Plane(thepath @ 1, z_dir=thepath % 1).rotated((r1,0,0))
|
||||||
|
with BuildSketch(p1) as sk:
|
||||||
|
with Locations(locs_l):
|
||||||
|
sl = Circle(d1)
|
||||||
|
with BuildSketch(p1) as sk1:
|
||||||
|
with Locations(locs_r):
|
||||||
|
sr = Circle(d1)
|
||||||
|
with BuildSketch(p2) as sk2:
|
||||||
|
with Locations(locs_l):
|
||||||
|
el = Circle(d1)
|
||||||
|
with BuildSketch(p2) as sk3:
|
||||||
|
with Locations(locs_r):
|
||||||
|
er = Circle(d1)
|
||||||
|
sweep(sections=[sk.sketch,sk2.sketch], multisection=True, path=thepath)
|
||||||
|
sweep(sections=[sk1.sketch,sk3.sketch], multisection=True, path=thepath)
|
||||||
|
for r, t in zip(np.linspace(r0,r1,n),np.linspace(0,1,n)):
|
||||||
|
with Locations((thepath.location_at(t))):
|
||||||
|
Box(d,0.2,0.3,rotation=(0,0,r))
|
||||||
|
|
||||||
|
show(coaster)
|
||||||
|
|
||||||
|
# %%
|
||||||
Loading…
Reference in New Issue
Block a user