Download examples/rocket.py from HelloSun/WFreeCAD: direct link, hf CLI and curl.
- Browser
- Download file 1.94 kB
-
https://huggingface.co/spaces/HelloSun/WFreeCAD/resolve/main/examples/rocket.py
- Command line
-
hf download hf://spaces/HelloSun/WFreeCAD/examples/rocket.py
-
curl -L -o rocket.py https://huggingface.co/spaces/HelloSun/WFreeCAD/resolve/main/examples/rocket.py
1.94 kB
| import FreeCAD as App | |
| import Part | |
| cream = (0.90, 0.86, 0.76) | |
| coral = (0.94, 0.47, 0.34) | |
| mint = (0.37, 0.63, 0.54) | |
| screen = (0.09, 0.12, 0.17) | |
| flame = (1.00, 0.80, 0.32) | |
| # Main body. | |
| body = Part.makeCylinder(4.5, 16, App.Vector(0, 0, 3)) | |
| body_obj = Part.show(body, "Body") | |
| body_obj.ViewObject.ShapeColor = cream | |
| # Nose cone. | |
| nose = Part.makeCone(4.5, 0.2, 7, App.Vector(0, 0, 19)) | |
| nose_obj = Part.show(nose, "Nose") | |
| nose_obj.ViewObject.ShapeColor = coral | |
| # Coral band around the body. | |
| band = Part.makeCylinder(4.58, 0.7, App.Vector(0, 0, 6.2)) | |
| band_obj = Part.show(band, "Band") | |
| band_obj.ViewObject.ShapeColor = coral | |
| # Porthole and rim. | |
| window = Part.makeCylinder(2.0, 0.9, App.Vector(0, -4.8, 12.4), App.Vector(0, 1, 0)) | |
| window_obj = Part.show(window, "Window") | |
| window_obj.ViewObject.ShapeColor = screen | |
| rim = Part.makeTorus(2.2, 0.32, App.Vector(0, -4.75, 12.4), App.Vector(0, 1, 0)) | |
| rim_obj = Part.show(rim, "WindowRim") | |
| rim_obj.ViewObject.ShapeColor = cream | |
| # Three swept fins. The profile is drawn in XY, extruded along Z and then | |
| # tipped upright so it becomes a vertical triangle. | |
| fin_profile = Part.Face( | |
| Part.makePolygon( | |
| [ | |
| App.Vector(4.0, 0, 0), | |
| App.Vector(9.5, 0, 0), | |
| App.Vector(4.0, 6.5, 0), | |
| ], | |
| True, | |
| ) | |
| ) | |
| fin = fin_profile.extrude(App.Vector(0, 0, 0.8)) | |
| fin.rotate(App.Vector(0, 0, 0), App.Vector(1, 0, 0), 90) | |
| fin.translate(App.Vector(0, -0.4, 3.0)) | |
| for i in range(3): | |
| blade = fin.copy() | |
| blade.rotate(App.Vector(0, 0, 0), App.Vector(0, 0, 1), i * 120) | |
| blade_obj = Part.show(blade, "Fin") | |
| blade_obj.ViewObject.ShapeColor = mint | |
| # Exhaust flame. | |
| outer = Part.makeCone(0.7, 3.6, 6.0, App.Vector(0, 0, -3.0)) | |
| outer_obj = Part.show(outer, "OuterFlame") | |
| outer_obj.ViewObject.ShapeColor = coral | |
| inner = Part.makeCone(0.0, 1.8, 5.2, App.Vector(0, 0, -4.2)) | |
| inner_obj = Part.show(inner, "InnerFlame") | |
| inner_obj.ViewObject.ShapeColor = flame | |