netgen/python/occ.py
Matthias Hochsteger 16b88e8e67 OCC Mesher Cleanup
2021-11-28 15:14:41 +00:00

45 lines
1.2 KiB
Python

""" Netgen OCC documentation
This module provides the Netgen OCCGeometry class, as well as Python wrappers
for OpenCascade functionality. This allows the construction from scratch, as well as
editing geometries imported via STEP format.
Most of the classes are directly py-wrapped from the OCCT classes.
For more detailed documentation consult the OCCT docs, a good starting point is
https://dev.opencascade.org/doc/refman/html/class_b_rep_builder_a_p_i___make_shape.html
"""
from .config import USE_OCC
if not USE_OCC:
raise ImportError("Netgen was not built with Opencascade support")
from .libngpy._NgOCC import *
from .meshing import meshsize
gp_Ax3 = Axes
gp_Ax1 = Axis
Translation = gp_Trsf.Translation
Rotation = gp_Trsf.Rotation
Mirror = gp_Trsf.Mirror
def Rectangle(l,w): return WorkPlane().Rectangle(l,w)
def MoveTo(x,y): return WorkPlane().MoveTo(x,y)
def LineTo(x,y): return WorkPlane().LineTo(x,y)
def Line(l): return WorkPlane().Line(l)
unit_square_shape = WorkPlane().Line(1, name="bottom").Rotate(90) \
.Line(1, name="right").Rotate(90) \
.Line(1, name="top").Rotate(90) \
.Line(1, name="left").Rotate(90).Face()
unit_square = OCCGeometry(unit_square_shape, dim=2)