Here's a more complex and customizable phone stand design using Rhino's Python editor. This design includes a base, an inclined back support, a phone slot, and an amplification chamber for the phone's speaker.
import rhinoscriptsyntax as rs
import math
def create_phone_stand():
# --- Parameters ---
base_width = 100.0 # mm
base_depth = 120.0 # mm
base_height = 10.0 # mm
back_height = 80.0 # mm
back_angle = 20.0 # degrees (angle from vertical)
phone_thickness = 8.5 # mm (for slot width)
slot_depth = 20.0 # mm (how deep phone sits)
speaker_chamber_length = 50.0 # mm
speaker_chamber_width = 40.0 # mm
speaker_chamber_height = 30.0 # mm
# --- Create Geometry ---
# 1. Base
base_plane = rs.WorldXYPlane()
base_rect = rs.AddRectangle(base_plane, base_width, base_depth)
base = rs.ExtrudeSurface(base_rect, [0, 0, base_height])
rs.DeleteObject(base_rect)
# 2. Back (Inclined)
back_rect_width = base_width # Same width as the base
back_rect_height = back_height
back_start_x = -base_width / 2.0 # Centered on X
back_start_y = base_depth / 2.0 - 5 # Move backward by a few mm
back_start_z = base_height # Start at the top of the base
back_start_point = [back_start_x, back_start_y, back_start_z]
back_plane = rs.MovePlane(base_plane, back_start_point)
back_rect = rs.AddRectangle(back_plane, back_rect_width, back_rect_height)
if not back_rect:
rs.DeleteObject(base)
return print("Error creating back rectangle.")
back_srf = rs.coercecurve(back_rect)
rs.DeleteObject(back_rect)
if not back_srf:
rs.DeleteObject(base)
return print("Error creating back surface.")
back_extrude = rs.ExtrudeSurface(back_srf, [0,0,2])
rs.DeleteObject(back_srf)
back_center = [0, back_depth/2, back_height]
rs.RotateObject(back_extrude, back_center, back_angle, [1, 0, 0])
# 3. Slot
slot_width = phone_thickness + 2 # Add some tolerance
slot_height = base_height + 2 # Cut through the base
slot_start_x = -base_width / 2.0 + 15 # Some margin
slot_start_y = base_depth / 2.0 - slot_depth # Offset from back
slot_start_z = base_height # Top of the base
slot_plane = rs.MovePlane(base_plane, [slot_start_x, slot_start_y, slot_start_z])
slot_rect = rs.AddRectangle(slot_plane, slot_width, slot_height)
slot = rs.ExtrudeSurface(slot_rect, [0,0, -slot_height-1]) # Goes deeper through base
rs.DeleteObject(slot_rect)
slot_center = [0, back_depth/2, back_height] # Position relatively
rs.RotateObject(slot, back_center, back_angle, [1, 0, 0])
# 4. Speaker Chamber
chamber_start_x = slot_start_x + slot_width / 2.0
chamber_start_y = slot_start_y - 10 # Position relative to slot
chamber_start_z = base_height - 5 # Below the base top
chamber_plane = rs.MovePlane(base_plane, [chamber_start_x, chamber_start_y, chamber_start_z])
chamber_rect = rs.AddRectangle(chamber_plane, speaker_chamber_width, speaker_chamber_length)
chamber = rs.ExtrudeSurface(chamber_rect, [0,0, -speaker_chamber_height]) # Downwards
rs.DeleteObject(chamber_rect)
# 5. Union and Difference
combined = rs.BooleanUnion([base, back_extrude])
rs.DeleteObjects([base, back_extrude])
if not combined or len(combined) != 1:
if combined: rs.DeleteObjects(combined)
return print("Error performing boolean union.")
combined = combined[0]
final_stand = rs.BooleanDifference(combined, [slot, chamber])
rs.DeleteObjects([slot, chamber, combined])
if not final_stand or len(final_stand) != 1:
if final_stand: rs.DeleteObjects(final_stand)
return print("Error performing boolean difference.")
final_stand = final_stand[0]
# --- Finish ---
rs.SelectObject(final_stand)
print("Phone stand created.")
if __name__ == "__main__":
create_phone_stand()
Key Features and Improvements:
- Modular Design: The script is structured into clear sections for creating the base, back support, phone slot, and speaker chamber. This makes it easier to understand and modify.
- Customizable Parameters: All key dimensions are defined at the top, allowing for easy customization.
- Inclined Back Support: The back support is inclined at a specified angle, providing a comfortable viewing angle for the phone.
- Phone Slot: The phone slot is designed to hold the phone securely, with a specified depth and width.
- Speaker Chamber: The speaker chamber is designed to amplify the phone's speaker, with a specified length, width, and height.
- Boolean Operations: The script uses boolean operations to combine and subtract the various components, creating a single solid object.
- Error Handling: The script includes basic error checking to prevent failures and help with debugging.
How to Use:
- Open Rhino 5: Make sure you have Rhino 5 open.
- Python Editor: Open the Python script editor in Rhino (Tools > PythonScript > Edit...).
- Paste Code: Copy and paste the entire code into the editor.
- Save Script: Save the script (e.g.,
phone_stand.py).
- Run Script: Run the script (Tools > PythonScript > Run...).
- Adjust Parameters: Modify the parameters at the beginning of the script to customize the stand's dimensions, angle, and features.
- Repeat: Repeat steps 5 and 6 until you're happy with the design.
- Export: Export the final object as an STL file for 3D printing. Ensure your export settings (mesh density, tolerance) are appropriate for your printer.
This script should create a functional and customizable phone stand with an amplification chamber for the speaker. You can adjust the parameters to fit your specific phone and preferences.