make pip installer

This commit is contained in:
Dave Cowden 2013-04-23 21:31:56 -04:00
parent 977eb08657
commit 5c763c8f9e
14 changed files with 123 additions and 805 deletions

20
MANIFEST Normal file
View File

@ -0,0 +1,20 @@
README.txt
setup.cfg
setup.py
cadquery\CQ.py
cadquery\__init__.py
cadquery\cq_directive.py
cadquery\selectors.py
cadquery\workplane.py
cadquery\contrib\__init__.py
cadquery\freecad_impl\__init__.py
cadquery\freecad_impl\exporters.py
cadquery\freecad_impl\geom.py
cadquery\freecad_impl\shapes.py
cadquery\plugins\__init__.py
tests\TestCQSelectors.py
tests\TestCadObjects.py
tests\TestCadQuery.py
tests\TestExporters.py
tests\TestWorkplanes.py
tests\__init__.py

View File

@ -1 +0,0 @@
recursive-exclude tests *

View File

@ -12,6 +12,23 @@ 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.
Installing
============
1. install FreeCAD, version 0.12 or greater for your platform. http://sourceforge.net/projects/free-cad/
2. install::
pip install cadquery
3. test your installation::
from cadquery import *
box = Workplane("XY").box(1,2,3)
exporters.toString(box,'STL')
You're up and running!
Why CadQuery instead of OpenSCAD?
========================================
@ -50,4 +67,5 @@ If you are familiar with how jQuery, you will probably recognize several jQuery
* Language features that make selection and iteration incredibly easy
*
* Ability to use the library along side other python libraries
* Clear and complete documentation, with plenty of samples.
* Clear and complete documentation, with plenty of samples.

71
README.txt Normal file
View File

@ -0,0 +1,71 @@
What is a CadQuery?
========================================
CadQuery is an intuitive, easy-to-use python based language for building parametric 3D CAD models. CadQuery is for 3D CAD what jQuery is for javascript. Imagine selecting Faces of a 3d object the same way you select DOM objects with JQuery!
CadQuery has several goals:
* Build models with scripts that are as close as possible to how you'd describe the object to a human.
* Create parametric models that can be very easily customized by end users
* Output high quality CAD formats like STEP and AMF in addition to traditional STL
* Provide a non-proprietary, plain text model format that can be edited and executed with only a web browser
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.
Installing
============
1. install FreeCAD, version 0.12 or greater for your platform. http://sourceforge.net/projects/free-cad/
2. install::
pip install cadquery
3. test your installation::
from cadquery import *
box = Workplane("XY").box(1,2,3)
exporters.toString(box,'STL')
You're up and running!
Why CadQuery instead of OpenSCAD?
========================================
CadQuery is based on OpenCasCade. CadQuery shares many features with OpenSCAD, another open source, script based, parametric model generator.
The primary advantage of OpenSCAD is the large number of already existing model libaries that exist already. So why not simply use OpenSCAD?
CadQuery scripts have several key advantages over OpenSCAD:
1. **The scripts use a standard programming language**, python, and thus can benefit from the associated infrastructure.
This includes many standard libraries and IDEs
2. **More powerful CAD kernel** OpenCascade is much more powerful than CGAL. Features supported natively
by OCC include NURBS, splines, surface sewing, STL repair, STEP import/export, and other complex operations,
in addition to the standard CSG operations supported by CGAL
3. **Ability to import/export STEP** We think the ability to begin with a STEP model, created in a CAD package,
and then add parametric features is key. This is possible in OpenSCAD using STL, but STL is a lossy format
4. **Less Code and easier scripting** CadQuery scripts require less code to create most objects, because it is possible to locate
features based on the position of other features, workplanes, vertices, etc.
5. **Better Performance** CadQuery scripts can build STL, STEP, and AMF faster than OpenSCAD.
Where does the name CadQuery come from?
========================================
CadQuery is inspired by ( `jQuery <http://www.jquery.com>`_ ), a popular framework that
revolutionized web development involving javascript.
If you are familiar with how jQuery, you will probably recognize several jQuery features that CadQuery uses:
* A fluent api to create clean, easy to read code
* Language features that make selection and iteration incredibly easy
*
* Ability to use the library along side other python libraries
* Clear and complete documentation, with plenty of samples.

