# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['pysomo']

package_data = \
{'': ['*']}

setup_kwargs = {
    'name': 'pysomo',
    'version': '0.0.6',
    'description': 'A small solid modeling library.',
    'long_description': '# pysomo\n\n![PyPI version](https://img.shields.io/pypi/pyversions/pysomo)\n![Tests](https://img.shields.io/github/workflow/status/louiscarl/pysomo/Python%20application?label=tests)\n\n_pysomo_ (for **so**lid **mo**deling) is a small solid modeling library. This library allows you to create 3D models in Python and export them to various 3D file formats.\n\n## Requirements\n_pysomo_ creates an _xcsg_ file, an XML file that can be parsed by the _xcsg_ application to create export your models in various file formats. _pysomo_ does not include _xcsg_, it can be downloaded separately: [download xcsg](https://github.com/arnholm/xcsg/releases).\n\n## Installation\n1. To install, simply run `pip install pysomo`\n2. To export from xcsg format to a 3D model file, the [_xcsg_ application](https://github.com/arnholm/xcsg) must be in the same directory as your application.\n\n## Examples\n\n### Extrusion\nThe following code creates a coin with a square hole in the middle.\n```python\nimport pysomo as somo\n\n\n# First let\'s create the round part of the coin.\ncoin_circle = somo.Circle(30)\n# This creates the base solid of the coin.\ncoin = coin_circle.linear_extrude(2)\n# Create the solid to use as the extrusion. Note that we use the offset method\n# to create a smaller circle from the base. This will give us the rim.\ncoin_extr = coin_circle.offset(-5, True).linear_extrude(1)\n\n\n# Now we use the subtraction operator to extrude our shapes from the coin.\ncoin = coin - coin_extr.translate(0, 0, 1.5) - coin_extr.translate(0, 0, -0.5)\n\n\n# Let\'s now create the square hole in the coin.\nsquare = somo.Square(20)\nsquare_rim = square.linear_extrude(2)\nsquare_hole = square.offset(-2, False).linear_extrude(2)\n\n\n# Our final coin is the base coin with a square removed.\ncoin = coin + square_rim - square_hole\n\n\n# Now we export to a file. The Root is responsible for building the xcsg file.\nroot = somo.Root(coin)\n# The Exporter reads the root file and uses the xcsg application.\nsomo.Exporter(r"coin.obj").export_obj(root)\n\n```\nThis creates the coin below.\n\n![Extrusion solid](https://github.com/louiscarl/pysomo/raw/master/img/coin.png "Extrusion of a square from a larger circle.")\n\n### Stairs\nThe following code builds a staircase up to the maximum height allowed by a building code, if we were to use the maximum step height allowed. It demonstrates modelisation via code. It also demonstrates that figures do not mutate when an operation is applied. Instead, every operation returns a new figure.\n```python\nimport pysomo as somo\n\n\ndef to_meters(inches):\n    return 0.0254 * inches\n\n\n# Let\'s say these are the building code requirements for stairs, in inches.\nmin_clear_width = to_meters(3 * 12)\nmax_stair_height = to_meters(163)\nmax_riser_height = to_meters(7 + 1 / 2)\nmin_tread_depth = to_meters(11)\n\n\n# Build the staircase steps by union of every step.\nstep = somo.Cuboid(\n    min_clear_width,\n    max_riser_height,\n    min_tread_depth,\n    center=\'false\')\nsteps = step  # Initially, the stairs are a single step\nstep_count = 1  # Number of steps in the stairs\n\n\n# Let\'s keep adding steps while the height is code compliant.\nwhile (step_count + 1) * max_riser_height < max_stair_height:\n    # Note that every operation in fact returns a new solid and does not\n    # modify the original step, so you can reuse solids for every translation.\n    steps += step.translate(\n        0,\n        max_riser_height * step_count,\n        min_tread_depth * step_count)\n    step_count += 1\n\n\n# Build the stringers. Vertices are calculated from the steps we built above.\nstairs_height = max_riser_height * step_count\nstairs_depth = min_tread_depth * step_count\nvertices = [\n    (min_clear_width, 0, 0),\n    (min_clear_width, 0, min_tread_depth),\n    (min_clear_width, stairs_height, stairs_depth),\n    (min_clear_width, stairs_height - max_riser_height, stairs_depth),\n    (0, 0, 0),\n    (0, 0, min_tread_depth),\n    (0, stairs_height, stairs_depth),\n    (0, stairs_height - max_riser_height, stairs_depth),\n]\nstringers = somo.Polyhedron(vertices)\n\n\n# The union of steps and stringers creates the stairwell.\nroot = somo.Root(steps + stringers)\n\n\n# Export to obj format.\nsomo.Exporter(r"stairs.obj").export_obj(root)\n```\nThis creates the staircase below.\n\n![Stairs](https://github.com/louiscarl/pysomo/raw/master/img/stairs.png "Generated stairs at a compliant height.")\n\nAn advantage in this style of 3d modeling is the simplicity of changing your models through variables. Let\'s say we added a zero to the maximum height allowed:\n\n![Stairs](https://github.com/louiscarl/pysomo/raw/master/img/superstairs.png "Generated staircase that is way too high.")\n',
    'author': 'Louis Carl Pepin',
    'author_email': 'lcpepin@louiscarl.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/louiscarl/pysomo',
    'packages': packages,
    'package_data': package_data,
    'python_requires': '>=3.7,<4.0',
}


setup(**setup_kwargs)
