Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

Commit

Permalink
Better Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dcowden committed Oct 21, 2017
1 parent 4ff8bd3 commit 73c82db
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 9 deletions.
36 changes: 33 additions & 3 deletions README.md
Expand Up @@ -17,6 +17,37 @@ CadQuery has several goals:

Using CadQuery, you can write short, simple scripts that produce high quality CAD models. It is easy to make many different objects using a single script that can be customized.

Getting Started with the docker image
=======================================
The caduery docker image (https://hub.docker.com/r/dcowden/cadquery/) includes cadquery and all of its dependencies. It can be used to run cadquery scripts without any installation required ( other than docker, of course)

Examples:

Display the Documentation::

docker run dcowden/cadquery:latest

Build a local model using stdin/stdout::

cat Ex001_Simple_Block.py | docker run -i dcowden/cadquery:latest build --in_spec stdin --format STEP --out_spec stdout

*... STEP output on the console*

Build local models and output to the same directory::

*sudo docker run -v $PWD:/home/cq -i dcowden/cadquery:latest build --in_spec Ex001_Simple_Block.py --format STEP*
INFO: Reading from file 'Ex001_Simple_Block.py'
INFO: Parsed Script 'Ex001_Simple_Block.py'.
INFO: This script provides parameters length,thickness,height, which can be customized at build time.
INFO: The script will run with default variable values
INFO: use --param_file to provide a json file that contains values to override the defaults
INFO: Output Format is 'STEP'. Use --output-format to change it.
INFO: Output Path is './cqobject-%(counter)d.%(format)s'. Use --out_spec to change it.
INFO: Script Generated 1 result Objects
INFO: Writing STEP Output to './cqobject-1.STEP'



Full Documentation
============================
You can find the full cadquery documentation at http://dcowden.github.io/cadquery
Expand Down Expand Up @@ -189,7 +220,7 @@ You can use CadQuery inside of FreeCAD. There's an excellent plugin module here
Work is underway on a stand-alone gui here: https://github.com/jmwright/cadquery-gui

### ParametricParts.com
If you are impatient and want to see a working example with no installation, have a look at this lego brick example http://parametricparts.com/parts/vqb5dy69/.
If you are impatient and want to see a working example with no installation, have a look at this lego brick example http://parametricparts.com/parts/vqb5dy69/.

The script that generates the model is on the 'modelscript' tab.

Expand Down Expand Up @@ -247,7 +278,7 @@ Roadmap/Future Work
=======================

Work has begun on Cadquery 2.0, which will feature:

1. Feature trees, for more powerful selection
2. Direct use of OpenCascade Community Edition(OCE), so that it is no longer required to install FreeCAD
3. https://github.com/jmwright/cadquery-gui, which will allow visualization of workplanes
Expand All @@ -269,4 +300,3 @@ If you are familiar with how jQuery, you will probably recognize several jQuery
*
* Ability to use the library along side other python libraries
* Clear and complete documentation, with plenty of samples.

34 changes: 34 additions & 0 deletions build_docker.sh
@@ -0,0 +1,34 @@
#!/bin/bash
set -e

#builds and tests the docker image
docker build -t dcowden/cadquery .

# set up tests
CQ_TEST_DIR=/tmp/cq_docker-test
mkdir -p $CQ_TEST_DIR
rm -rf $CQ_TEST_DIR/*.*
cp examples/FreeCAD/Ex001_Simple_Block.py $CQ_TEST_DIR


fail_test( ){
"Test Failed."
}

echo "Running Tests..."
echo "No arguments prints documentation..."
docker run dcowden/cadquery | grep "CadQuery Docker Image" || fail_test
echo "OK"

echo "Std in and stdout..."
cat $CQ_TEST_DIR/Ex001_Simple_Block.py | docker run -i dcowden/cadquery build --in_spec stdin --out_spec stdout | grep "ISO-10303-21" || fail_test
echo "OK"

echo "Mount a directory and produce output..."
docker run -i -v $CQ_TEST_DIR:/home/cq dcowden/cadquery build --in_spec Ex001_Simple_Block.py --format STEP
ls $CQ_TEST_DIR | grep "cqobject-1.STEP" || fail_test
echo "OK"

echo "Future Server EntryPoint"
docker run -i dcowden/cadquery runserver | grep "Future CadQuery Server" || fail_test
echo "OK"
28 changes: 22 additions & 6 deletions cq_cmd.sh
Expand Up @@ -7,12 +7,28 @@
# to select between running a build server
# and a command line job runner
if [ -z "$1" ]; then
echo "Usage: docker run cadquery build|server [options]"
exit(1)
echo "************************"
echo "CadQuery Docker Image"
echo "************************"
echo "Usage: docker run cadquery build [options]"
echo "Examples:"
echo " Read a model from stdin, write output to stdout"
echo ""
echo " cat cadquery_script.py | sudo docker run -i dcowden/cadquery:latest --in_spec stdin --out_spec stdout > my_object.STEP"
echo " "
echo " Mount a directory, and write results into the local directory"
echo ""
echo " sudo docker run -i dcowden/cadquery:latest --in_spec my_script.py"
echo ""
exec python -u /opt/cadquery/cq_cmd.py -h
exit 1
fi;
if [ "$1" == "build"]; then
exec python -u /opt/cadquery/cq_cmd.py "$@"
if [ "$1" == "build" ]; then
echo "Launching python with arguments ${@:2}"
exec python -u /opt/cadquery/cq_cmd.py "${@:2}"
fi;
if [ "$1" == "runserver"]; then
exec python -u /opt/cadquery/cq_server.py "$@"
if [ "$1" == "runserver" ]; then
echo "Future CadQuery Server"
exit 1
#exec python -u /opt/cadquery/cq_server.py "${@:2}"
fi;

0 comments on commit 73c82db

Please sign in to comment.