Below is an example Rhino Python script that creates a simple phone stand. This design features a flat base, a vertical “back” support, and a recessed cradle (cutout) for holding a phone. You can run this code in the Rhino 5 Python editor (accessed via the EditPythonScript command). Feel free to adjust dimensions and tweak shapes to better suit your phone and preferences.
Note:
• The dimensions here are examples. Adjust the values (especially the phone cradle size) to match your phone.
• The script uses basic operations (adding boxes and boolean subtractions) to build the solid stand.
• After generating the stand, inspect it in Rhino and use Rhino’s export command (e.g. export as STL) for 3D printing.
Below is the complete Rhino Python script:
python
import rhinoscriptsyntax as rs
def create_box(origin, length, width, height):
"""
Creates a box (closed Brep) given:
- origin: the lower left corner (x, y, z)
- length: extent in the X-direction
- width: extent in the Y-direction
- height: extent in the Z-direction
The box is built with 8 corner points.
"""
(x, y, z) = origin
p0 = (x, y, z)
p1 = (x + length, y, z)
p2 = (x + length, y + width, z)
p3 = (x, y + width, z)
p4 = (x, y, z + height)
p5 = (x + length, y, z + height)
p6 = (x + length, y + width, z + height)
p7 = (x, y + width, z + height)
pts = [p0, p1, p2, p3, p4, p5, p6, p7]
return rs.AddBox(pts)
def main():
# --- Define Dimensions (in millimeters) ---
# Base dimensions
base_length = 150.0 # x-direction
base_width = 100.0 # y-direction
base_thickness = 5.0 # z-direction
# Vertical support (back plate) dimensions
support_thickness = 5.0 # horizontal thickness of back support
support_height = 120.0 # vertical extent of support (from base top)
# Phone cradle (recessed cut-out) dimensions
# These are typical extra clearances; adjust to your phone’s size.
phone_width = 70.0 # approximate phone width
phone_thickness = 8.0 # approximate phone thickness
# The cradle is made slightly larger than the phone
cradle_width = phone_width + 20.0 # extra clearance left/right
cradle_depth = phone_thickness + 10.0 # extra clearance front/back
cradle_height = phone_thickness + 5.0 # depth of the recess
# --- Create the Base ---
base_origin = (0, 0, 0)
base = create_box(base_origin, base_length, base_width, base_thickness)
# --- Create the Vertical Support ---
# We position the vertical support on the "back" edge of the base.
# In this design, the support runs the entire base length, and has the same width as the base.
support_origin = (0, base_width - support_thickness, base_thickness)
support = create_box(support_origin, base_length, support_thickness, support_height)
# --- Create the Phone Cradle Cut-Out ---
# The cradle is a rectangular box that will be subtracted (boolean difference)
# from the support. It’s located roughly at the center of the support.
cradle_origin_x = (base_length - cradle_width) / 2.0
# Place cradle more inward from the back edge so it forms a seat.
cradle_origin_y = base_width - support_thickness - cradle_depth
cradle_origin_z = base_thickness
cradle = create_box((cradle_origin_x, cradle_origin_y, cradle_origin_z),
cradle_width, cradle_depth, cradle_height)
# --- Subtract the Cradle from the Support ---
support_with_cradle = rs.BooleanDifference(support, [cradle])
if not support_with_cradle:
print("Boolean difference failed (check your geometry or dimensions).")
return
# --- Combine Base and Modified Support ---
phone_stand = rs.BooleanUnion([base, support_with_cradle])
if phone_stand:
rs.SelectObject(phone_stand)
print("Phone stand was successfully created.")
else:
print("Boolean union failed - please check the objects.")
if __name__=="__main__":
main()
How the Script Works
Helper Function (create_box)
This function makes it easier to create a box given an origin and extents in the X (length), Y (width), and Z (height) directions.
Base Creation
A flat rectangular base is created with the specified dimensions.
Vertical Support (Back Plate)
A slim vertical support (back panel) is built on one edge of the base. This panel will help support the phone and provide a structure into which a cradle recess will be cut.
Phone Cradle (Cut-Out)
A smaller box representing the recessed area (cradle) is created. A boolean difference subtracts this volume from the vertical support so that your phone can “seat” into the notch.
Boolean Union
Finally, the base and the processed support are united into a single solid part.
Result Inspection
The final object is selected in Rhino so you can see it immediately.
Next Steps
Adjust Dimensions: Verify and modify the phone dimensions and clearances to suit your actual device.
Refine Geometry: You can add fillets, chamfers, or more organic curves using additional Rhino commands for a more appealing design.
Export for Printing: Once satisfied with the model, export it as an STL file for slicing and 3D printing.
This script offers a good start for a functional and customizable phone stand design. Enjoy and happy printing!