CadQuery / cadquery-plugins

A collection of community contributed plugins that extend the functionality of CadQuery
Apache License 2.0
36 stars 15 forks source link

cadquery-plugins

Tests Lint

cadquery-plugins is a collection of community contributed plugins that extend the functionality of CadQuery. A description of each of the included plugins can be found in the Plugins documentation. This documentation only includes plugins that have been accepted into this repository by the core CadQuery development team. Installation of third-party plugins from other sources is also possible, but extra care must be taken by the user to ensure that the plugins are safe to use. A list of third-party plugins that meet a minimum criteria of quality are included in the Third-Party Plugins documentation.

Installing Plugins

Each plugin should have installation instructions in its readme, but in general it should be possible to install each of the plugins in this repository using the following form.

pip install -e "git+https://github.com/CadQuery/cadquery-plugins.git#egg=[the plugin name]&subdirectory=plugins/[the plugin name]"

Using Plugins

Plugins should automatically monkey-path or otherwise make their functions available when an import is done. Using the included sampleplugin as an example, the following code gives the general method, assuming that the plugin has been installed using pip.

import cadquery as cq
import sampleplugin # Includes the new make_cubes function

result = (cq.Workplane().rect(50, 50, forConstruction=True)
                        .vertices()
                        .make_cubes(10))

Contributing

You will need to set up an Anaconda environment to build and test your plugins before submitting them. If you need full instructions on installing CadQuery with Anaconda, please see the CadQuery readme. Otherwise, run the following in a fresh Anaconda environment:

conda install -c conda-forge -c cadquery cadquery=master pytest

There is a sample plugin directory called sampleplugin that you can copy and rename. Be sure that you are choosing a unique name that is not already part of the Workplane class. Plugins can use monkey patching, and if your plugin causes a naming conflict it can override existing behavior and your contribution will not be accepted.

Once you have renamed the sampleplugin directory, you can then add your plugin code to that directory. In general, these are the steps for adding your plugin to this plugins repository.

Considerations