1
0
mirror of https://github.com/nophead/Mendel90.git synced 2025-01-16 20:38:15 +01:00
Mendel90/sheets.py

75 lines
2.3 KiB
Python
Raw Normal View History

#!/usr/bin/env python
from __future__ import print_function
2012-03-12 01:13:07 +00:00
import os
import openscad
import InkCL
2012-03-12 01:13:07 +00:00
import shutil
import sys
from dxf import *
from set_machine import *
from time import *
2012-03-12 01:13:07 +00:00
source_dir = "scad"
2016-02-20 12:23:06 +00:00
def sheets(machine, parts = None):
2012-03-12 01:13:07 +00:00
#
# Make the target directory
#
target_dir = machine + "/sheets"
if os.path.isdir(target_dir):
shutil.rmtree(target_dir)
sleep(0.1)
os.makedirs(target_dir)
This version used for the kits 1-6 at the GIST FOTM. Z axis length increased to 200mm. Added the Dibond variant that uses nuts in the parts instead of tapped holes. Added a ducted fan to the X carriage. Added a spool holder and filament dust wiper. Default hot end is now J-Head MK4. Default electronics is now Melzi plus ATX PSU on the mendel and dibond versions. The right hand stay has been moved inwards and base corner radius reduced to allow and ATX PSU to be mounted inboard. Mounting brackets for ATX PSU added. The electronics are now above the PSU. Mains inlet cover added for non ATX PSUs. Dummy load resistors added for ATX PSU. The extruder now has a groove mount for the JHead. Extruder connector increased from 9 way to 15 way to allow an IDC socket. The extruder ribbon cable is now 14 way to allow three wires for the heater. Added an extruder break out PCB. Wade's idler bracket now a bit wider to allow more tolerance on the length of the axle. Extruder motor screws now longer and hex head. The hobbed bolt now has two nuts and a star washer instead of one nut and a spring. Increased the bed ribbon cable to 26 way to make it standard size. Y carriage made a bit smaller. Thermistor added to the bed assembly. Bed cooling fan made an optional extra. Made the Z top limit switch the default. The X idler now has two bearings. Lead nuts now brass. Added metal pulleys as an option. T2.5 belts added as an option. Nut traps added to the Y carrige ribbon clamp. Corner shields and support material added to X motor bracket. Belt length calculations more accurate. Axis limit switch positions and overtravel optimised. Washer sizes tweaked. Ziptie length tweaked. PVC tubing diameter changed.
2012-11-15 17:45:30 +00:00
else:
os.makedirs(target_dir)
2012-03-12 01:13:07 +00:00
#
# Set the target machine
#
set_machine(machine)
2012-03-12 01:13:07 +00:00
#
# Find all the scad files
#
for filename in os.listdir(source_dir):
if filename[-5:] == ".scad":
#
# find any modules ending in _dxf
#
for line in open(source_dir + "/" + filename, "r").readlines():
words = line.split()
if len(words) and words[0] == "module":
2012-03-12 01:13:07 +00:00
module = words[1].split('(')[0]
if module[-4:] == "_dxf" and (not parts or (module[:-4] + ".dxf") in parts):
2012-03-12 01:13:07 +00:00
#
# make a file to use the module
#
dxf_maker_name = target_dir + "/" + module + ".scad"
f = open(dxf_maker_name, "w")
f.write("use <../../%s/%s>\n" % (source_dir, filename))
2012-03-12 01:13:07 +00:00
f.write("%s();\n" % module);
f.close()
#
# Run openscad on the created file
#
base_name = target_dir + "/" + module[:-4]
dxf_name = base_name + ".dxf"
openscad.run("-o", dxf_name, dxf_maker_name)
#
# Make SVG drill template
#
2012-03-12 01:13:07 +00:00
dxf_to_svg(dxf_name)
#
# Make PDF for printing
#
InkCL.run("-f", base_name + ".svg", "-A", base_name + ".pdf")
os.remove(dxf_maker_name)
2012-03-12 01:13:07 +00:00
if __name__ == '__main__':
if len(sys.argv) > 1:
sheets(sys.argv[1], sys.argv[2:])
2012-03-12 01:13:07 +00:00
else:
print("usage: sheets dibond|mendel|sturdy|huxley|your_machine [part.dxf ...]")
2012-03-12 01:13:07 +00:00
sys.exit(1)