parabolica.py
· 561 B · Python
原始文件
import Part, math
focalPoint = 792.0
diameter = 2200.0
radius = diameter / 2
thickness = 3
m=App.Matrix()
m.rotateY(math.radians(-90))
# create a parabola
parabola=Part.Parabola()
# the axis of the plane the curve is lying on, this sets the symmetry axis to (0,0,1)
#parabola.Axis=App.Vector(1,0,0)
parabola.Focal = focalPoint
parabola.transform(m)
# get only the right part of the curve
edge=parabola.toShape(0,radius)
Part.show(edge)
face=edge.revolve(App.Vector(0,0,0),App.Vector(0,0,1),360)
offset=face.makeOffsetShape(-thickness,0.001)
Part.show(offset)
| 1 | import Part, math |
| 2 | |
| 3 | focalPoint = 792.0 |
| 4 | diameter = 2200.0 |
| 5 | radius = diameter / 2 |
| 6 | thickness = 3 |
| 7 | |
| 8 | m=App.Matrix() |
| 9 | m.rotateY(math.radians(-90)) |
| 10 | # create a parabola |
| 11 | parabola=Part.Parabola() |
| 12 | # the axis of the plane the curve is lying on, this sets the symmetry axis to (0,0,1) |
| 13 | #parabola.Axis=App.Vector(1,0,0) |
| 14 | parabola.Focal = focalPoint |
| 15 | parabola.transform(m) |
| 16 | # get only the right part of the curve |
| 17 | edge=parabola.toShape(0,radius) |
| 18 | Part.show(edge) |
| 19 | face=edge.revolve(App.Vector(0,0,0),App.Vector(0,0,1),360) |
| 20 | offset=face.makeOffsetShape(-thickness,0.001) |
| 21 | |
| 22 | Part.show(offset) |