Skip to content

Commit

Permalink
feat: add missing APIs (#93)
Browse files Browse the repository at this point in the history
Co-authored-by: pyansys-ci-bot <[email protected]>
  • Loading branch information
klmcadams and pyansys-ci-bot authored Dec 20, 2024
1 parent dfd29e4 commit c6d1ad0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/changelog.d/93.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add missing APIs
15 changes: 14 additions & 1 deletion src/ansys/mechanical/stubs/stub_generator/create_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@

import System # isort: skip

ACCEPTED_TYPES = {"Ansys.Core.Units.Quantity"}
ACCEPTED_TYPES = {
"Ansys.Core.Units.Quantity",
"Ansys.ACT.Interfaces.Common",
"Ansys.Mechanical.DataModel.Interfaces.IDataModelObject",
}


def get_version():
Expand Down Expand Up @@ -199,8 +203,16 @@ def make(base_dir, outdir, assemblies, str_version):
contents = contents.replace(
"import typing", f"import typing\n{''.join(import_statements)}"
)

f.write(contents)

datamodel_interfaces = (
pathlib.Path("Ansys") / "Mechanical" / "DataModel" / "Interfaces"
)
if str(datamodel_interfaces) in str(init_path):
f.write("class DataModelObject(IDataModelObject):\n")
f.write(" pass\n")

print("Done processing all mechanical stubs.")


Expand Down Expand Up @@ -246,6 +258,7 @@ def main():
assemblies = [
"Ansys.Mechanical.DataModel",
"Ansys.Mechanical.Interfaces",
"Ansys.ACT.Interfaces",
"Ansys.ACT.WB1",
"Ans.Core",
]
Expand Down
2 changes: 2 additions & 0 deletions src/ansys/mechanical/stubs/stub_generator/generate_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,8 @@ def make(outdir: str, assembly_name: str, type_filter: typing.Callable = None) -

if assembly_name == "Ans.Core":
namespaces = {"Ansys.Core.Units": namespaces["Ansys.Core.Units"]}
elif assembly_name == "Ansys.ACT.Interfaces":
namespaces = {"Ansys.ACT.Interfaces.Common": namespaces["Ansys.ACT.Interfaces.Common"]}

dump_types(namespaces)
doc = get_doc(assembly)
Expand Down

0 comments on commit c6d1ad0

Please sign in to comment.