diff --git a/gallery/readme.md b/gallery/readme.md index be96c14..5fa79fd 100644 --- a/gallery/readme.md +++ b/gallery/readme.md @@ -1,22 +1,26 @@ # A gallery of projects made with NopSCADlib + ## ArduinoThermostat Arduino thermostat to control a beer fridge to use it as an environmental chamber. ![](ArduinoThermostat.png) + ## HydraBot Current state of HydraRaptor after being modified for laser engraving. ![](HydraBot.png) + ## IOT 50V PSU WiFi controllable PSU ![](IOT_50V_PSU.png) + ## Lab ATX PSU Bench power supply built around an ATX PSU. @@ -37,12 +41,14 @@ Bench power supply built around an ATX PSU. ![](Laser_load.png) + ## MainsBreakOutBox 13A socket break out box with 4mm jacks to measure voltage and / or load current and earth leakage current. ![](MainsBreakOutBox.png) + ## Mains Box Mains isolated and variable supply with metering. @@ -58,6 +64,7 @@ WiFi enabled remote control turntable for photography ![](Turntable.png) + ## Variac Motorised variac with WiFi control, see [hydraraptor.blogspot.com/2018/04/esp8266-spi-spy](https://hydraraptor.blogspot.com/2018/04/esp8266-spi-spy.html) diff --git a/readme.md b/readme.md index 8e9084d..6fe3f58 100644 --- a/readme.md +++ b/readme.md @@ -4,7 +4,7 @@ An ever expanding library of parts modelled in OpenSCAD useful for 3D printers a It contains lots of vitamins (the RepRap term for non-printed parts), some general purpose printed parts and some utilities. There are also Python scripts to generate Bills of Materials (BOMs), STL files for all the printed parts, DXF files for CNC routed parts in a project and a manual containing assembly -instructions and exploded views by scraping markdown embedded in OpenSCAD comments. A simple example project can be found [here](examples/MainsBreakOutBox/readme.md). +instructions and exploded views by scraping markdown embedded in OpenSCAD comments, [see scripts](scripts/readme.md). A simple example project can be found [here](examples/MainsBreakOutBox/readme.md). For more examples of what it can make see the [gallery](gallery/readme.md). diff --git a/scripts/bom.py b/scripts/bom.py index 1b79b36..a804da2 100644 --- a/scripts/bom.py +++ b/scripts/bom.py @@ -19,6 +19,7 @@ # If not, see . # +#! Generates BOM files for the project. from __future__ import print_function import os diff --git a/scripts/c14n_stl.py b/scripts/c14n_stl.py index e672163..73f0611 100644 --- a/scripts/c14n_stl.py +++ b/scripts/c14n_stl.py @@ -19,6 +19,8 @@ # If not, see . # +# +#! OpenSCAD produces randomly ordered STL files. This script re-orders them consistently so that GIT can tell if they have changed or not. # # OpenSCAD produces randomly ordered STL files so source control like GIT can't tell if they have changed or not. # This scrip orders each triangle to start with the lowest vertex first (comparing x, then y, then z) diff --git a/scripts/doc_scripts.py b/scripts/doc_scripts.py new file mode 100644 index 0000000..be511a8 --- /dev/null +++ b/scripts/doc_scripts.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python + +# +# NopSCADlib Copyright Chris Palmer 2018 +# nop.head@gmail.com +# hydraraptor.blogspot.com +# +# This file is part of NopSCADlib. +# +# NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +# GNU General Public License as published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with NopSCADlib. +# If not, see . +# + +# +#! Makes this document. +# +from __future__ import print_function + +import os +from tests import do_cmd + +dir = 'scripts' + +def doc_scripts(): + doc_name = dir + '/readme.md' + with open(doc_name, 'wt') as doc_file: + print( +''' +# Python scripts +These are located in the scripts subdirectory, which needs to be added to the program search path. + +They should work with both Python 2 and Python 3. + +| | | +|:--|:--|''', file = doc_file) + for file in os.listdir('scripts'): + if file.endswith('.py'): + blurb = '' + with open(dir + '/' + file, 'rt') as f: + lines = f.readlines() + for line in lines: + if line == "if __name__ == '__main__':\n": + break + else: + continue + for line in lines[1:]: + if line.startswith('#! '): + line = line.replace('~\n', ' \n') + blurb = blurb + line[3 : -1] + if line.startswith("def "): + break + if not blurb: + print("Missing description for", file) + print("| ```%s``` | %s |" % (file, blurb), file = doc_file) + + with open(dir + "/readme.html", "wt") as html_file: + do_cmd(("python -m markdown -x tables " + doc_name).split(), html_file) + # + # Spell check + # + do_cmd(('codespell -L od ' + doc_name).split()) + +if __name__ == '__main__': + doc_scripts() diff --git a/scripts/dxfs.py b/scripts/dxfs.py index cac98d2..a962004 100644 --- a/scripts/dxfs.py +++ b/scripts/dxfs.py @@ -18,7 +18,8 @@ # You should have received a copy of the GNU General Public License along with NopSCADlib. # If not, see . # - +#! Generates DXF files for all the routed parts listed on the BOM or a specified list. +# from __future__ import print_function import sys diff --git a/scripts/gallery.py b/scripts/gallery.py index 8dc589a..5b090b0 100644 --- a/scripts/gallery.py +++ b/scripts/gallery.py @@ -20,7 +20,7 @@ # # -# Find projects and add them to the gallery +#! Finds projects and adds them to the gallery. # from __future__ import print_function import os diff --git a/scripts/make_all.py b/scripts/make_all.py index bb6c4b1..60a5494 100644 --- a/scripts/make_all.py +++ b/scripts/make_all.py @@ -18,6 +18,7 @@ # You should have received a copy of the GNU General Public License along with NopSCADlib. # If not, see . # +#! Generates all the files for a project by running ```bom.py```, ```stls.py```, ```dxfs.py```, ```render.py``` and ```views.py```. import sys diff --git a/scripts/readme.md b/scripts/readme.md new file mode 100644 index 0000000..fd248f0 --- /dev/null +++ b/scripts/readme.md @@ -0,0 +1,20 @@ + +# Python scripts +These are located in the scripts subdirectory, which needs to be added to the program search path. + +They should work with both Python 2 and Python 3. + +| | | +|:--|:--| +| ```bom.py``` | Generates BOM files for the project. | +| ```c14n_stl.py``` | OpenSCAD produces randomly ordered STL files. This script re-orders them consistently so that GIT can tell if they have changed or not. | +| ```doc_scripts.py``` | Makes this document. | +| ```dxfs.py``` | Generates DXF files for all the routed parts listed on the BOM or a specified list. | +| ```gallery.py``` | Finds projects and adds them to the gallery. | +| ```make_all.py``` | Generates all the files for a project by running ```bom.py```, ```stls.py```, ```dxfs.py```, ```render.py``` and ```views.py```. | +| ```render.py``` | Renders STL and DXF files to PNG for inclusion in the build instructions. | +| ```set_config.py``` | Sets the target configuration for multi-target projects that have variable configurations. | +| ```stls.py``` | Generates STL files for all the printed parts listed on the BOM or a specified list. | +| ```svgs.py``` | Generates SVG files for all the routed parts listed on the BOM or a specified list. | +| ```tests.py``` | Runs all the tests in the tests directory and makes the readme file with a catalog of the results. | +| ```views.py``` | Generates exploded and unexploded assembly views and scrapes build instructions to make readme.md, readme.html and printme.html files for the project. | diff --git a/scripts/render.py b/scripts/render.py index 7c0b324..7917391 100644 --- a/scripts/render.py +++ b/scripts/render.py @@ -19,6 +19,8 @@ # If not, see . # +#! Renders STL and DXF files to PNG for inclusion in the build instructions. + from __future__ import print_function from set_config import * from exports import bom_to_parts diff --git a/scripts/set_config.py b/scripts/set_config.py index 69a6af9..82ac7ca 100644 --- a/scripts/set_config.py +++ b/scripts/set_config.py @@ -20,7 +20,7 @@ # # -# Set target configuration for multi-target projects that have variable configurations. +#! Sets the target configuration for multi-target projects that have variable configurations. # from __future__ import print_function diff --git a/scripts/stls.py b/scripts/stls.py index 01d27d0..58cfcd3 100644 --- a/scripts/stls.py +++ b/scripts/stls.py @@ -18,6 +18,7 @@ # You should have received a copy of the GNU General Public License along with NopSCADlib. # If not, see . # +#! Generates STL files for all the printed parts listed on the BOM or a specified list. from __future__ import print_function import sys diff --git a/scripts/svgs.py b/scripts/svgs.py index 4cca176..d653240 100644 --- a/scripts/svgs.py +++ b/scripts/svgs.py @@ -18,6 +18,7 @@ # You should have received a copy of the GNU General Public License along with NopSCADlib. # If not, see . # +#! Generates SVG files for all the routed parts listed on the BOM or a specified list. from __future__ import print_function import sys diff --git a/scripts/tests.py b/scripts/tests.py index 45c7dab..b92e0b5 100644 --- a/scripts/tests.py +++ b/scripts/tests.py @@ -18,6 +18,7 @@ # You should have received a copy of the GNU General Public License along with NopSCADlib. # If not, see . # +#! Runs all the tests in the tests directory and makes the readme file with a catalog of the results. from __future__ import print_function import os @@ -232,7 +233,7 @@ An ever expanding library of parts modelled in OpenSCAD useful for 3D printers a It contains lots of vitamins (the RepRap term for non-printed parts), some general purpose printed parts and some utilities. There are also Python scripts to generate Bills of Materials (BOMs), STL files for all the printed parts, DXF files for CNC routed parts in a project and a manual containing assembly -instructions and exploded views by scraping markdown embedded in OpenSCAD comments. A simple example project can be found [here](examples/MainsBreakOutBox/readme.md). +instructions and exploded views by scraping markdown embedded in OpenSCAD comments, [see scripts](scripts/readme.md). A simple example project can be found [here](examples/MainsBreakOutBox/readme.md). For more examples of what it can make see the [gallery](gallery/readme.md). diff --git a/scripts/views.py b/scripts/views.py index 199de4e..fd76fd2 100644 --- a/scripts/views.py +++ b/scripts/views.py @@ -20,7 +20,7 @@ # # -#: Generate assembly views and intructions +#! Generates exploded and unexploded assembly views and scrapes build instructions to make readme.md, readme.html and printme.html files for the project. # from __future__ import print_function from set_config import *