Replies: 1 comment
-
Good question. Does the following work for you? from build123d import *
from ocp_vscode import show_all, show
from bd_warehouse.fastener import SocketHeadCapScrew, ClearanceHole
m3 = SocketHeadCapScrew("M3-0.5", 20)
with BuildPart() as part1:
Box(60, 60, 20)
with Locations(part1.faces().sort_by(Axis.Z)[-1]):
with GridLocations(50, 50, 2, 2) as top_holes:
ClearanceHole(m3)
with BuildPart() as part2:
Box(200, 200, 200)
with Locations(part2.faces().sort_by(Axis.X)[-1]):
with Locations(*m3.hole_locations) as p2_holes:
h = ClearanceHole(m3, counter_sunk=False)
show(pack([part1.part, part2.part], 10))
print(p2_holes.locations) The |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there!
I wonder -- what is an idiomatic solution for propagating subtractions from one part into another?
As an example, consider modeling a 3D printed part that should be screwed onto a desk. The screws require pre-drilling, so the model of the desk needs to have holes. The location of the screws are dictated by the 3D printed part. The question is how to best propagate the location of the screws (which could depend on lengthy computations we want to hide to the outside) from the printed model into the desk model.
This is my primitive current solution:
This "works", but if
printed_part
is moved, one needs to movelocations
along manually.I wonder if there is a way to define a Compound that contains subtractions that are applied to other parts later. My crude idea was to define
followed by
Apart from dangerously mixing builder and algebra mode features, the problem with this approach is that
printed_part
contains the holes as added geometry, unless one removes them again from.children
before use.From my understanding, RigidJoints will not help here, since they only handle parts orientation, not parts geometry.
So, what would be a more idiomatic way of modeling such a scenario?
Beta Was this translation helpful? Give feedback.
All reactions