Gallery#
Interactive USD BRep models, converted to meshes for the browser. Drag to rotate, scroll to zoom, right-drag to pan. Hover a face or an edge to inspect it: faces report their surface type and exact area, edges their length.
Built with the Python API#
Each model is the output of the code under it.
CSG: intersect, then subtract#
import usd_brep as sm
box = sm.create_box((-5, -5, -5), 10, 10, 10)
body = sm.boolean_intersection(box, sm.create_sphere((0, 0, 0), 6.5))
# Unequal radii, so the holes never meet tangentially.
for axis, radius in [(None, 3), ((1, 0, 0), 2.5), ((0, 1, 0), 2)]:
hole = sm.create_cylinder((0, 0, -8), radius, 16)
if axis:
sm.rotate(hole, (0, 0, 0), axis, 90)
body = sm.boolean_difference(body, hole)
model = body
Plate with holes: boolean difference#
import usd_brep as sm
plate = sm.create_box((0, 0, 0), 40, 24, 4)
for x, y in [(5, 5), (35, 5), (5, 19), (35, 19)]:
hole = sm.create_cylinder((x, y, -1), 1.6, 6)
plate = sm.boolean_difference(plate, hole)
bore = sm.create_cylinder((20, 12, -1), 6, 6)
model = sm.boolean_difference(plate, bore)
Bracket: union, then fillet the inside edge#
import usd_brep as sm
base = sm.create_box((0, 0, 0), 20, 12, 3)
wall = sm.create_box((0, 0, 0), 3, 12, 16)
bracket = sm.boolean_union(base, wall)
def inside_corner(edge): # runs along y at x = z = 3
(x0, _, z0), (x1, _, z1) = edge.bounding_box(tight=True)
return max(abs(v - 3) for v in (x0, z0, x1, z1)) < 1e-6
edges = [e for e in bracket.edges() if inside_corner(e)]
sm.fillet_edges(bracket, edges, radius=2.0)
model = bracket
Rounded box: fillet every edge#
import usd_brep as sm
model = sm.create_box((0, 0, 0), 20, 12, 8)
sm.circular_fillet(model, 2.0)
Tray: shell a box, removing the top face#
import usd_brep as sm
box = sm.create_box((0, 0, 0), 20, 14, 8)
top = next(f for f in box.faces()
if f.bounding_box(tight=True)[0][2] == 8)
model = sm.shell_brep(box, -1.0, create_solid=True,
faces_to_shell=[top])
Pulley: revolve a closed profile#
import usd_brep as sm
# Closed (radius, height) profile with a V groove, in the xz plane.
rz = [(2, 0), (10, 0), (10, 3), (8.5, 4), (10, 5), (10, 8), (2, 8),
(2, 0)]
profile = [sm.create_line_segment((r0, 0, z0), (r1, 0, z1))
for (r0, z0), (r1, z1) in zip(rz, rz[1:])]
model = sm.rotational_sweep(profile, (0, 0, 0), (0, 0, 1), 360,
cap_ends=True)
Spring: pipe sweep along a helix#
import usd_brep as sm
helix = sm.create_helix((0, 0, 0), height=10, radius_start=2,
radius_end=2, turns=5)
model = sm.pipe_sweep(helix, radius=0.3)
Test parts#
Parts from the repository’s test data, TestFiles/pt_TestFiles.
Defeature/LShape_II.smb · 25 faces
Defeature/Platte.smb · 122 faces
Defeature/defillet.smb · 9 faces
Defeature/extrusion.smb · 11 faces
Fillet/box_diff_3cyls.smb · 13 faces
Fillet/box_w_slot.smb · 27 faces
Fillet/cliff_1.smb · 43 faces
Fillet/crown.smb · 13 faces
Fillet/cyl_on_box_w_tan_hole2.smb · 13 faces
Fillet/rollover_corner.smb · 8 faces
Solids/boolean_trees_result.smb · 15 faces
Solids/extrusion2.smb · 26 faces
Solids/offset_bracket2.smb · 59 faces
Solids/revolution_360.smb · 29 faces
Solids/revolution_mold.smb · 33 faces