Created
January 16, 2024 00:06
-
-
Save lf94/31c78ed7a80173933a02e3bfb7426434 to your computer and use it in GitHub Desktop.
Prompt: A flowerpot of 10 cm diameter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cadquery as cq | |
# Parameters | |
diameter = 10.0 # Diameter of the flowerpot | |
height = 10.0 # Height of the flowerpot | |
thickness = 0.5 # Wall thickness of the flowerpot | |
bottom_thickness = 0.5 # Bottom thickness of the flowerpot | |
# Create the outer shell of the flowerpot | |
outer_shell = cq.Workplane("XY").circle(diameter / 2).extrude(height) | |
# Create the inner cavity by offsetting the outer shell inwards | |
inner_shell = ( | |
outer_shell.faces("<Z") | |
.workplane() | |
.circle((diameter / 2) - thickness) | |
.extrude(height - bottom_thickness) | |
) | |
# Subtract the inner cavity from the outer shell to create the hollow flowerpot | |
flowerpot = outer_shell.cut(inner_shell) | |
# Export the result | |
cq.exporters.export(flowerpot, "/tmp/70ba5db4-27b0-4812-955c-114cf5c0fdc4.step") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cadquery as cq | |
# Parameters | |
diameter = 10.0 # Diameter of the flowerpot | |
height = 10.0 # Height of the flowerpot | |
thickness = 0.5 # Wall thickness of the flowerpot | |
bottom_thickness = 0.5 # Bottom thickness of the flowerpot | |
# Create the outer shell of the flowerpot | |
outer_shell = cq.Workplane("XY").circle(diameter / 2).extrude(height) | |
# Create the inner cavity by offsetting the outer shell inwards | |
inner_shell = ( | |
outer_shell.faces("<Z") | |
.workplane(-bottom_thickness) | |
.circle((diameter / 2) - thickness) | |
.extrude(-(height - bottom_thickness), False) | |
) | |
# Subtract the inner cavity from the outer shell to create the hollow flowerpot | |
flowerpot = outer_shell.cut(inner_shell) | |
# Export the result | |
cq.exporters.export(flowerpot, "/tmp/70ba5db4-27b0-4812-955c-114cf5c0fdc4.step") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cadquery as cq | |
# Parameters | |
diameter = 10.0 # Diameter of the flowerpot | |
height = 10.0 # Height of the flowerpot | |
thickness = 0.5 # Wall thickness of the flowerpot | |
bottom_thickness = 0.5 # Bottom thickness of the flowerpot | |
# Create the outer shell of the flowerpot | |
outer_shell = cq.Workplane("XY").circle(diameter / 2).extrude(height) | |
# Create the inner cavity by offsetting the outer shell inwards | |
inner_shell = ( | |
outer_shell.faces("<Z") | |
.workplane(bottom_thickness, True) | |
.circle((diameter / 2) - thickness) | |
.extrude(height - bottom_thickness, False) | |
) | |
# Subtract the inner cavity from the outer shell to create the hollow flowerpot | |
flowerpot = outer_shell.cut(inner_shell) | |
# Export the result | |
cq.exporters.export(flowerpot, "/tmp/70ba5db4-27b0-4812-955c-114cf5c0fdc4.step") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment