Skip to content

Commit 734bfb2

Browse files
authored
Merge branch 'main' into feat/test-gallery
2 parents 8aa8b4f + 2076621 commit 734bfb2

File tree

9 files changed

+41
-15
lines changed

9 files changed

+41
-15
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ repos:
3434
args: ["--ignore-words", "doc/styles/config/vocabularies/ANSYS/accept.txt", "-w"]
3535

3636
- repo: https://github.com/ansys/pre-commit-hooks
37-
rev: v0.3.2
37+
rev: v0.3.1
3838
hooks:
3939
- id: add-license-headers
4040
args:
@@ -66,7 +66,7 @@ repos:
6666
- id: check-added-large-files
6767

6868
- repo: https://github.com/python-jsonschema/check-jsonschema
69-
rev: 0.28.5
69+
rev: 0.28.6
7070
hooks:
7171
- id: check-github-workflows
7272

doc/changelog.d/773.dependencies.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MAINT: Bump numpy from 1.26.4 to 2.0.0

doc/changelog.d/788.dependencies.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MAINT: Bump the doc group with 4 updates

doc/changelog.d/789.changed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[pre-commit.ci] pre-commit autoupdate

doc/changelog.d/790.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FEAT: Add graphics and globals

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,24 +54,24 @@ tests = [
5454
]
5555
doc = [
5656
"sphinx==7.3.7",
57-
"ansys-sphinx-theme[autoapi]==0.16.5",
57+
"ansys-sphinx-theme[autoapi]==0.16.6",
5858
"grpcio==1.64.1",
5959
"imageio-ffmpeg==0.5.1",
60-
"imageio==2.34.1",
60+
"imageio==2.34.2",
6161
"jupyter_sphinx==0.5.3",
6262
"jupyterlab>=3.2.8",
6363
"matplotlib==3.9.0",
64-
"numpy==1.26.4",
64+
"numpy==2.0.0",
6565
"numpydoc==1.7.0",
6666
"pandas==2.2.2",
6767
"panel==1.4.4",
6868
"plotly==5.22.0",
6969
"pypandoc==1.13",
7070
"pytest-sphinx==0.6.3",
7171
"pythreejs==2.4.2",
72-
"pyvista==0.43.9",
72+
"pyvista==0.43.10",
7373
"sphinx-autobuild==2024.4.16",
74-
"sphinx-autodoc-typehints==2.1.1",
74+
"sphinx-autodoc-typehints==2.2.2",
7575
"sphinx-copybutton==0.5.2",
7676
"sphinx_design==0.6.0",
7777
"sphinx-gallery==0.16.0",

src/ansys/mechanical/core/embedding/app.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,19 @@ def ExtAPI(self):
268268

269269
@property
270270
def Tree(self):
271-
"""Return the ExtAPI object."""
271+
"""Return the Tree object."""
272272
return GetterWrapper(self._app, lambda app: app.DataModel.Tree)
273273

274274
@property
275275
def Model(self):
276-
"""Return the ExtAPI object."""
276+
"""Return the Model object."""
277277
return GetterWrapper(self._app, lambda app: app.DataModel.Project.Model)
278278

279+
@property
280+
def Graphics(self):
281+
"""Return the Graphics object."""
282+
return GetterWrapper(self._app, lambda app: app.ExtAPI.Graphics)
283+
279284
@property
280285
def readonly(self):
281286
"""Return whether the Mechanical object is read-only."""
@@ -365,6 +370,12 @@ def _update_all_globals(self) -> None:
365370
def _print_tree(self, node, max_lines, lines_count, indentation):
366371
"""Recursively print till provided maximum lines limit.
367372
373+
Each object in the tree is expected to have the following attributes:
374+
- Name: The name of the object.
375+
- Suppressed : Print as suppressed, if object is suppressed.
376+
- Children: Checks if object have children.
377+
Each child node is expected to have the all these attributes.
378+
368379
Parameters
369380
----------
370381
lines_count: int, optional
@@ -397,12 +408,6 @@ def print_tree(self, node, max_lines=80, lines_count=0, indentation=""):
397408
"""
398409
Print the hierarchical tree representation of the Mechanical project structure.
399410
400-
Each object in the tree is expected to have the following attributes:
401-
- Name: The name of the object.
402-
- Suppressed : Print as suppressed, if object is suppressed.
403-
- Children: Checks if object have children.
404-
Each child node is expected to have the all these attributes.
405-
406411
Parameters
407412
----------
408413
node: ExtAPI object

src/ansys/mechanical/core/embedding/imports.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def global_entry_points(app: "ansys.mechanical.core.App") -> typing.Dict:
3131
vars["DataModel"] = app.DataModel
3232
vars["Model"] = app.DataModel.Project.Model
3333
vars["Tree"] = app.DataModel.Tree
34+
vars["Graphics"] = app.ExtAPI.Graphics
3435
return vars
3536

3637

@@ -51,8 +52,11 @@ def global_variables(app: "ansys.mechanical.core.App", enums: bool = False) -> t
5152
clr.AddReference("Ansys.Mechanical.DataModel")
5253
# from Ansys.ACT.Mechanical import Transaction
5354
# When ansys-pythonnet issue #14 is fixed, uncomment above
55+
from Ansys.ACT.Core.Math import Point2D, Point3D
56+
from Ansys.ACT.Math import Vector3D
5457
from Ansys.Core.Units import Quantity
5558
from Ansys.Mechanical.DataModel import MechanicalEnums
59+
from Ansys.Mechanical.Graphics import Point, SectionPlane
5660

5761
import System # isort: skip
5862
import Ansys # isort: skip
@@ -62,6 +66,13 @@ def global_variables(app: "ansys.mechanical.core.App", enums: bool = False) -> t
6266
vars["Ansys"] = Ansys
6367
vars["Transaction"] = Transaction
6468
vars["MechanicalEnums"] = MechanicalEnums
69+
# Graphics
70+
vars["Point"] = Point
71+
vars["SectionPlane"] = SectionPlane
72+
# Math
73+
vars["Point2D"] = Point2D
74+
vars["Point3D"] = Point3D
75+
vars["Vector3D"] = Vector3D
6576

6677
if enums:
6778
vars.update(get_all_enums())

tests/embedding/test_globals.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,18 @@ def test_global_variables(embedded_app):
3434
"DataModel",
3535
"Model",
3636
"Tree",
37+
"Graphics",
3738
"Quantity",
3839
"System",
3940
"Ansys",
4041
"Transaction",
4142
"MechanicalEnums",
4243
"DataModelObjectCategory",
44+
"Point",
45+
"SectionPlane",
46+
"Point2D",
47+
"Point3D",
48+
"Vector3D",
4349
]
4450
globals_dict = global_variables(embedded_app, True)
4551
for attribute in attributes:

0 commit comments

Comments
 (0)