65 lines
2.2 KiB
Python
65 lines
2.2 KiB
Python
|
|
import sys
|
|
# freecad setup
|
|
FREECADPATH = "/usr/lib/freecad/lib/"
|
|
sys.path.append(FREECADPATH)
|
|
import numpy as np
|
|
import FreeCAD
|
|
import Part
|
|
|
|
def generate_cone_shade(height, radius, thickness):
|
|
|
|
edge0 = Part.makeLine((0.0, 0.0, 0),
|
|
(-radius, -height, 0))
|
|
edge1 = Part.makeLine((-radius, -height, 0),
|
|
(-radius -thickness, -height, 0))
|
|
edge2 = Part.makeLine((-radius -thickness, -height, 0),
|
|
(-thickness, 0.0, 0))
|
|
edge3 = Part.makeLine((-thickness, 0.0, 0),
|
|
(0.0, 0.0, 0))
|
|
wire1 = Part.Wire([edge0, edge1, edge2, edge3])
|
|
face = Part.Face([wire1,])
|
|
|
|
pos = FreeCAD.Vector(0.0, 0.0, 0.0)
|
|
vec = FreeCAD.Vector(0.0, 1.0, 0.0)
|
|
angle = 360
|
|
solid = face.revolve(pos, vec, angle)
|
|
return solid
|
|
|
|
def generate_mesh_shade(height, radius, thickness):
|
|
|
|
edge0 = Part.makeLine((0.0, 0.0, 0),
|
|
(-radius, -height, 0))
|
|
edge1 = Part.makeLine((-radius, -height, 0),
|
|
(-radius -thickness, -height, 0))
|
|
edge2 = Part.makeLine((-radius -thickness, -height, 0),
|
|
(-thickness, 0.0, 0))
|
|
edge3 = Part.makeLine((-thickness, 0.0, 0),
|
|
(0.0, 0.0, 0))
|
|
wire1 = Part.Wire([edge0, edge1, edge2, edge3])
|
|
face = Part.Face([wire1,])
|
|
|
|
pos = FreeCAD.Vector(0.0, 0.0, 0.0)
|
|
vec = FreeCAD.Vector(0.0, 1.0, 0.0)
|
|
angle = 360
|
|
solid = face.revolve(pos, vec, angle)
|
|
return solid
|
|
|
|
def generate_bio_shade(height, radius, thickness):
|
|
|
|
edge0 = Part.makeLine((0.0, 0.0, 0),
|
|
(-radius, -height, 0))
|
|
edge1 = Part.makeLine((-radius, -height, 0),
|
|
(-radius -thickness, -height, 0))
|
|
edge2 = Part.makeLine((-radius -thickness, -height, 0),
|
|
(-thickness, 0.0, 0))
|
|
edge3 = Part.makeLine((-thickness, 0.0, 0),
|
|
(0.0, 0.0, 0))
|
|
wire1 = Part.Wire([edge0, edge1, edge2, edge3])
|
|
face = Part.Face([wire1,])
|
|
|
|
pos = FreeCAD.Vector(0.0, 0.0, 0.0)
|
|
vec = FreeCAD.Vector(0.0, 1.0, 0.0)
|
|
angle = 360
|
|
solid = face.revolve(pos, vec, angle)
|
|
return solid
|