View File

@ -21,7 +21,7 @@
"""
import cadquery
import FreeCAD,tempfile,os
import FreeCAD,tempfile,os,StringIO
from FreeCAD import Drawing
try:
@ -41,6 +41,11 @@ class UNITS:
IN = "in"
def toString(shape,exportType,tolerance=0.1):
s= StringIO.StringIO()
exportShape(shape,exportType,s,tolerance)
return s.getvalue()
def exportShape(shape,exportType,fileLike,tolerance=0.1):
"""
:param shape: the shape to export. it can be a shape object, or a cadquery object. If a cadquery

View File

@ -1,178 +0,0 @@
.. _extending:
******************
Extending CadQuery
******************
.. automodule:: cadfile.cadutils.cadquery
If you find that CadQuery doesnt suit your needs, you can easily extend it. CadQuery provides several extension
methods:
* You can load plugins others have developed. This is by far the easiest way to access other code
* you can define your own plugins.
* you can use FreeCAD script directly
Loading external Plugins
-----------------------
You can load a plugin using the tools.loadScript(*URL*) directive in your script.
Using FreeCAD Script
--------------------
The easiest way to extend CadQuery is to simply use FreeCAD script inside of your build method. Just about
any valid FreeCAD script will execute just fine. For example, this simple CadQuery script::
return Workplane("XY").box(1.0,2.0,3.0).val()
is actually equivalent to::
return Part.makeBox(1.0,2.0,3.0)
As long as you return a valid FreeCAD Shape, you can use any FreeCAD methods you like. You can even mix and match the
two. For example, consider this script, which creates a FreeCAD box, but then uses cadquery to select its faces::
box = Part.makeBox(1.0,2.0,3.0)
cq = CQ(box).faces(">Z").size() # returns 6
Extending CadQuery: Plugins
----------------------------
Though you can get a lot done with FreeCAD, the code gets pretty nasty in a hurry. CadQuery shields you from
a lot of the complexity of the FreeCAD api.
You can get the best of both worlds by wrapping your freecad script into a CadQuery plugin.
A CadQuery plugin is simply a function that is attached to the CadQuery :py:meth:`CQ` or :py:meth:`Workplane` class.
When connected, your plugin can be used in the chain just like the built-in functions.
There are a few key concepts important to understand when building a plugin
The Stack
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Every CadQuery object has a local stack, which contains a list of items. The items on the stack will be
one of these types:
* **A CadQuery SolidReference object**, which holds a reference to a FreeCAD solid
* **A FreeCAD object**, a Vertex, Edge, Wire, Face, Shell, Solid, or Compound
The stack is available by using self.objects, and will always contain at least one object.
.. note::
Objects and points on the stack are **always** in global coordinates. Similarly, any objects you
create must be created in terms of global coordinates as well!
Preserving the Chain
^^^^^^^^^^^^^^^^^^^^^^^^^
CadQuery's fluent api relies on the ability to chain calls together one after another. For this to work,
you must return a valid CadQuery object as a return value. If you choose not to return a CadQuery object,
then your plugin will end the chain. Sometimes this is desired for example :py:meth:`CQ.size`
There are two ways you can safely continue the chain:
1. **return self** If you simply wish to modify the stack contents, you can simply return a reference to
self. This approach is destructive, because the contents of the stack are modified, but it is also the
simplest.
2. :py:meth:`CQ.newObject` Most of the time, you will want to return a new object. Using newObject will
return a new CQ or Workplane object having the stack you specify, and will link this object to the
previous one. This preserves the original object and its stack.
Helper Methods
^^^^^^^^^^^^^^^^^^^^^^^^^
When you implement a CadQuery plugin, you are extending CadQuery's base objects. As a result, you can call any
CadQuery or Workplane methods from inside of your extension. You can also call a number of internal methods that
are designed to aid in plugin creation:
* :py:meth:`Workplane._pointsOnStack` returns a FreeCAD Vector ( a point ) for each item on the stack. Useful if you
are writing a plugin that you'd like to operate on all values on the stack, like :py:meth:`Workplane.circle` and
most other built-ins do
* :py:meth:`Workplane._makeWireAtPoints` will invoke a factory function you supply for all points on the stack,
and return a properly constructed cadquery object. This function takes care of registering wires for you
and everything like that
* :py:meth:`Workplane.newObject` returns a new Workplane object with the provided stack, and with its parent set
to the current object. The preferred way to continue the chain
* :py:meth:`Workplane.findSolid` returns the first Solid found in the chain, working from the current object upwards
in the chain. commonly used when your plugin will modify an existing solid, or needs to create objects and
then combine them onto the 'main' part that is in progress
* :py:meth:`Workplane._addWire` must be called if you add a wire. This allows the base class to track all the wires
that are created, so that they can be managed when extrusion occurs.
* :py:meth:`Workplane.wire` gathers up all of the edges that have been drawn ( eg, by line, vline, etc ), and
attempts to combine them into a single wire, which is returned. This should be used when your plugin creates
2-d edges, and you know it is time to collect them into a single wire.
* :py:meth:`Workplane.plane` provides a reference to the workplane, which allows you to convert between workplane
coordinates and global coordinates:
* :py:meth:`Plane.toWorldCoords` will convert local coordinates to global ones
* :py:meth:`Plane.toLocalCoords` will convet from global coordinates to local coordinates
Coordinate Systems
^^^^^^^^^^^^^^^^^^^^^^
Keep in mind that the user may be using a work plane that has created a local coordinate system. Consequently,
the orientation of shapes that you create are often implicitly defined by the user's workplane.
Any objects that you create must be fully defined in *global coordinates*, even though some or all of the users'
inputs may be defined in terms of local coordinates.
Linking in your plugin
^^^^^^^^^^^^^^^^^^^^^^^
Your plugin is a single method, which is attached to the main Workplane or CadQuery object.
Your plugin method's first parameter should be 'self', which will provide a reference to base class functionality.
You can also accept other arguments.
To install it, simply attach it to the CadQuery or Workplane object, like this::
def _yourFunction(self,arg1,arg):
do stuff
return whatever_you_want
Workplane.yourPlugin = _yourFunction
That's it!
Plugin Example
^^^^^^^^^^^^^^^
This ultra simple plugin makes cubes of the specified size for each stack point.
(The cubes are off-center because the boxes have their lower left corner at the reference points.)
.. cq_plot::
def makeCubes(self,length):
#self refers to the CQ or Workplane object
#inner method that creates a cube
def _singleCube(pnt):
#pnt is a location in local coordinates
#since we're using eachpoint with useLocalCoordinates=True
return Solid.makeBox(length,length,length,pnt)
#use CQ utility method to iterate over the stack, call our
#method, and convert to/from local coordinates.
return self.eachpoint(_singleCube,True)
#link the plugin into cadQuery
Workplane.makeCubes = makeCubes
#use the plugin
result = Workplane("XY").box(6.0,8.0,0.5).faces(">Z").rect(4.0,4.0,forConstruction=True).vertices() \
.makeCubes(1.0).combineSolids()

