Skip to content

Commit

Permalink
Updated documentation and fixed lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ioannam committed Mar 11, 2024
1 parent c2a6190 commit 1f5109f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 82 deletions.
75 changes: 6 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,86 +5,23 @@
[![PyPI - Latest Release](https://img.shields.io/pypi/v/COMPAS-SLICER.svg)](https://pypi.python.org/project/COMPAS-SLICER)
[![DOI](https://zenodo.org/badge/226364384.svg)](https://zenodo.org/badge/latestdoi/226364384)



Slicing package for FDM 3D Printing with COMPAS.

Python slicing package for FDM 3D Printing based on the [COMPAS](https://block.arch.ethz.ch/brg/tools/compas-computational-framework-for-collaboration-and-research-in-architecture-structures-and-digital-fabrication) framework.

## Main features

* Planar slicing (default method, and method based on Cgal library)
* Curved slicing (interpolation of boundaries, UV slicing, scalar field slicing)
* Generation of fabrication-related information
* Export print data to Json and gcode formats
* Export print data to Json and gcode format
* Visualization of results in grasshopper

## Getting started

### Step 1: Installation

The recommended way to install `compas_slicer` is with [conda](https://conda.io/docs/).
For example, create an environment named ``my-project`` (or replace with your own environment name) and install as follows:

conda config --add channels conda-forge
conda create -n my-project compas_slicer

### Step 2: Optional installation steps

#### COMPAS Viewers

Follow the instructions to install `compas_view2` (https://github.com/compas-dev/compas_view2).

#### COMPAS CGAL (for planar slicing)

conda install -n my-project compas_cgal

#### LIBIGL python bindings (for curved slicing)

conda install -c conda-forge igl

#### Grasshopper

The Grasshopper components are automatically installed with the `compas_rhino` installation, e.g.:

conda activate my-project
python -m compas_rhino.install -v 6.0

### Step 3. Test if the library works

Activate your environment and run the following command:

conda activate my-project
python -m compas_slicer

Enjoy!

## Troubleshooting

See here: https://compas.dev/compas_slicer/installation.html#troubleshooting-1

## Contributions

Before contributing code:

- Install development dependencies:
```bash
pip install -r requirements-dev.txt
```

- Make sure all tests pass:
```bash
invoke test
```

- Make sure you pass flake8 tests. (hint: This is the most annoying part of the process)
```bash
invoke lint
```

- Add an example on the examples folder that uses the new functionality. Run the example and make sure it works smoothly.
You can find tutorials and documentation of the project in the [compas_slicer page](https://compas.dev/compas_slicer/latest/)

- Create a pull request for the master branch, where you explain in detail what you fixed. When you create a pull request, there is an automatic action that runs the tests for your code again on the server.
Make sure the pull request passes the automatic tests as well. If not, then inspect the result, find what went wrong, fix it, and push again the result on your branch. The action will run again automatically on the open pull request.
For installation instructions, see here: [installation](https://compas.dev/compas_slicer/latest/installation.html)

For troubleshooting, see here: [troubleshooting](https://compas.dev/compas_slicer/installation.html#troubleshooting-1)

## Authors

Expand Down
37 changes: 33 additions & 4 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ COMPAS_SLICER can be easily installed on multiple platforms.
Basic installation steps
========================

Step 1: Install compas slicer
Install compas slicer
-----------------------------


Expand All @@ -32,7 +32,7 @@ For example, create an environment named ``my-project`` (or replace with your ow
conda install -c conda-forge compas_cgal
* Grasshopper
* Install Grasshopper components

The Grasshopper components are automatically installed with the `compas_rhino` installation, e.g.:

Expand All @@ -42,8 +42,7 @@ The Grasshopper components are automatically installed with the `compas_rhino` i
python -m compas_rhino.install -v 7.0
Step 4. Test if the library works
---------------------------------
* Test if the library works

Activate your environment and run the following command:

Expand All @@ -55,6 +54,36 @@ Activate your environment and run the following command:
Enjoy!



Contributions
===============

Before contributing code:

- Install development dependencies:

.. code-block:: bash
pip install -r requirements-dev.txt
- Make sure all tests pass:
.. code-block:: bash
invoke test
- Make sure you pass flake8 tests. (hint: This is the most annoying part of the process)
.. code-block:: bash
invoke lint
- Add your code in the appropriate folder. If you are not sure where to put it, contact [@ioannaMitropoulou](https://github.com/ioannaMitropoulou).

- Add an example on the examples folder that uses the new functionality. Run the example and make sure it works smoothly.

- Add your name to the authors in README.md.

- Create a pull request for the master branch, where you explain in detail what you fixed. When you create a pull request, there is an automatic action that runs the tests for your code again on the server.
Make sure the pull request passes the automatic tests as well. If not, then inspect the result, find what went wrong, fix it, and push again the result on your branch. The action will run again automatically on the open pull request.



Troubleshooting
===============

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import compas_slicer
import logging
from compas.geometry import Vector, Polyline, distance_point_point, norm_vector, normalize_vector, subtract_vectors, \
from compas.geometry import Vector, distance_point_point, norm_vector, normalize_vector, subtract_vectors, \
cross_vectors, scale_vector
from compas.utilities import pairwise
import numpy as np
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, slicer, parameters, DATA_PATH):
if len(self.vertical_layers) > 1:
try:
self.topological_sorting()
except AssertionError as e:
except AssertionError:
logger.exception("topology sorting failed\n")
logger.critical("integrity of the output data ")
# TODO: perhaps its better to be even more explicit and add a
Expand Down Expand Up @@ -89,13 +89,11 @@ def create_base_boundaries(self):
else:
bs.append(root_boundary)
else:
logger.critical("""no topology graph was created, no base boundaries created,
output will be degenerated.
a likely cause for topology sorting to fail is that
non-continuous paths were created. When creating paths with variable
layer heights, it may very well be that the non-continuous paths are
created, while this is not yet a supported feature""")
logger.critical("""no topology graph was created, no base boundaries created,
output will be degenerated. A likely cause for topology sorting to fail is that
non-continuous paths were created. When creating paths with variable
layer heights, it may very well be that the non-continuous paths are
created, while this is not yet a supported feature""")

# save intermediary outputs
b_data = {i: b.to_data() for i, b in enumerate(bs)}
Expand Down

0 comments on commit 1f5109f

Please sign in to comment.