Skip to content

Commit

Permalink
for image generation locally only.
Browse files Browse the repository at this point in the history
  • Loading branch information
bperseghetti committed Sep 10, 2022
1 parent ce2f65c commit b684e13
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 5 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,23 @@ class cl:
print('INFO\t - {:s}Using git branch in main.py:{:s} {:s}'.format(cl.GRN,cl.END,currentGitBranch))

# End of optional block

flag_gen_image = True
try:
from stl.mesh import Mesh
except ImportError:
flag_gen_image = False
print('\n\n{:s}{:s}ERROR\t - Unable to import Python module "stl", check to see if numpy-stl is installed.{:s}\n\n'.format(cl.FAIL,cl.BOLD,cl.END))

try:
import vtkplotlib as vpl
except ImportError:
flag_gen_image = False
print('\n\n{:s}{:s}ERROR\t - Unable to import Python module "vtkplotlib", check to see if vtkplotlib is installed.{:s}\n\n'.format(cl.FAIL,cl.BOLD,cl.END))

try:
from PIL import Image
except ImportError:
flag_gen_image = False
print('\n\n{:s}{:s}ERROR\t - Unable to import Python module "PIL", check to see if PIL is installed.{:s}\n\n'.format(cl.FAIL,cl.BOLD,cl.END))


Expand Down Expand Up @@ -146,7 +149,7 @@ def listfiles(path):
def check_generate(file_path):
name_file = './docs/'+file_path
image_name = name_file.replace(".stl",".png")
if not os.path.exists(image_name):
if not os.path.exists(image_name) and flag_gen_image:
print('INFO\t - {:s}Attempting to generate:{:s} {:s} -> {:s}'.format(cl.GRN,cl.END,name_file,image_name))
try:
mesh = Mesh.from_file(name_file)
Expand Down
4 changes: 1 addition & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Jinja2==3.0.3
mkdocs-macros-plugin==0.7.0
GitPython==3.1.24
numpy-stl==2.17.1
vtkplotlib==2.0.0
Pillow==9.0.1

0 comments on commit b684e13

Please sign in to comment.