View File

@ -1,202 +0,0 @@
.. _cadquery_reference:
********************************
ModelScript Format Reference
********************************
ParametricParts ModelScripts define a parametric 3D model that can be executed and customized by an end user.
CadQuery scripts are pure python scripts that follow a standard format. Each script contains these main components:
:MetaData:
*(Mandatory)* Defines the attributes that describe the model, such as version and unit of measure
:Parameters:
*(Optional)* Defines parameters and their default values, which can be
manipulated by users to customize the object. Parameters are defined by creating local variables
of a particular class type. Presets and groups organize parameters to make them easier to use
:build script:
*(Mandatory)* Constructs the model once parameter values are collected and the model is validated.
The script must return a solid object, or a cadquery solid
The Script Life-cycle
----------------------
CadQuery scripts have the following lifecycle when they are executed by a user via the web interface:
1. **Load Script** If it is valid, the parameters and MetaData
are loaded. A number of special objects are automatically available to your script
2. **Display Model to User** The parameters and default values are displayed to the user.
The model is rendered and displayed to the user using the default values
3. **User selects new parameter values** , either by selecting
preset combinations, or by providing values for each parameter
4. **Build the model** If validation is successful, the model is re-built, and the preview window is updated
5. **User downloads** If the user chooses to download the model as STL, STEP, or AMF, the model is re-built
again for download.
A Full Example Script
----------------------
This script demonstrates all of the model elements available. Each is briefly introduced in the sample text,
and then described in more detail after the sample::
"""
Comments and Copyright Statement
"""
#
# metadata describes your model
#
UOM = "mm"
VERSION = 1.0
#
# parameter definitions. Valid parameter types are FloatParam,IntParam,and BooleanParam
# each paraemter can have min and max values, a description, and a set of named preset values
#
p_diam = FloatParam(min=1.0,max=500.0,presets={'default':40.0,'small':2.0,'big':200.0},group="Basics", desc="Diameter");
#
# build the model based on user selected parameter values.
# Must return a FreeCAD solid before exiting.
#
def build():
return Part.makeSphere(p_diam.value);
Each section of the script is described in more detail below
Metadata
----------------
Model metadata is provided by setting a dictionary variable called METADATA in the script. You can provide
any metadata you choose, but only these values are currently used:
:UOM:
The unit of measure of your model. in and mm are common values, but others are allowed.
Some model formats like AMF can accept units of measure, which streamlines the printing process. **[OPTIONAL]**
:VERSION:
The script format version. Valid versions are established by ParametricParts, currently only version 1.0 is
valid. If omitted, the latest version is assumed. **[OPTIONAL]**
Other metadata fields may be added in the future.
Parameters
----------------
Model parameters provide the flexibility users need to customize your model. Parameters are optional, but most
users will expect at least a couple of parameters for your model to qualify as 'parametric'.
Parameters can be named whatever you would like. By convention, it is common to name them *p_<name>*, indicating
"parameter".
Each parameter has a particular type ( Float, Integer, Boolean ). Parameters also have optional attributes, which are
provided as keyword arguments:
:desc:
A description of the parameter, displayed to the user if help is needed [Optional]
:min:
The minimum value ( not applicable to Boolean ) [Optional]
:max:
The maximum value ( not applicable to Boolean ) [Optional]
:presets:
A dictionary containing key-value pairs. Each key is the name of a preset, and the value is the value the
parameter will take when the preset is selected by the user.
When a model defines presets, the user is presented with a choice of available presets in a drop-down-list.
Selecting a preset changes the values of all parameters to their associated values.
If it exists, the special preset named 'default' will be used to populate the default values when the user
is initially presented with the model.
When the model is built, the parameters are checked to ensure they meet the constraints. If they do not,
an error occurs.
:group:
If provided, parameters will be grouped together when displayed to the user. Any ungrouped parameters
will display in a special group named `default`. Groups help divide a long list of parameters to make
them easier to understand. Examples might include 'basics' and 'advanced'
Build Method
-----------------------
The heart of your model is the build method. Your build method must be called 'build'::
def build():
return Workplane("XY").box(1,1,1)
Your build method use any combination of FreeCAD, python, and CadQuery to construct objects.
You must return one of two things:
1. A CadQuery object, or
2. A FreeCAD object
In your build script,you retrieve the values of the parameters by using ``<parameter_name>.value``.
The following modules are available when your script runs:
Scripts Using CadQuery Syntax
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:python syntax:
Python loops, dictionaries, lists, and other standard language structures are available.
:math:
Python's math package is imported for you to use
:FloatParam,IntegerParam,BooleanParam:
Parameter types used to declare parameters
:Workplane:
The CadQuery workplane object, which is the typical starting point for most scripts
:CQ:
The CadQuery object, in case you need to decorate a normal FreeCAD object
:Plane:
The CadQuery Plane object, in case you need to create non-standard planes
.. warning::
Though your script is a standard python script, it does **not** run in a standard python environment.
For security reasons, most python packages, like sys, os, import, and urllib are restricted.
FreeCAD Build Scripts
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It is recommended that you use CadQuery for your model scripts-- the syntax is much shorter and more convienient.
But if you are willing to write more code, you can get access to all of the features that the FreeCAD library provides.
When your script executes, these FreeCAD objects are in scope as well:
:Part:
FreeCAD.Part
:Vector:
FreeCAD.Base.Vector
:Base:
FreeCAD.Base
**If you use a FreeCAD build script, your build method must return a FreeCAD shape object.**
Should you choose to write your model with the lower-level FreeCAD scripts, you may find this documentation useful:
http://sourceforge.net/apps/mediawiki/free-cad/index.php?title=FreeCAD_API

