please design for me a 3d printable phone stand that can amplify my phine speaker when docked on the phone stand my phone is oppo reno 10 plus pro, please design in rhino python code, i use rhino 5
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Okay, let's design a basic 3D-printable phone stand with a passive acoustic amplification chamber for your Oppo Reno 10 Pro Plus using Rhino 5's Python scripting.
This script will create a solid model with a slot for the phone, a channel leading from the approximate speaker location to an expanding chamber, and a cutout for the charging cable.
Assumptions:
Speaker Location: The main speaker is on the bottom edge of the phone. This is typical for many smartphones.
Amplification: Passive acoustic amplification using a shaped chamber/horn. This redirects and can slightly enhance the sound but won't replace electronic amplification. Performance depends heavily on shape and size, which can be tuned by modifying the parameters in the script.
Rhino 5: Using rhinoscriptsyntax which is compatible with Rhino 5.
Orientation: Designed for the phone in portrait orientation while docked for charging/amplification.
Dimensions: Based on publicly available dimensions for the Oppo Reno 10 Pro Plus (approx. 163 x 75 x 8.5 mm), adding some tolerance.
How to Use:
Open Rhino 5.
Go to Tools > PythonScript > Edit...
Copy and paste the entire code below into the editor.
Save the script (e.g., oppo_stand.py).
Go to Tools > PythonScript > Run... and select the saved script file.
The script will generate the geometry in the current Rhino model.
Review the generated model. You may need to adjust the parameters at the beginning of the script (e.g., slot_thickness, chamber_length, chamber_exit_width) and re-run to optimize the fit and potential amplification.
Once satisfied, export the final object(s) as an STL file for 3D printing (File > Export Selected... or File > Save As... and choose Stereolithography STL). Ensure the mesh export settings are suitable for your printer (binary, appropriate tolerance).
python
import rhinoscriptsyntax as rs
import math
def create_amplifying_phone_stand():
"""
Creates a 3D printable phone stand with an acoustic amplification chamber.
Designed for a phone with a bottom speaker.
"""
# --- Parameters (Modify these values to customize the stand) ---
# Phone Dimensions (Approximate for Oppo Reno 10 Pro Plus 5G)
# Used to guide slot size and overall proportions.
phone_thickness = 8.5 # mm
phone_width = 75.0 # mm
phone_height = 163.0 # mm (less important for the stand itself, but influences back support height)
# Slot Dimensions (Should be slightly larger than phone dimensions)
slot_thickness = phone_thickness + 1.5 # Add tolerance, e.g., 10mm total
slot_width = phone_width + 5.0 # Add tolerance, e.g., 80mm total
slot_depth = 25.0 # How deep the phone sits in the slot
# Stand Dimensions
wall_thickness = 2.0 # Minimum wall thickness for 3D printing
base_height = 5.0 # Thickness of the solid base floor
back_support_height = 80.0 # Height of the wall supporting the phone
back_support_thickness = wall_thickness # Thickness of the back support wall
# Amplification Chamber Dimensions
# Speaker channel is assumed to be centered under the slot
speaker_channel_width = 40.0 # Approximate width of the speaker area on the phone
speaker_channel_height = wall_thickness * 2.0 # Height of the initial channel from slot bottom
chamber_length = 50.0 # Length of the expanding chamber
chamber_exit_width = slot_width - wall_thickness*2 # Width of the expanded exit (can be wider than slot)
chamber_exit_height = 30.0 # Height of the expanded exit
# Charging Port Cutout
charging_port_width = 15.0 # Width of the cable opening
charging_port_height = base_height + 10.0 # Height of the opening (goes through base)
# Fillet Radius (for rounding edges)
fillet_radius = 3.0 # Radius for exterior fillets
# --- Script Starts Here ---
print("Creating amplifying phone stand...")
# Use the current construction plane
cplane = rs.ViewCPlane()
# 1. Create the main base block
# Base width needs to accommodate the slot width + side walls
base_width = slot_width + wall_thickness * 2.0
# Base length needs to accommodate slot depth + chamber length + back support thickness
base_length = slot_depth + chamber_length + back_support_thickness
base_plane = rs.WorldXYplane() # Start at origin for simplicity, will transform later
base_rect = rs.AddRectangle(base_plane, base_length, base_width)
if not base_rect: return print("Error creating base rectangle.")
# Extrude upwards by base_height to form the solid base floor part initially
# We'll add walls later
base_body = rs.ExtrudeSurface(base_rect, [0, 0, base_height])
rs.DeleteObject(base_rect)
if not base_body: return print("Error extruding base body.")
# 2. Create the back support
back_support_plane = rs.WorldXYplane()
# Position the back support rectangle at the back edge of the base block
back_support_center_y = 0 # Centered on Y axis
back_support_back_edge_x = base_length / 2.0 # Back edge of the base block
back_support_center_x = back_support_back_edge_x - back_support_thickness / 2.0 # Position center
back_support_plane = rs.MovePlane(base_plane, [back_support_center_x, back_support_center_y, 0])
# The rectangle is added centered by default in AddRectangle based on plane origin
back_support_rect = rs.AddRectangle(back_support_plane, back_support_thickness, base_width)
if not back_support_rect:
rs.DeleteObject(base_body)
return print("Error creating back support rectangle.")
# Extrude back support upwards from the base top
back_support_extrusion_vec = [0, 0, back_support_height]
# Need to move the base plane origin UP to the top of the base_body
back_support_extrude_plane = rs.MovePlane(back_support_plane, [0, 0, base_height])
back_support_body = rs.ExtrudeSurface(back_support_rect, back_support_extrusion_vec, back_support_extrude_plane)
rs.DeleteObject(back_support_rect)
if not back_support_body:
rs.DeleteObjects([base_body])
return print("Error extruding back support body.")
# Union base and back support
stand_body = rs.BooleanUnion([base_body, back_support_body])
rs.DeleteObjects([base_body, back_support_body])
if not stand_body or len(stand_body) != 1: # BooleanUnion returns a list
if stand_body: rs.DeleteObjects(stand_body) # Clean up if it returned multiple objects
return print("Error unioning base and back support.")
stand_body = stand_body[0] # Get the single resulting object
# 3. Create the phone slot cutout (negative volume)
slot_plane = rs.WorldXYplane()
# Position the slot cutout rectangle at the front of the base block
slot_front_edge_x = -base_length / 2.0 # Front edge of the base block
slot_center_x = slot_front_edge_x + slot_depth / 2.0 # Position center
slot_center_y = 0 # Centered on Y axis
slot_plane = rs.MovePlane(base_plane, [slot_center_x, slot_center_y, base_height]) # Start cutout from top of base
slot_rect = rs.AddRectangle(slot_plane, slot_depth, slot_width)
if not slot_rect:
rs.DeleteObject(stand_body)
return print("Error creating slot rectangle.")
# Extrude the slot rectangle downwards, deeper than the phone thickness needs to sit
# Extrude downwards from the base_height level
slot_extrusion_depth = slot_depth # Extrude down by the slot depth itself, goes through the base_height
slot_extrusion_vec = [0, 0, -slot_extrusion_depth]
slot_cutout = rs.ExtrudeSurface(slot_rect, slot_extrusion_vec, slot_plane)
rs.DeleteObject(slot_rect)
if not slot_cutout:
rs.DeleteObject(stand_body)
return print("Error extruding slot cutout.")
# Boolean difference the slot cutout from the main body
stand_body = rs.BooleanDifference(stand_body, slot_cutout)
rs.DeleteObject(slot_cutout)
if not stand_body or len(stand_body) != 1:
if stand_body: rs.DeleteObjects(stand_body)
return print("Error differencing slot cutout.")
stand_body = stand_body[0]
# 4. Create the acoustic amplification chamber cutout (negative volume)
# This chamber starts at the bottom of the phone slot and expands forward and down.
# Define points for the inner speaker channel opening (at the bottom of the slot cutout)
# Calculate the Z level for the bottom of the slot relative to WorldXY plane (Z=0)
slot_bottom_z = base_height - slot_extrusion_depth # This is a negative value if base_height < slot_extrusion_depth
# The speaker is at the back of the slot cutout, centered on Y, near the bottom Z level
# The speaker channel will be a rectangle at this position.
speaker_channel_center_x = slot_front_edge_x + slot_depth - wall_thickness # Just inside the back wall of the slot
speaker_channel_center_y = 0
speaker_channel_bottom_z = slot_bottom_z + wall_thickness # Just above the chamber base
speaker_channel_half_width = speaker_channel_width / 2.0
speaker_channel_half_height = speaker_channel_height / 2.0 # Note: This height is in the Z direction here
# Points for the inner opening (rectangle) at the start of the chamber
p1 = [speaker_channel_center_x, speaker_channel_center_y - speaker_channel_half_width, speaker_channel_bottom_z + speaker_channel_half_height]
p2 = [speaker_channel_center_x, speaker_channel_center_y + speaker_channel_half_width, speaker_channel_bottom_z + speaker_channel_half_height]
p3 = [speaker_channel_center_x, speaker_channel_center_y + speaker_channel_half_width, speaker_channel_bottom_z - speaker_channel_half_height]
p4 = [speaker_channel_center_x, speaker_channel_center_y - speaker_channel_half_width, speaker_channel_bottom_z - speaker_channel_half_height]
start_points = [p1, p2, p3, p4]
# Define points for the inner expanded exit opening (at the front of the stand base)
# This rectangle is lower and wider/taller
chamber_exit_center_x = -base_length / 2.0 + chamber_length # Positioned chamber_length from the front edge
chamber_exit_center_y = 0
chamber_exit_bottom_z = 0 # Positioned at the WorldXY plane (bottom of the stand)
chamber_exit_half_width = chamber_exit_width / 2.0
chamber_exit_half_height = chamber_exit_height / 2.0
p5 = [chamber_exit_center_x, chamber_exit_center_y - chamber_exit_half_width, chamber_exit_bottom_z + chamber_exit_half_height]
p6 = [chamber_exit_center_x, chamber_exit_center_y + chamber_exit_half_width, chamber_exit_bottom_z + chamber_exit_half_height]
p7 = [chamber_exit_center_x, chamber_exit_center_y + chamber_exit_half_width, chamber_exit_bottom_z - chamber_exit_half_height]
p8 = [chamber_exit_center_x, chamber_exit_center_y - chamber_exit_half_width, chamber_exit_bottom_z - chamber_exit_half_height]
end_points = [p5, p6, p7, p8]
# Create surfaces to define the inner chamber volume
# Start face
start_srf = rs.AddSrfPt(start_points)
if not start_srf:
rs.DeleteObject(stand_body)
return print("Error creating chamber start surface.")
# End face
end_srf = rs.AddSrfPt(end_points)
if not end_srf:
rs.DeleteObjects([stand_body, start_srf])
return print("Error creating chamber end surface.")
# Ruled surfaces connecting the two rectangles
# Get boundary curves
start_edges = rs.DuplicateSurfaceBorder(start_srf)
end_edges = rs.DuplicateSurfaceBorder(end_srf)
# Join edges to get single polylines/curves for lofting or ruling
# Make sure curves are in the correct direction and order
start_curve = rs.JoinCurves(start_edges, True)[0] # Join and keep orientation consistent
end_curve = rs.JoinCurves(end_edges, True)[0]
# Try lofting the two curves to create the side surfaces
# Using 'Straight' style often works best for simple transitions
chamber_sides = rs.AddLoftSrf([start_curve, end_curve], style=1) # style=1 is Straight
rs.DeleteObjects([start_curve, end_curve]) # Delete boundary curves
if not chamber_sides:
rs.DeleteObjects([stand_body, start_srf, end_srf])
return print("Error lofting chamber sides.")
# Join all surfaces
chamber_surfaces = [start_srf, end_srf] + chamber_sides
joined_chamber_srf = rs.JoinSurfaces(chamber_surfaces, True)
rs.DeleteObjects(chamber_surfaces) # Delete individual surfaces
if not joined_chamber_srf or len(joined_chamber_srf) != 1:
rs.DeleteObject(stand_body)
if joined_chamber_srf: rs.DeleteObjects(joined_chamber_srf)
return print("Error joining chamber surfaces.")
joined_chamber_srf = joined_chamber_srf[0]
# Attempt to cap the joined surfaces to form a solid
chamber_cutout_solid = rs.CreateSolid(joined_chamber_srf)
rs.DeleteObject(joined_chamber_srf) # Delete the joined surface
if not chamber_cutout_solid:
rs.DeleteObject(stand_body)
# Fallback: Try CapPlanarHoles if CreateSolid fails (less reliable but might work for simple shapes)
# chamber_cutout_solid = rs.CapPlanarHoles(joined_chamber_srf)
# if not chamber_cutout_solid:
return print("Error creating chamber solid. Check geometry boundaries.")
# Boolean difference the chamber solid from the main body
stand_body = rs.BooleanDifference(stand_body, chamber_cutout_solid)
rs.DeleteObject(chamber_cutout_solid)
if not stand_body or len(stand_body) != 1:
if stand_body: rs.DeleteObjects(stand_body)
return print("Error differencing chamber cutout.")
stand_body = stand_body[0]
# 5. Create the charging port cutout (negative volume)
charging_port_plane = rs.WorldXYplane()
# Position the charging port rectangle at the bottom center of the slot
charging_port_center_x = slot_front_edge_x + slot_depth / 2.0
charging_port_center_y = 0
# The cutout should go downwards from just above the base floor
charging_port_bottom_z = 0 # Start from the bottom of the stand (WorldXY)
charging_port_top_z = base_height # Go up to the top of the base floor
# AddBox is easier here - define corners
box_base_corner1 = [charging_port_center_x - charging_port_width / 2.0, charging_port_center_y - base_width / 2.0, charging_port_bottom_z]
box_base_corner2 = [charging_port_center_x + charging_port_width / 2.0, charging_port_center_y + base_width / 2.0, charging_port_bottom_z]
box_height = charging_port_top_z + 1.0 # Go slightly above base_height to ensure full cut
charging_port_cutout = rs.AddBox([box_base_corner1, box_base_corner2, [0,0,box_height]]) # AddBox uses diagonal base points and height vector/z value
if not charging_port_cutout:
rs.DeleteObject(stand_body)
return print("Error creating charging port cutout box.")
# Boolean difference the charging port cutout
stand_body = rs.BooleanDifference(stand_body, charging_port_cutout)
rs.DeleteObject(charging_port_cutout)
if not stand_body or len(stand_body) != 1:
if stand_body: rs.DeleteObjects(stand_body)
return print("Error differencing charging port cutout.")
stand_body = stand_body[0]
# 6. Add fillets to key edges (optional but nice for printing and looks)
# Getting specific edges by index after booleans can be tricky.
# Let's try filleting common edges like base corners and top edges.
# Need to get edge geometry from the final stand_body object.
filleted_object = None
# Attempt to fillet the bottom perimeter edges of the base
base_bottom_edges = rs.DuplicateSurfaceBorder(rs.GetObjectEdges(stand_body, select=False)[0]) # Get bottom face and its edges
if base_bottom_edges:
# Filter edges that are likely the outer perimeter
# This is heuristic and might not always work perfectly
outer_perimeter_edges = []
bbox = rs.BoundingBox(stand_body)
if bbox:
min_z = bbox[0].Z # Minimum Z coordinate of the object
# Edges near the minimum Z are likely base edges
for edge_id in base_bottom_edges:
edge_points = rs.CurvePoints(edge_id)
if edge_points and all(pt.Z < min_z + 0.1 for pt in edge_points): # Check if points are near bottom Z
outer_perimeter_edges.append(edge_id)
if outer_perimeter_edges:
# BooleanFilletEdge requires edges selected by the command or picked.
# In scripting, you provide the solid and the edge *indices*.
# Getting edge indices reliably after complex booleans is hard.
# A simpler scripting approach is often to use AddFilletEdge on a copy
# and replace, or just skip the fillets in script if they are complex.
# Let's try the AddFilletEdge approach which works on IDs, but might fail on complex edges.
print("Attempting to fillet base edges...")
# Need to get the edge IDs of the *solid*, not just the duplicated curves
all_edges = rs.GetObjectEdges(stand_body, select=False) # Get all edges of the solid
edges_to_fillet = []
# This part is complex in scripting - finding the specific edges by geometry.
# A common workaround is to select interactively or fillet simple shapes before unioning.
# For this script, let's add fillets to the most likely candidates by bounding box/location.
# Finding the 4 bottom outer edges: they are horizontal and at the min Z.
if all_edges:
min_z = bbox[0].Z
for edge_id in all_edges:
# Check if edge is relatively straight and near the bottom Z
points = rs.CurvePoints(edge_id)
if points and len(points) > 1:
start_pt = points[0]
end_pt = points[-1]
if abs(start_pt.Z - min_z) < 0.1 and abs(end_pt.Z - min_z) < 0.1:
# Check if it's one of the long or short outer edges
dist = rs.Distance(start_pt, end_pt)
if abs(dist - base_length) < 1.0 or abs(dist - base_width) < 1.0 or abs(dist - 0) < 1.0: # Include corners (distance 0)
# This is still a heuristic. It might select wrong edges or miss some.
# A more robust way needs iteration and geometric comparison.
# For simplicity, let's try filleting *all* edges first and see what happens (might fail or look bad).
# Or, try filleting just a few known good edges, like the top corners of the back support.
# Let's try filleting the top outer edges of the back support wall
max_z = bbox[1].Z
if abs(start_pt.Z - max_z) < 0.1 and abs(end_pt.Z - max_z) < 0.1:
edges_to_fillet.append(edge_id) # Top horizontal edges
# Also try the 4 vertical edges of the back support
if abs(start_pt.X - end_pt.X) < 0.1 and abs(start_pt.Y - end_pt.Y) < 0.1 and abs(start_pt.Z - end_pt.Z) > 1.0:
# Check if vertical edge is on the back support
if start_pt.X > (slot_front_edge_x + slot_depth) - wall_thickness*2: # crude check for back support region
edges_to_fillet.append(edge_id)
if edges_to_fillet:
# Fillet multiple edges at once
filleted_object = rs.AddFilletEdge(stand_body, edges_to_fillet, fillet_radius)
if filleted_object:
rs.DeleteObject(stand_body)
stand_body = filleted_object
print(f"Successfully filleted {len(edges_to_fillet)} edges.")
else:
print("Filleting failed on selected edges. Skipping fillets.")
# Revert to the original object if filleting failed
# (stand_body is already the original if filleted_object is None)
if not rs.IsObjectSolid(stand_body):
print("Warning: Final object is not a closed solid. It might not be 3D printable as is.")
else:
print("Stand created successfully as a closed solid.")
# Select the final object
rs.SelectObject(stand_body)
# Transform to CPlane (optional, script built on WorldXY)
# if cplane:
# rs.XformObject(stand_body, rs.XformChangeIdentity(cplane))
print("Script finished.")
print(f"Final object ID: {stand_body}")
# This ensures the function is called only when the script is executed directly
if __name__ == "__main__":
# Check if Rhino is running and rhinoscriptsyntax is available
if rs.Document is None:
print("Error: This script must be run within Rhino.")
else:
create_amplifying_phone_stand()
Explanation of the Code:
Parameters: Defines variables at the top for all key dimensions (phone size, slot size, stand size, chamber size, wall thickness, etc.). You can easily modify these.
Base Block: Creates the initial solid rectangular block that forms the main body of the stand floor and the base for the back support.
Back Support: Creates a block behind the slot and unions it with the base block to form the L-shaped structure.
Phone Slot Cutout: Creates a negative volume (a box representing the space the phone occupies) and subtracts it from the main stand body using rs.BooleanDifference. This forms the U-shaped slot.
Amplification Chamber Cutout:
This is the most complex part. It defines the inner air space of the chamber as a solid volume.
It defines two rectangles using points: a smaller one positioned at the bottom of the phone slot (representing the speaker outlet) and a larger one positioned lower and towards the front (the expanded exit).
It creates surfaces (rs.AddSrfPt for start/end, rs.AddLoftSrf for sides) between these two rectangles.
It joins these surfaces and attempts to create a closed solid from them using rs.CreateSolid. This solid represents the volume of air inside the chamber.
It subtracts this air volume solid from the main stand body using rs.BooleanDifference, leaving the hollow chamber walls.
Charging Port Cutout: Creates a simple box representing the space for the charging cable and subtracts it from the bottom of the stand body.
Fillets (Optional): Attempts to round off some edges (rs.AddFilletEdge) for better aesthetics and printability. Note that programmatically selecting the correct edges after complex boolean operations can be tricky in rhinoscriptsyntax. The current implementation tries to select edges based on their location (e.g., near the bottom or top of the bounding box), but this is heuristic and might not always work perfectly. You might need to manually fillet edges in Rhino after running the script if the automatic filleting fails or doesn't look right.
Solid Check: Prints a warning if the final object is not detected as a closed solid, which is necessary for reliable 3D printing.
Selection: Selects the final object in Rhino so you can easily see it and export it.
Remember to check the generated geometry carefully in Rhino, especially the acoustic chamber and the slot dimensions relative to your specific phone. Good luck!