.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/3Doperations/repeat_shape.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_3Doperations_repeat_shape.py: Repeat a unit cell ================== Import an octet-truss unit cell from a STEP file and repeat it on a 5 x 5 x 5 grid with :func:`microgen.repeat_shape`. Requires the CAD backend: ``pip install microgen[cad]``. .. GENERATED FROM PYTHON SOURCE LINES 10-26 .. code-block:: Python import pyvista as pv from microgen import Rve, repeat_shape from microgen.cad import import_step rve = Rve(dim=1) step_file = "octet_truss_cell.step" unit_geom = import_step(step_file) shape = repeat_shape(unit_geom, rve, grid=(5, 5, 5)) stl_file = "repeat_shape.stl" shape.export_stl(stl_file) .. GENERATED FROM PYTHON SOURCE LINES 27-28 .. code-block:: Python pv.read(stl_file).plot(smooth_shading=True, split_sharp_edges=True, color="#ef7d2d") .. image-sg:: /examples/3Doperations/images/sphx_glr_repeat_shape_001.png :alt: repeat shape :srcset: /examples/3Doperations/images/sphx_glr_repeat_shape_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 4.929 seconds) .. _sphx_glr_download_examples_3Doperations_repeat_shape.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: repeat_shape.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: repeat_shape.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: repeat_shape.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_