View File

@ -1,9 +0,0 @@
.. _3d_cad_primer:
***********************
3D CAD Primer
***********************
This section provides a basic introduction to 3D modeling. It will get you started with the basics. After that,
you may want to do some heavier reading on the subject (PUT LINKS HERE )

View File

@ -1,57 +0,0 @@
.. _primreference:
***********************
Primitive Class Reference
***********************
.. automodule:: cadfile.cadutils.cad
.. autosummary::
Plane
Vector
Solid
Shell
Wire
Edge
Vertex
Geometry Classes
------------------
.. autoclass:: Vector
:members:
.. autoclass:: Plane
:members:
Shape Base Class
-------------------
All objects inherit from Shape, which as basic manipulation methods:
.. autoclass:: Shape
:members:
Primitive Classes
--------------------
.. autoclass:: Solid
:members:
.. autoclass:: Shell
:members:
.. autoclass:: Wire
:members:
.. autoclass:: Edge
:members:
.. autoclass:: Vertex
:members:

View File

@ -1,114 +0,0 @@
.. _buildservice:
******************************************
The Parametric Parts Build Service
******************************************
If you have registered for an account, you can use the REST api to build models from your website or platform.
Each request to the service will construct a model in the format you choose.
Using the Build Service
-------------------------
The Build Service endpoint is `<https://parametricparts.com/parts/build>`_
In each request, you provide four main things via either a GET or a POST :
1. **An API Key**, to identify yourself.
2. **A ModelScript to build**, either by providing the entire script, or the id of a model stored on
parametricparts.com,
3. **The type of output** you want,
4. **The Model parameters** that should be supplied to the model.
.. note::
GET or POSTs are allowed, but be aware that URLs for GET requests are limited to 4K,
so POSTs are advised if you are sending your modelScript via the URL
The output streamed in the format you have requested.
Errors are provided using standard HTTP error codes:
:200: if the build is a success
:403: if the APIKey is invalid, or if your account cannot execute any more downloads
:404: if the requested model cannot be found
:50X: if there is a problem generating the model
Build Service Parameters
--------------------------
All parameters must be URL encoded:
:key:
(Required) Your API Key. See :ref:`gettingakey` If you do not have one.
:id:
(Either id or s is Required) The id of the ParametricParts.com ModelScript to build. The id is the last part of the url
when viewing the model: http://parametricparts.com/parts/<modelId>. Model ids are between 7 and 9
characters, for example '4hskpb69'.
:s:
(Either id or s is Required) The ModelScript to build. This should be a valid parametricparts.com ModelScript.
If both id and s are provided, s takes precedence.
:type:
(Required) ("STL" | "STEP" | "AMF" | "TJS" ). The type of output you want to receive. STL, STEP,
and AMF return the corresponding industry standard format.
TJS will return JSON content suitable for display in a Three.js scene.
:preset:
(Optional) The name of a preset defined in the ModelScript. If omitted, other parameters are used.
If a preset is provided in addition to parameters, then the preset is applied first, and then
parameters are set afterwards.
:<params>:
(Optional) Remaining URL parameters are mapped onto ModelScript parameters of the same name. Each
parameter value must have the datatype corresponding to the parameter in the ModelScript. To supply multiple
parameters, send an HTTP parameter for each desired value, having name matching the name of the ModelScript
parameter, and value having the value for that parameter. If no
parameters are provided, output is generated using ModelScript defaults.
Example
--------------------------
This example builds STEP for a trivial model, without supplying any model parameters or presets::
POST https://parametricparts.com/parts/build HTTP/1.1
key:259cd575c9a2998420ac65f21b2d6b2a
s:def+build%28%29%3A%0D%0A++++return+Part.makeBox%281%2C2%2C3%29%0D%0A++++++++
type:AMF
This example selects an existing model (2qus7a32 ) on the server, and requests
preset 'short', as well as adjusting parameter 'p_length' to value 120::
POST https://parametricparts.com/parts/build HTTP/1.1
key:259cd575c9a2998420ac65f21b2d6b2a
id:2qus7a32
type:STL
preset:short
p_length:120
.. _gettingakey:
Signing Up
-----------------------
In order to use the API, you first need to have an API key. To get one:
1. `Sign Up <https://parametricparts.com/account/signup>`_ for a ParametricParts account
2. `Contact ParametricParts Support <http://support.parametricparts.com/customer/portal/emails/new>`_ to request API key access.
API keys usually require an enterprise license, but are available for free evaluation if you request access
3. Log onto your ParametricParts account, and generate an API Key using the `API Keys <https://localhost:8080/key/keys>`_ link.
4. Test your api key using the api key tester `Here <https://parametricparts.com/apitester>`_
If the test goes well, you'll see STL output from the sample script.
Now you are ready to make REST requests to build models.
.. warning::
Make sure to keep your API Key secret, as any requests that use your key will be charged to your account.
You can disable or generate a new API Key from your account page.

