Add Dockerfile and modify generator script to change shapes and take a unique file id.
This commit is contained in:
parent
29ffa13092
commit
c9c98f91dc
18 changed files with 166867 additions and 57 deletions
|
@ -8,41 +8,6 @@ import numpy as np
|
|||
import FreeCAD
|
||||
import Part
|
||||
|
||||
# def generate_bulb(height, radius, thickness):
|
||||
#
|
||||
# light_angle = np.arcsin(0.25) + np.pi/2.0
|
||||
# light_arc_length = radius*light_angle+np.pi/2.0
|
||||
# num_divisions = 25
|
||||
# segment_length = light_arc_length/float(num_divisions)
|
||||
#
|
||||
# edges = []
|
||||
# for idx in range(1, num_divisions):
|
||||
# angle0 = float(idx-1)/float(num_divisions)*light_angle
|
||||
# angle1 = float(idx)/float(num_divisions)*light_angle
|
||||
# x0 = -radius*np.sin(angle0)
|
||||
# y0 = -radius*np.cos(angle0)
|
||||
# x1 = -radius*np.sin(angle1)
|
||||
# y1 = -radius*np.cos(angle1)
|
||||
# edges.append(Part.makeLine((x0, y0, 0),
|
||||
# (x1, y1, 0)))
|
||||
#
|
||||
# edge0 = Part.makeLine((0.0, height, 0),
|
||||
# (-radius, 0.0, 0))
|
||||
# edge1 = Part.makeLine((-radius, 0.0, 0),
|
||||
# (-radius -thickness, 0.0, 0))
|
||||
# edge2 = Part.makeLine((-radius -thickness, 0.0, 0),
|
||||
# (-radius -thickness, height, 0))
|
||||
# edge3 = Part.makeLine((-radius -thickness, height, 0),
|
||||
# (0.0, height, 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_chord(height, radius, thickness):
|
||||
|
||||
edge0 = Part.makeLine((0.0, height, 0),
|
||||
|
|
Binary file not shown.
|
@ -30,6 +30,10 @@ def render_lamp(shade_file_path,
|
|||
shade_actor = vtk.vtkActor()
|
||||
shade_actor.SetMapper(shade_mapper)
|
||||
shade_actor.GetProperty().SetColor(np.array(color)/255.0)
|
||||
shade_actor.GetProperty().SetAmbient(0.3)
|
||||
shade_actor.GetProperty().SetDiffuse(0.75)
|
||||
shade_actor.GetProperty().SetSpecular(0.5)
|
||||
shade_actor.GetProperty().SetOpacity(0.4)
|
||||
|
||||
# base
|
||||
base_reader = vtk.vtkSTLReader()
|
||||
|
@ -56,6 +60,7 @@ def render_lamp(shade_file_path,
|
|||
# Add a light
|
||||
light = vtk.vtkLight()
|
||||
light.SetPositional(True)
|
||||
light.SetLightTypeToSceneLight()
|
||||
light.SetFocalPoint(0.0,-100.0, 0.0)
|
||||
light.SetIntensity(1.0)
|
||||
lightActor = vtk.vtkLightActor()
|
||||
|
@ -63,12 +68,29 @@ def render_lamp(shade_file_path,
|
|||
|
||||
light.SetColor(0.0,0.0,0.0)
|
||||
light.SetSwitch(1)
|
||||
light.SetConeAngle(60)
|
||||
ren.AddViewProp(lightActor)
|
||||
|
||||
cone = vtk.vtkConeSource()
|
||||
cone.SetResolution(60)
|
||||
cone.SetCenter(0.0,-150.0,0)
|
||||
cone.SetHeight(20.0)
|
||||
cone.SetRadius(20.0)
|
||||
|
||||
cone_mapper = vtk.vtkPolyDataMapper()
|
||||
cone_mapper.SetInputConnection(cone.GetOutputPort())
|
||||
cone_mapper.SetScalarVisibility(0)
|
||||
|
||||
cone_actor = vtk.vtkActor()
|
||||
cone_actor.SetMapper(cone_mapper)
|
||||
cone_actor.SetVisibility(1)
|
||||
cone_actor.GetProperty().SetColor(1.0, 1.0, 1.0)
|
||||
|
||||
# assign actor to the renderer
|
||||
ren.AddActor(shade_actor)
|
||||
ren.AddActor(base_actor)
|
||||
ren.AddActor(chord_actor)
|
||||
#ren.AddActor(cone_actor)
|
||||
|
||||
# Do render and output
|
||||
#iren.Initialize()
|
||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue