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

Add drawing utility for Motor-CAD geometry developers #441

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/ansys/motorcad/core/geometry_drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

"""Unit containing region drawing functions."""
from copy import deepcopy
import json
import warnings
from warnings import warn

Expand Down Expand Up @@ -230,3 +231,20 @@
DeprecationWarning,
)
draw_objects(regions)


def _draw_regions_json_array(json_array_string):
"""Draw regions from string of json array - for Motor-CAD geometry developers.

Parameters
----------
json_array_string : str
String representation of json array containing geometery objects.
"""
json_array = json.loads(json_array_string)
region_array = []

Check warning on line 245 in src/ansys/motorcad/core/geometry_drawing.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/motorcad/core/geometry_drawing.py#L244-L245

Added lines #L244 - L245 were not covered by tests

for json_region in json_array:
region_array += [Region._from_json(json_region)]

Check warning on line 248 in src/ansys/motorcad/core/geometry_drawing.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/motorcad/core/geometry_drawing.py#L247-L248

Added lines #L247 - L248 were not covered by tests

draw_objects(region_array)

Check warning on line 250 in src/ansys/motorcad/core/geometry_drawing.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/motorcad/core/geometry_drawing.py#L250

Added line #L250 was not covered by tests
Loading