Add json only input.
This commit is contained in:
parent
c9c98f91dc
commit
afbacca3f4
21 changed files with 89611 additions and 118 deletions
65
src/product_gen/generate_shades.py
Normal file
65
src/product_gen/generate_shades.py
Normal file
|
@ -0,0 +1,65 @@
|
|||
|
||||
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
|
Loading…
Add table
Add a link
Reference in a new issue