Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ioannam committed Mar 11, 2024
1 parent c61095a commit 2fd7f61
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 80 deletions.
7 changes: 3 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ Overview

.. rst-class:: lead

**COMPAS_SLICER is a slicing package for FDM 3D Printing using COMPAS.**
Currently, COMPAS_SLICER only supports Robotic FDM 3D Printing processes,
but this will be extended in the future. The package builds upon
**COMPAS_SLICER is a slicing package for FDM 3D Printing using COMPAS.**
The package builds upon
`COMPAS <https://compas.dev/>`_, an open-source Python-based framework for
collaboration and research in architecture, engineering and digital fabrication.

.. note::

COMPAS_SLICER is still in a very early, pre-release state and therefore could
COMPAS_SLICER is a collaborative research project and therefore could
contain bugs. In case you find bugs or would like to request additional
functionality, please submit an issue using the
`Issue Tracker <https://github.com/compas-dev/compas_slicer/issues>`_.
Expand Down
14 changes: 7 additions & 7 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ For example, create an environment named ``my-project`` (or replace with your ow
conda config --add channels conda-forge
conda create -n my-project compas_slicer
conda activate my-project
Step 2: Optional installation steps
-----------------------------------
* Install LIBIGL python bindings

* COMPAS Viewers
.. code-block:: bash
Follow the instructions to install `compas_view2 <https://github.com/compas-dev/compas_view2>`_.
conda install -c conda-forge igl
* COMPAS CGAL
* Install COMPAS CGAL

.. code-block:: bash
conda install -n my-project compas_cgal
conda install -c conda-forge compas_cgal
* Grasshopper
Expand All @@ -46,7 +46,7 @@ The Grasshopper components are automatically installed with the `compas_rhino` i
.. code-block:: bash
conda activate my-project
python -m compas_rhino.install -v 6.0
python -m compas_rhino.install -v 7.0
Step 4. Test if the library works
Expand Down
18 changes: 9 additions & 9 deletions docs/tutorials/01_introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The COMPAS SLICER package broadly contains four blocks of code:
* **Geometry:** contains all geometrical entities
* **Slicers:** provides the functionality that generates the sliced model
* **Print organizers:** provides the functionality for embedding fabrication related information to the sliced model
* **Visualization:** visualizes the results
* **Visualization:** visualizes the results in the Rhino-Grasshopper environment

Geometry
--------
Expand Down Expand Up @@ -55,17 +55,17 @@ setting the velocity, setting the blend radius, or adding safety printpoints (z-
Visualization
-------------

Both the Slicer output and the PrintOrganizer output can be visualized in different ways. These are described in Tutorial 2.
Both the Slicer output and the PrintOrganizer output can be visualized in Grasshopper. More details on this can be found in Tutorial 2.

Folder structure
================

The functions of COMPAS SLICER are grouped into different folders:

* **geometry:**
* **parameters:** Contains functions for interacting with the parameters of the slicing and print organization process.
* **post_processing:** Various functions that are used *after* a model is sliced, such as different methods of sorting, or adding a brim/raft.
* **pre_processing:** Various functions that are used *before slicing a model*, such as repositioning, or various operations for curved slicing.
* **print_organization:**
* **slicers:**
* **utilities:**
* **geometry:** Contains the main geometric classes of compas_slicer: ``Layer``, ``Path``, and ``PrintPoint``.
* **parameters:** Contains parameter presets.
* **pre_processing:** Contains various functions that are used *before slicing a model*, such as repositioning, or various operations for curved slicing.
* **slicers:** Contains the slicer classes.
* **print_organization:** Contains the print organization classes. These take a sliced model and embed on it all necessary fabrication-related information.
* **post_processing:** Contains various functions that are used *after* a model is sliced, such as different methods of sorting, or adding a brim/raft.
* **utilities:** Contains miscellaneous useful functions.
5 changes: 1 addition & 4 deletions docs/tutorials/02_grasshopper_visualization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This loads the latest version of the according json file from the output folder.
Components
============
The components that exist correspond to the main classes of data types from compas_slicer that someone might want to
visualize. The following components are currently available.
visualize. The components that are currently available include the following:

* csLoadSlicer

Expand Down Expand Up @@ -79,6 +79,3 @@ is displayed with its cross-sectional geometry.

*Render paths visualization.*


And many others that will be documented soon!...

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from compas_slicer.print_organization import set_linear_velocity_constant
from compas_slicer.print_organization import set_blend_radius
from compas_slicer.utilities import save_to_json
from compas_view2 import app

from compas.datastructures import Mesh
from compas.geometry import Point
Expand Down Expand Up @@ -121,14 +120,6 @@ def main():
printpoints_data = print_organizer.output_nested_printpoints_dict()
utils.save_to_json(printpoints_data, OUTPUT_DIR, 'out_printpoints_nested.json')

# ==========================================================================
# Initializes the compas_viewer and visualizes results
# ==========================================================================
viewer = app.App(width=1600, height=1000)
slicer.visualize_on_viewer(viewer, visualize_mesh=False, visualize_paths=True)
print_organizer.visualize_on_viewer(viewer, visualize_printpoints=True)
viewer.show()

end_time = time.time()
print("Total elapsed time", round(end_time - start_time, 2), "seconds")

Expand Down
7 changes: 3 additions & 4 deletions examples/2_curved_slicing/ex2_curved_slicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@
import logging
import compas_slicer.utilities as utils
from compas_slicer.slicers import InterpolationSlicer
from compas_slicer.post_processing import simplify_paths_rdp_igl
from compas_slicer.post_processing import simplify_paths_rdp
from compas_slicer.pre_processing import InterpolationSlicingPreprocessor
from compas_slicer.print_organization import set_extruder_toggle, set_linear_velocity_by_range
from compas_slicer.print_organization import add_safety_printpoints
from compas_slicer.pre_processing import create_mesh_boundary_attributes
from compas_slicer.print_organization import InterpolationPrintOrganizer
from compas_slicer.post_processing import seams_smooth
from compas_slicer.print_organization import smooth_printpoints_up_vectors, smooth_printpoints_layer_heights
from compas_slicer.post_processing import generate_brim
import time

logger = logging.getLogger('logger')
logging.basicConfig(format='%(levelname)s - %(message)s', level=logging.INFO)

DATA_PATH = os.path.join(os.path.dirname(__file__), 'data_Y_shape')
DATA_PATH = os.path.join(os.path.dirname(__file__), 'data_vase')
OUTPUT_PATH = utils.get_output_directory(DATA_PATH)
OBJ_INPUT_NAME = os.path.join(DATA_PATH, 'mesh.obj')

Expand Down Expand Up @@ -50,7 +49,7 @@ def main():
slicer = InterpolationSlicer(mesh, preprocessor, parameters)
slicer.slice_model() # compute_norm_of_gradient contours

simplify_paths_rdp_igl(slicer, threshold=0.25)
simplify_paths_rdp(slicer, threshold=0.25)
seams_smooth(slicer, smooth_distance=3)
slicer.printout_info()
utils.save_to_json(slicer.to_data(), OUTPUT_PATH, 'curved_slicer.json')
Expand Down
18 changes: 0 additions & 18 deletions src/compas_slicer/print_organization/base_print_organizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,24 +215,6 @@ def printout_info(self):
print("Print Velocity has not been assigned, thus print time is not calculated.")
print("")

def visualize_on_viewer(self, viewer, visualize_printpoints):
"""Visualize printpoints on the compas_viewer.
Parameters
----------
viewer: :class:`compas_view2.app.App`
An instance of the App viewer class.
visualize_printpoints: bool
"""
all_pts = []
for layer_key in self.printpoints_dict:
for path_key in self.printpoints_dict[layer_key]:
for printpoint in self.printpoints_dict[layer_key][path_key]:
all_pts.append(printpoint.pt)

polyline = Polyline(all_pts)
viewer.add(polyline, show_points=visualize_printpoints, pointcolor=(0, 0, 1), linecolor=(1, 0, 1), linewidth=1)

def get_printpoint_up_vector(self, path, k, normal):
"""
Returns the printpoint up-vector so that it is orthogonal to the path direction and the normal
Expand Down
25 changes: 0 additions & 25 deletions src/compas_slicer/slicers/base_slicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,31 +181,6 @@ def printout_info(self):
print("Number of sampling printpoints on layers: %d" % self.number_of_points)
print("")

def visualize_on_viewer(self, viewer, visualize_mesh=False, visualize_paths=True):
"""Visualizes slicing result using compas.viewers.
Parameters
----------
viewer: :class:`compas_view2.app.App`
An instance of the App viewer class.
visualize_mesh: bool, optional
True to visualize mesh, False to not.
visualize_paths: bool, optional
True to visualize paths, False to not.
"""

if visualize_mesh:
viewer.add(self.mesh, show_points=False, hide_coplanaredges=False)

if visualize_paths:
for i, layer in enumerate(self.layers):
for j, path in enumerate(layer.paths):
pts = copy.deepcopy(path.points)
if path.is_closed:
pts.append(pts[0])
polyline = Polyline(pts)
viewer.add(polyline, show_points=True, pointcolor=(0, 0, 1), linecolor=(1, 0, 0), linewidth=2)

##############################
# --- To data, from data

Expand Down

0 comments on commit 2fd7f61

Please sign in to comment.