View File

@ -1,172 +0,0 @@
.. _roadmap:
**************************
RoadMap: Planned Features
**************************
**CadQuery is not even close to finished!!!**
Many features are planned for later versions. This page tracks them. If you find that you need features
not listed here, let us know!
Core
--------------------
end(n)
allows moving backwards a fixed number of parents in the chain, eg end(3) is same as end().end().end()
FreeCAD object wrappers
return CQ wrappers for FreeCAD shapes instead of the native FreeCAD objects.
Improved iteration tools for plugin developers
make it easier to iterate over points and wires for plugins
More parameter types (String? )
face.outerWire
allow selecting the outerWire of a face, so that it can be used for reference geometry or offsets
Selectors
--------------------
Chained Selectors
Space delimited selectors should be unioned to allow multiple selections. For example ">Z >X"
Ad-hoc axes
for example, >(1,2,1) would select a face with normal in the 1,2,1 direction
logic inversion
! or not to invert logic, such as "!(>Z)" to select faces _other_ than the most z facing
closest to point
support faces, points, or edges closest to a provided point
tagged entities
support tagging entities when they are created, so they can be selected later on using that tag.
ideally, tags are propagated to features that are created from these features ( ie, an edge tagged with 'foo'
that is later extruded into a face means that face would be tagged with 'foo' as well )
Workplanes
--------------------
rotated workplanes
support creation of workplanes at an angle to another plane or face
workplane local rotations
rotate the coordinate system of a workplane by an angle.
make a workplane from a wire
useful to select outer wire and then operate from there, to allow offsets
2-d operations
-------------------
offsets
offset profiles, including circles, rects, and other profiles.
ellipses
create elipses and portions of elipses
regular polygons
several construction methods:
* number of sides and side length
* number of sides inscribed in circle
* number of sides circumscribed by circle
arc construction using relative measures
instead of forcing use of absolute workplane coordinates
tangent arcs
after a line
centerpoint arcs
including portions of arcs as well as with end points specified
trimming
ability to use construction geometry to trim other entities
construction lines
especially centerlines
2-d fillets
for a rectangle, or for consecutive selected lines
2-d chamfers
based on rectangles, polygons, polylines, or adjacent selected lines
mirror around centerline
using centerline construction geometry
rectangular array
automate creation of equally spread points
polar array
create equally spaced copies of a feature around a circle
perhaps based on a construction circle?
midpoint selection
select midpoints of lines, arcs
face center
explicit selection of face center
manipulate spline control points
so that the shape of a spline can be more accurately controlled
feature snap
project geometry in the rest of the part into the work plane, so that
they can be selected and used as references for other features.
polyline edges
allow polyline to be combined with other edges/curves
create text
ideally, in various fonts.
3-d operations
---------------------
rotation/transform that return a copy
The current rotateAboutCenter and translate method modify the object, rather than returning a copy
primitive creation
Need primitive creation for:
* cone
* sphere
* cylinder
* torus
* wedge
extrude/cut up to surface
allow a cut or extrude to terminate at another surface ,rather than either through all or a fixed distance
extrude along a path
rather than just normal to the plane. This would include
loft
create a feature between two or more wire sections
revolve
revolve a wire around an axis to create a solid
STEP import
allow embedding and importing step solids created in other tools, which
can then be further manipulated parametrically
Dome
very difficult to do otherwise
primitive boolean operations
* intersect
* union
* subtract
Algorithms
---------------------
Wire Discretization
Sample wires at point interval to improve closet wire computations

