ansys / pymapdl

Pythonic interface to MAPDL

Home Page:https://mapdl.docs.pyansys.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Julia integration is broken

germa89 opened this issue · comments

Importing PyMAPDL is broken. The following code crashes the terminal:

using PyCall
pymapdl = pyimport("ansys.mapdl.core")

It seems this is due to the helper objects we create in plotting.py.

TEMP = pv.Sphere(center=(0, 0, 0), radius=0.5)
UX = pv.Arrow(
start=(-1, 0, 0),
direction=(1, 0, 0),
tip_length=1,
tip_radius=0.5,
scale=1.0,
)
UY = pv.Arrow(
start=(0, -1, 0),
direction=(0, 1, 0),
tip_length=1,
tip_radius=0.5,
scale=1.0,
)
UZ = pv.Arrow(
start=(0, 0, -1),
direction=(0, 0, 1),
tip_length=1,
tip_radius=0.5,
scale=1.0,
)
FX = pv.Arrow(
start=(-1, 0, 0),
direction=(1, 0, 0),
tip_length=0.5,
tip_radius=0.25,
scale=1.0,
)
FY = pv.Arrow(
start=(0, -1, 0),
direction=(0, 1, 0),
tip_length=0.5,
tip_radius=0.25,
scale=1.0,
)
FZ = pv.Arrow(
start=(0, 0, -1),
direction=(0, 0, 1),
tip_length=0.5,
tip_radius=0.25,
scale=1.0,
)
def get_VOLT():
model_a = pv.Cylinder(
center=(0, 0, 0), direction=(1, 0, 0), radius=0.2, height=2
).triangulate()
model_b = pv.Cylinder(
center=(0, 0, 0), direction=(0, 1, 0), radius=0.2, height=2
).triangulate()
model_c = pv.Cylinder(
center=(0, 0, 0), direction=(0, 0, 1), radius=0.2, height=2
).triangulate()
result = model_a.merge(model_b).triangulate()
result = result.merge(model_c)
result.rotate_z(45.0, inplace=True)
result.rotate_vector(
vector=(1, -1, 0), angle=-45, point=(0, 0, 0), inplace=True
)
return result
VOLT = get_VOLT()
HEAT = pv.Cube(center=(0, 0, 0), x_length=1.0, y_length=1.0, z_length=1.0)

One way to mitigate that, is making those objects attributes of a new class:

# Symbols for constrains
class DefaultSymbol:

    def __init__(self):
        self.TEMP = pv.Sphere(center=(0, 0, 0), radius=0.5)
        ....

Temporary fix

There are two temporary solutions until I have time to implement the above change.

if _HAS_PYVISTA and False:
    import pyvista as pv

But this can create issues later.