From 580431aa919d66832e48834bc6d997519062f122 Mon Sep 17 00:00:00 2001 From: dkunhamb Date: Wed, 10 Jul 2024 18:16:23 -0500 Subject: [PATCH 1/2] add version --- .../pymechanical_cheat_sheet/pymechanical_cheat_sheet.tex | 2 +- .../pymechanical_cheat_sheet/pymechanical_script.py | 7 ++----- requirements/requirements_doc.txt | 1 + scripts/generate_code_snippet.py | 8 ++++++++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cheat_sheets/pymechanical_cheat_sheet/pymechanical_cheat_sheet.tex b/cheat_sheets/pymechanical_cheat_sheet/pymechanical_cheat_sheet.tex index 3862f92..6dd1669 100644 --- a/cheat_sheets/pymechanical_cheat_sheet/pymechanical_cheat_sheet.tex +++ b/cheat_sheets/pymechanical_cheat_sheet/pymechanical_cheat_sheet.tex @@ -20,7 +20,7 @@ \end{center} \begin{center} - \small{\textbf{Version: 0.11 (stable)}} \\ + \small{\textbf{Version: \input{scripts/generated_scripts/pymechanical_version.txt} (stable)}} \\ \end{center} \AddToShipoutPicture* diff --git a/cheat_sheets/pymechanical_cheat_sheet/pymechanical_script.py b/cheat_sheets/pymechanical_cheat_sheet/pymechanical_script.py index 5fc43c6..4cea1be 100644 --- a/cheat_sheets/pymechanical_cheat_sheet/pymechanical_script.py +++ b/cheat_sheets/pymechanical_cheat_sheet/pymechanical_script.py @@ -73,7 +73,6 @@ app = App(version=242) print(app) # BREAK BLOCK - # Extract the global API entry points (available from built-in Mechanical scripting) # Merge them into your Python global variables app.update_globals(globals()) @@ -83,13 +82,11 @@ Model # Application.DataModel.Project.Model Tree # Application.DataModel.Tree Graphics # Application.ExtAPI.Graphics - # BREAK BLOCK file = r"D:\\Workdir\\bracket.mechdb" app.open(file) -allbodies = DataModel.Project.Model.GetChildren( - Ansys.Mechanical.DataModel.Enums.DataModelObjectCategory.Body, - True) +app.update_globals(globals()) +allbodies = Model.GetChildren(DataModelObjectCategory.Body, True) print(allbodies.Count) # BREAK BLOCK import logging diff --git a/requirements/requirements_doc.txt b/requirements/requirements_doc.txt index b8e1aa3..686a517 100644 --- a/requirements/requirements_doc.txt +++ b/requirements/requirements_doc.txt @@ -1,3 +1,4 @@ +ansys.mechanical.core==0.11.1 numpydoc==1.5.0 Sphinx==6.1.3 sphinx-copybutton==0.5.2 diff --git a/scripts/generate_code_snippet.py b/scripts/generate_code_snippet.py index d407f48..5c7c0a0 100644 --- a/scripts/generate_code_snippet.py +++ b/scripts/generate_code_snippet.py @@ -29,6 +29,13 @@ def generate_code_examples(file_path): with open(file_path, "w") as file: file.write(example.strip()) +def version_fetch_pymechanical(): + import ansys.mechanical.core as pymech + version = pymech.__version__ + file_name = f"pymechanical_version.txt" + file_path = os.path.join(OUTPUT_PATH, file_name) + with open(file_path, "w") as file: + file.write(version) if __name__ == "__main__": parser = argparse.ArgumentParser( @@ -40,3 +47,4 @@ def generate_code_examples(file_path): args = parser.parse_args() generate_code_examples(args.file_path) + version_fetch_pymechanical() From 4a0a2de7db8da25a3a7eab7037be3fc1b558c438 Mon Sep 17 00:00:00 2001 From: dkunhamb Date: Thu, 11 Jul 2024 10:27:59 -0500 Subject: [PATCH 2/2] add dependabot --- .github/workflows/dependabot.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/dependabot.yml diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml new file mode 100644 index 0000000..e153be7 --- /dev/null +++ b/.github/workflows/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/requirements" + schedule: + interval: "daily" + labels: + - "maintenance" + - "dependencies" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + labels: + - "maintenance" \ No newline at end of file