Download examples/mug.py from HelloSun/WFreeCAD: direct link, hf CLI and curl.
- Browser
- Download file 902 Bytes
-
https://huggingface.co/spaces/HelloSun/WFreeCAD/resolve/main/examples/mug.py
- Command line
-
hf download hf://spaces/HelloSun/WFreeCAD/examples/mug.py
-
curl -L -o mug.py https://huggingface.co/spaces/HelloSun/WFreeCAD/resolve/main/examples/mug.py
902 Bytes
| import FreeCAD as App | |
| import Part | |
| mint = (0.42, 0.66, 0.58) | |
| cream = (0.91, 0.87, 0.77) | |
| coffee = (0.34, 0.21, 0.13) | |
| # Outer mug body. | |
| body = Part.makeCylinder(5.0, 9.0, App.Vector(0, 0, 0)) | |
| # Hollow it out from the top. | |
| body = body.cut( | |
| Part.makeCylinder(4.15, 8.5, App.Vector(0, 0, 0.9)) | |
| ) | |
| body_obj = Part.show(body, "MugBody") | |
| body_obj.ViewObject.ShapeColor = mint | |
| # Rounded rim. | |
| rim = Part.makeTorus(4.6, 0.45, App.Vector(0, 0, 9.0)) | |
| rim_obj = Part.show(rim, "Rim") | |
| rim_obj.ViewObject.ShapeColor = cream | |
| # Coffee surface. | |
| coffee_shape = Part.makeCylinder(4.02, 0.22, App.Vector(0, 0, 8.3)) | |
| coffee_obj = Part.show(coffee_shape, "Coffee") | |
| coffee_obj.ViewObject.ShapeColor = coffee | |
| # Handle: a torus turned to sit in the XZ plane. | |
| handle = Part.makeTorus(3.4, 0.9, App.Vector(4.6, 0, 4.6), App.Vector(0, 1, 0)) | |
| handle_obj = Part.show(handle, "Handle") | |
| handle_obj.ViewObject.ShapeColor = mint | |