Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removal of Tolerances as global variable #139

Merged
merged 11 commits into from
May 10, 2024
Merged
1 change: 1 addition & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
push:
branches:
- main
- dev

permissions:
contents: write
Expand Down
4 changes: 4 additions & 0 deletions docs/python_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ Python API reference
:show-inheritance:

.. autoclass:: Options
:members:
:show-inheritance:

.. autoclass:: Tolerances
:members:
:show-inheritance:
21 changes: 13 additions & 8 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ Python package usage

The Python API has two main classes.
The first main class is ``CadToCsg()`` which converts CAD geometry to Constructive Solid Geometry (CSG).
There are many arguments that can be passed into the ``CadToCsg()`` class which are documented in the Python API section.
There are many arguments that can be passed into the ``CadToCsg()`` class which are documented in the `Python API section <python_api.html>`_ of the documentation.


The most minimal use case below shows GEOUNED being imported and the CadToCsg being used to convert a STEP CAD file called 'cuboid.stp' into a varity of CSG format.
If you have install GEOUNED and FreeCAD into your system PYthon then you can simply run a .py script with python.

If you have install GEOUNED and FreeCAD into your system Python then you can simply run a .py script with Python.
The most minimal use case below shows GEOUNED being imported and the CadToCsg being used to convert a STEP CAD file called 'cuboid.stp' into a vanity of CSG format.
The example makes use of default attributes.

.. code-block:: python

Expand All @@ -22,9 +22,8 @@ If you have install GEOUNED and FreeCAD into your system PYthon then you can sim
geo.start()
geo.export_csg()

The above examples makes use of default :meth:`geouned.Options`, :meth:`geouned.Tolerances` and :meth:`geouned.NumericFormat`
Users can change any of these to suit the conversion desired.
The following example changes several default values of the conversion.
Users can change :meth:`geouned.Options`, :meth:`geouned.Tolerances` and :meth:`geouned.NumericFormat` to suit the conversion desired.
The following example shows a more complete usage with several default attributes changed.

.. code-block:: python

Expand All @@ -37,8 +36,14 @@ The following example changes several default values of the conversion.
nPlaneReverse=0,
)

my_tolerances = geouned.Tolerances(
min_area=0.011
)

geo = geouned.CadToCsg(
stepFile='cuboid.stp', options=my_options
stepFile='cuboid.stp',
options=my_options,
tolerances=my_tolerances
)

geo.start()
14 changes: 7 additions & 7 deletions scripts/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ cellCommentFile = True

[Tolerances]
# change default tolerance values
relativeTolerance = False
relativeTol = False
# define the general tolerance is the geouned conversion process
generalDistance = 1e-4
generalAngle = 1e-4
distance = 1e-4
angle = 1e-4

# define the tolerance when comparing surfaces to check if there are the same surface
# keywords are : planeDistance, cylinderDistance, coneDistance, torusDistance, sphereDistance
# planeAngle, cylinderAngle, coneAngle, torusAngle
#planeDistance = 1e-2
#planeAngle = 1e-2
# keywords are : pln_distance, cyl_distance, kne_distance, tor_distance, sph_distance
# pln_angle, cyl_angle, kne_angle, tor_angle
#pln_distance = 1e-2
#pln_angle = 1e-2


[MCNP_Numeric_Format]
Expand Down
Loading