Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
schedule:
- cron: "0 0 * * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-test:
runs-on: ${{ matrix.os }}
Expand Down
43 changes: 41 additions & 2 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
name: Build Documentation

on:
workflow_dispatch:
push:
branches:
- "*"
- main
- master
pull_request:
branches:
- main
- master

schedule:
- cron: "0 0 * * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-test:
build-and-deploy:
runs-on: "ubuntu-latest"
env:
PYVISTA_OFF_SCREEN: "True"
Expand All @@ -35,3 +45,32 @@ jobs:

- name: Build docs
run: make -C docs html

- name: Upload HTML documentation
if: always()
uses: actions/upload-artifact@v4
with:
name: docs-build
path: docs/_build/html/

# Deploy to microgen-docs/main only for main/master branch
- name: Deploy HTML documentation (main branch)
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' }}
uses: peaceiris/actions-gh-pages@v4
with:
personal_token: ${{ secrets.MICROGEN_DOC_TOKEN }}
external_repository: 3MAH/microgen-docs
publish_branch: main
publish_dir: ./docs/_build/html
force_orphan: true

# Deploy to microgen-docs/PRXX for each pull request
- name: Deploy HTML documentation (pull request)
if: ${{ github.event_name == 'pull_request' }}
uses: peaceiris/actions-gh-pages@v4
with:
personal_token: ${{ secrets.MICROGEN_DOC_TOKEN }}
external_repository: 3MAH/microgen-docs
publish_branch: PR${{ github.event.pull_request.number }}
publish_dir: ./docs/_build/html
force_orphan: true
4 changes: 4 additions & 0 deletions .github/workflows/conda-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
conda-packaging:
name: Conda packaging
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
schedule:
- cron: "0 0 * * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run-examples:
runs-on: ${{ matrix.os }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/mmg-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Create conda package for mmg
on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Linux:
name: Linux
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/neper-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Create conda package for neper
on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Linux:
name: Linux
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pre-commit:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pypi-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-n-publish:
name: Build and publish to PyPI and TestPyPI
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test-conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Test conda package
on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test-linux:
name: Linux
Expand Down
6 changes: 0 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ repos:
# - id: interrogate
# args: [-vv, --fail-under=100, --omit-covered-files]

- repo: https://github.com/keewis/blackdoc
rev: v0.3.9
hooks:
- id: blackdoc
files: '\.py$'

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
Expand Down
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Table of contents

Overview
Install
quick_start
tutorials


.. toctree::
Expand Down
144 changes: 144 additions & 0 deletions docs/quick_start.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
.. _RST QuickStart:

Quick-Start Guide
=================

This guide will help you get started with Microgen quickly. We'll cover the basics of creating shapes, TPMS structures, and exporting your results.

.. jupyter-execute::
:hide-code:

import pyvista
pyvista.set_jupyter_backend('static')
pyvista.global_theme.background = 'white'
pyvista.global_theme.window_size = [600, 400]
pyvista.global_theme.axes.show = False
pyvista.global_theme.smooth_shading = True
pyvista.global_theme.split_sharp_edges = True


First Steps
-----------

Import microgen:

.. jupyter-execute::

import microgen


Creating a Basic TPMS Shape
---------------------------

Let's create a Gyroid TPMS structure, one of the most common triply periodic minimal surfaces:

.. jupyter-execute::

gyroid = microgen.Tpms(
surface_function=microgen.surface_functions.gyroid,
offset=0.3,
cell_size=1.0,
repeat_cell=2,
resolution=20
)

# Get the sheet geometry as a PyVista mesh
sheet = gyroid.sheet
sheet.plot(color='white')


TPMS Part Types
---------------

Each TPMS can generate different part types:

.. jupyter-execute::

tpms = microgen.Tpms(
surface_function=microgen.surface_functions.gyroid,
offset=0.5,
resolution=20
)

# Sheet (wall) geometry
sheet = tpms.sheet

# Upper skeletal (network) geometry
upper_skeletal = tpms.upper_skeletal

# Lower skeletal (complementary network) geometry
lower_skeletal = tpms.lower_skeletal

sheet.plot(color='lightblue')


Creating Basic Shapes
---------------------

Microgen provides several basic geometric shapes:

.. jupyter-execute::

# Create a sphere
sphere = microgen.Sphere(center=(0, 0, 0), radius=0.5)
sphere_vtk = sphere.generate_vtk()
sphere_vtk.plot(color='white')

.. jupyter-execute::

# Create a box
box = microgen.Box(center=(0, 0, 0), dim=(1, 0.5, 0.3))
box_vtk = box.generate_vtk()
box_vtk.plot(color='white')

.. jupyter-execute::

# Create a cylinder
cylinder = microgen.Cylinder(center=(0, 0, 0), height=1.0, radius=0.3)
cylinder_vtk = cylinder.generate_vtk()
cylinder_vtk.plot(color='white')


Generating CAD Geometry
-----------------------

To create CAD-compatible solids (for 3D printing or CAD software):

.. code-block:: python

# Generate the CadQuery shape
cad_shape = gyroid.generate(type_part='sheet')


Exporting Results
-----------------

Export to STL (from PyVista mesh):

.. code-block:: python

sheet.save('gyroid_sheet.stl')

Export to STEP (from CadQuery shape):

.. code-block:: python

import cadquery as cq

cad_shape = gyroid.generate(type_part='sheet')
cq.exporters.export(cq.Workplane().add(cad_shape), 'gyroid_sheet.step')

Export to VTK:

.. code-block:: python

sheet.save('gyroid_sheet.vtk')


Next Steps
----------

- Explore the :ref:`RST Geometries` for more shape examples
- Check the :ref:`RST Tpms` for all available TPMS surfaces
- Learn about :ref:`RST 3Dop` for repeating and rastering
- See :ref:`RST Mesh` for meshing capabilities
Loading
Loading