View File

@ -1,22 +1,19 @@
from distutils.core import setup
setup(
name='cadquery',
version=get_version(),
version='0.1.2',
url='https://github.com/dcowden/cadquery',
license='LGPL',
author='David Cowden',
author_email='dave.cowden@gmail.com',
description='CadQuery is a parametric scripting language for creating and traversing CAD models',
long_description=__doc__,
packages=find_packages(),
long_description=open('README.txt').read(),
packages=['cadquery','cadquery.contrib','cadquery.freecad_impl','cadquery.plugins','tests'],
include_package_data=True,
zip_safe=False,
platforms='any',
install_requires=['FreeCAD'], #how to list FreeCAD here?
#entry_points='''\
#[console_scripts]
##rqworker = rq.scripts.rqworker:main
#rqinfo = rq.scripts.rqinfo:main
#''',
classifiers=[
# As from http://pypi.python.org/pypi?%3Aaction=list_classifiers
#'Development Status :: 1 - Planning',
@ -31,7 +28,7 @@ setup(
'Intended Audience :: Information Technology',
'Intended Audience :: Science/Research',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: LGPL License',
'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)',
'Operating System :: POSIX',
'Operating System :: MacOS',
'Operating System :: Unix',

View File

@ -1,44 +0,0 @@
import unittest
from JsonUtils import JsonMesh
import FreeCAD
from FreeCAD import Part
from FreeCAD import Vector
"""
WARNING: set FREECAD_HOME for these tests to work!
"""
class TestJSonModel(unittest.TestCase):
def setUp(self):
self.mesh = JsonMesh();
def testOneFace(self):
mesh = self.mesh;
mesh.addVertex(0.0,0.0,0.0);
mesh.addVertex(1.0,1.0,0.0);
mesh.addVertex(-1.0,1.0,0);
mesh.addTriangleFace(0, 1, 2);
self.assertEqual(3*3,len(mesh.vertices));
self.assertEqual(1+3,len(mesh.faces));
def testSphere(self):
#make a sphere
p = Part.makeSphere(2.0);
t = p.tessellate(0.01); #a pretty fine mesh
#add vertices
for vec in t[0]:
self.mesh.addVertex(vec.x, vec.y, vec.z);
#add faces
for f in t[1]:
self.mesh.addTriangleFace(f[0],f[1], f[2]);
#make resulting json
self.mesh.buildTime = 0.1;
js = self.mesh.toJson();
#make sure the mesh has like >1000 vertices
self.assertTrue(self.mesh.nVertices > 1000);
self.assertTrue(self.mesh.nFaces > 1000);

View File

@ -1,16 +0,0 @@
__author__ = 'dcowden'
from cadquery import *
import unittest,sys
from tests import MakeTestObjects
import SVGexporter
class TestCadQuery(unittest.TestCase):
def setUp(self):
pass
def testExport(self):
t = MakeTestObjects.makeCube(20)
SVGexporter.exportSVG(t,'c:/temp/test.svg')