Added documentation for the Python scripts.

This commit is contained in:
Chris Palmer 2019-06-11 15:33:13 +01:00
parent 419cadb7ec
commit 405c8e00b8
15 changed files with 115 additions and 6 deletions

View File

@ -1,22 +1,26 @@
# A gallery of projects made with NopSCADlib
<a name="TOP"></a>
## ArduinoThermostat
Arduino thermostat to control a beer fridge to use it as an environmental chamber.
![](ArduinoThermostat.png)
<a name="TOP"></a>
## HydraBot
Current state of HydraRaptor after being modified for laser engraving.
![](HydraBot.png)
<a name="TOP"></a>
## IOT 50V PSU
WiFi controllable PSU
![](IOT_50V_PSU.png)
<a name="TOP"></a>
## 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)
<a name="TOP"></a>
## MainsBreakOutBox
13A socket break out box with 4mm jacks to measure voltage and / or load current and earth leakage current.
![](MainsBreakOutBox.png)
<a name="TOP"></a>
## Mains Box
Mains isolated and variable supply with metering.
@ -58,6 +64,7 @@ WiFi enabled remote control turntable for photography
![](Turntable.png)
<a name="TOP"></a>
## 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)

View File

@ -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).

View File

@ -19,6 +19,7 @@
# If not, see <https://www.gnu.org/licenses/>.
#
#! Generates BOM files for the project.
from __future__ import print_function
import os

View File

@ -19,6 +19,8 @@
# If not, see <https://www.gnu.org/licenses/>.
#
#
#! 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)

72
scripts/doc_scripts.py Normal file
View File

@ -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 <https://www.gnu.org/licenses/>.
#
#
#! 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()

View File

@ -18,7 +18,8 @@
# You should have received a copy of the GNU General Public License along with NopSCADlib.
# If not, see <https://www.gnu.org/licenses/>.
#
#! Generates DXF files for all the routed parts listed on the BOM or a specified list.
#
from __future__ import print_function
import sys

View File

@ -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

View File

@ -18,6 +18,7 @@
# You should have received a copy of the GNU General Public License along with NopSCADlib.
# If not, see <https://www.gnu.org/licenses/>.
#
#! Generates all the files for a project by running ```bom.py```, ```stls.py```, ```dxfs.py```, ```render.py``` and ```views.py```.
import sys

20
scripts/readme.md Normal file
View File

@ -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. |

View File

@ -19,6 +19,8 @@
# If not, see <https://www.gnu.org/licenses/>.
#
#! 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

View File

@ -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

View File

@ -18,6 +18,7 @@
# You should have received a copy of the GNU General Public License along with NopSCADlib.
# If not, see <https://www.gnu.org/licenses/>.
#
#! Generates STL files for all the printed parts listed on the BOM or a specified list.
from __future__ import print_function
import sys

View File

@ -18,6 +18,7 @@
# You should have received a copy of the GNU General Public License along with NopSCADlib.
# If not, see <https://www.gnu.org/licenses/>.
#
#! Generates SVG files for all the routed parts listed on the BOM or a specified list.
from __future__ import print_function
import sys

View File

@ -18,6 +18,7 @@
# You should have received a copy of the GNU General Public License along with NopSCADlib.
# If not, see <https://www.gnu.org/licenses/>.
#
#! 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).

View File

@ -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 *