├── ignore_words.txt ├── examples ├── README.txt ├── gallery │ └── README.txt ├── misc │ └── README.txt ├── gallery_beta │ └── README.txt └── other │ └── elbow_trame.py ├── doc ├── changelog.d │ ├── 1028.documentation.md │ ├── 1033.miscellaneous.md │ ├── 1008.documentation.md │ ├── 1019.maintenance.md │ ├── 1023.documentation.md │ ├── 1025.documentation.md │ ├── 1034.documentation.md │ ├── 1053.documentation.md │ ├── 1113.maintenance.md │ ├── 980.documentation.md │ ├── 1009.documentation.md │ ├── 1015.miscellaneous.md │ ├── 1018.documentation.md │ ├── 1041.maintenance.md │ ├── 1054.documentation.md │ ├── 1057.fixed.md │ ├── 1058.documentation.md │ ├── 1145.miscellaneous.md │ ├── 1010.maintenance.md │ ├── 1031.maintenance.md │ ├── 1038.maintenance.md │ ├── 1050.maintenance.md │ ├── 1052.fixed.md │ ├── 1068.miscellaneous.md │ ├── 1071.miscellaneous.md │ ├── 1102.miscellaneous.md │ ├── 1017.maintenance.md │ ├── 1027.documentation.md │ ├── 1040.miscellaneous.md │ ├── 1092.maintenance.md │ ├── 1100.miscellaneous.md │ ├── 1141.miscellaneous.md │ ├── 988.maintenance.md │ ├── 1020.maintenance.md │ ├── 1035.documentation.md │ ├── 1037.documentation.md │ ├── 1039.maintenance.md │ ├── 1051.documentation.md │ ├── 1075.miscellaneous.md │ ├── 1089.miscellaneous.md │ ├── 1103.miscellaneous.md │ ├── 1111.miscellaneous.md │ ├── 1146.miscellaneous.md │ ├── 952.miscellaneous.md │ ├── 1122.miscellaneous.md │ ├── 1129.miscellaneous.md │ ├── 1157.miscellaneous.md │ ├── 999.dependencies.md │ ├── 1048.miscellaneous.md │ ├── 1127.miscellaneous.md │ ├── 1005.dependencies.md │ ├── 1021.dependencies.md │ ├── 1029.maintenance.md │ ├── 1112.miscellaneous.md │ ├── 1124.miscellaneous.md │ ├── 1139.miscellaneous.md │ ├── 1026.miscellaneous.md │ ├── 1125.miscellaneous.md │ ├── 1133.miscellaneous.md │ ├── 1045.maintenance.md │ ├── 1147.miscellaneous.md │ ├── 1173.miscellaneous.md │ ├── 995.maintenance.md │ ├── 1011.dependencies.md │ ├── 1081.miscellaneous.md │ ├── 1131.miscellaneous.md │ ├── 1138.miscellaneous.md │ ├── 1059.maintenance.md │ ├── 1132.miscellaneous.md │ ├── 1169.miscellaneous.md │ ├── 1172.miscellaneous.md │ ├── 1065.miscellaneous.md │ ├── 1137.miscellaneous.md │ ├── 990.dependencies.md │ ├── 1060.dependencies.md │ ├── 993.dependencies.md │ ├── 996.dependencies.md │ ├── 1106.miscellaneous.md │ ├── 1134.miscellaneous.md │ ├── 1177.miscellaneous.md │ ├── 1168.miscellaneous.md │ ├── 1022.dependencies.md │ ├── 1032.dependencies.md │ ├── 1114.miscellaneous.md │ ├── 992.dependencies.md │ ├── 994.dependencies.md │ ├── 1135.miscellaneous.md │ ├── 1148.miscellaneous.md │ ├── 1170.miscellaneous.md │ ├── 1006.dependencies.md │ ├── 1073.miscellaneous.md │ ├── 1167.miscellaneous.md │ └── changelog_template.jinja ├── source │ ├── examples │ │ ├── .gitignore │ │ └── index.rst │ ├── _templates │ │ ├── README.md │ │ └── autosummary │ │ │ ├── method.rst │ │ │ ├── function.rst │ │ │ ├── class.rst │ │ │ └── module.rst │ ├── cheatsheet │ │ └── .gitignore │ ├── _static │ │ └── README.md │ ├── images │ │ ├── boi.png │ │ ├── elbow.png │ │ ├── fuse.png │ │ ├── topo.png │ │ ├── graphics.png │ │ ├── pipe_tee.png │ │ ├── scaffold.png │ │ ├── toy_car.png │ │ ├── zonelets.png │ │ ├── model_iga.png │ │ ├── part_type.png │ │ ├── proximity.png │ │ ├── 00_import_cas.png │ │ ├── 00_import_cdb.png │ │ ├── Input volume.png │ │ ├── TopoEntities.png │ │ ├── Zonelets(2).png │ │ ├── cad_structure.png │ │ ├── connect_fuse.png │ │ ├── connect_join.png │ │ ├── constantsize.png │ │ ├── constantsize1.png │ │ ├── contact_patch.png │ │ ├── creation_body.png │ │ ├── creation_part.png │ │ ├── curvaturesize.png │ │ ├── docker_image.png │ │ ├── geometricsize.png │ │ ├── graphics_part.png │ │ ├── meshedsizing.png │ │ ├── part_type_new.png │ │ ├── pcb_stacker.png │ │ ├── turbine_blade.png │ │ ├── 00_import_pmdat.png │ │ ├── Stacked volume.png │ │ ├── connect_stitch.png │ │ ├── creation_model.png │ │ ├── matchmorphafter.png │ │ ├── meshbase_result.png │ │ ├── meshedgeodesic.png │ │ ├── meshedgeodesic1.png │ │ ├── model_structure.png │ │ ├── multizone_model.png │ │ ├── patchflow_demo.png │ │ ├── patchflow_model.png │ │ ├── saddle_bracket.png │ │ ├── softandhardsize.png │ │ ├── Stacker with base.png │ │ ├── cad_structure(2).png │ │ ├── client_exit_error.png │ │ ├── connect_intersect.png │ │ ├── creation_assembly.png │ │ ├── creation_body(2).png │ │ ├── creation_model(2).png │ │ ├── creation_part(2).png │ │ ├── generic_rear_wing.png │ │ ├── graphics_buttons.png │ │ ├── matchmorph_source.png │ │ ├── matchmorph_target.png │ │ ├── meshgeodesicsize.png │ │ ├── meshvolumetricsize.png │ │ ├── multizone_automesh.png │ │ ├── multizone_meshing.png │ │ ├── multizone_sizing.png │ │ ├── patchflow_modelex1.png │ │ ├── patchflow_modelex2.png │ │ ├── patchflow_modelex3.png │ │ ├── patchflow_modelex4.png │ │ ├── stackbase_results.png │ │ ├── stacker_workflow.png │ │ ├── wrapper_schematic.png │ │ ├── 00_after_cad_import.png │ │ ├── creation_assembly(2).png │ │ ├── fe2ansys_cdb_export.png │ │ ├── generic_solid_block.png │ │ ├── graphics_buttons(2).png │ │ ├── proximityorientation.png │ │ ├── fe2ansys_abaqus_import.png │ │ ├── multizone_freemeshpng.png │ │ ├── multizone_source_target.png │ │ ├── thinvol_withoutimprints.png │ │ ├── 00_after_delete_topology.png │ │ ├── 00_after_mesh_generation.png │ │ ├── multi_layer_quad_mesh_pcb.png │ │ ├── simple-bracket-holes_stl.png │ │ ├── multi_layer_quad_mesh_pcb_2.png │ │ ├── multi_layer_quad_mesh_pcb_3.png │ │ ├── simple-bracket-holes_mesh1.png │ │ ├── simple-bracket-holes_mesh2.png │ │ ├── simple-bracket-holes_mesh3.png │ │ ├── simple-bracket-holes_scdoc.png │ │ ├── bracket_mid_surface_scaffold_w.png │ │ └── solder_ball_mesh_cross_section.png │ ├── api │ │ └── index.rst │ ├── user_guide │ │ ├── logging.rst │ │ ├── index.rst │ │ ├── expressions.rst │ │ ├── graphics.rst │ │ ├── solver_translation.rst │ │ ├── matchmorph.rst │ │ ├── launch_prime.rst │ │ └── lucid.rst │ └── contributing │ │ └── index.rst ├── styles │ ├── config │ │ └── vocabularies │ │ │ └── ANSYS │ │ │ ├── reject.txt │ │ │ └── accept.txt │ └── .gitignore ├── .vale.ini ├── Makefile └── make.bat ├── tests ├── graphics │ ├── image_cache │ │ └── .gitignore │ └── test_graphics.py ├── __init__.py ├── internals │ ├── test_utils.py │ └── test_logger.py ├── core │ ├── test_surfaceutilities.py │ ├── conftest.py │ └── test_surfer.py ├── test_elbow_lucid_regression.py ├── test_pipe_tee_junction.py ├── test_elbow_scdoc.py ├── test_bracket_scaffold.py └── lucid │ └── test_mesh_utils.py ├── src └── ansys │ └── meshing │ └── prime │ ├── graphics │ ├── images │ │ ├── bin.png │ │ ├── parts.png │ │ ├── show_edges.png │ │ ├── show_ruler.png │ │ ├── selectioninfo.png │ │ ├── surface_body.png │ │ └── invert_visibility.png │ ├── widgets │ │ ├── images │ │ │ ├── bin.png │ │ │ ├── parts.png │ │ │ ├── show_edges.png │ │ │ ├── show_ruler.png │ │ │ ├── selectioninfo.png │ │ │ ├── surface_body.png │ │ │ └── invert_visibility.png │ │ ├── toggle_edges.py │ │ └── hide_picked.py │ └── __init__.py │ ├── lucid │ ├── __init__.py │ └── utils.py │ ├── _version.py │ ├── internals │ ├── comm_manager.py │ ├── grpc_utils.py │ ├── communicator.py │ └── json_utils.py │ ├── autogen │ ├── coreobject.py │ ├── toposearchstructs.py │ ├── topoutilities.py │ ├── automesh.py │ ├── volumesearch.py │ └── sizefield.py │ ├── examples │ ├── __init__.py │ └── unit_test_examples.py │ ├── core │ ├── prismcontrol.py │ ├── wrappercontrol.py │ ├── volumecontrol.py │ ├── sizecontrol.py │ └── periodiccontrol.py │ └── params │ └── primestructs.py ├── .github ├── labeler.yml ├── pull_request_template.md ├── dependabot.yml ├── workflows │ ├── dependabot_automerge.yml │ └── label.yml └── labels.yml ├── AUTHORS ├── .flake8 ├── Makefile ├── .gitignore ├── docker ├── README.md └── linux │ └── Dockerfile ├── CONTRIBUTING.md ├── LICENSE ├── tox.ini ├── .pre-commit-config.yaml ├── CONTRIBUTORS.md └── SECURITY.md /ignore_words.txt: -------------------------------------------------------------------------------- 1 | te -------------------------------------------------------------------------------- /examples/README.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/changelog.d/1028.documentation.md: -------------------------------------------------------------------------------- 1 | Doc/changes -------------------------------------------------------------------------------- /doc/changelog.d/1033.miscellaneous.md: -------------------------------------------------------------------------------- 1 | doc fix -------------------------------------------------------------------------------- /doc/source/examples/.gitignore: -------------------------------------------------------------------------------- 1 | gallery_examples -------------------------------------------------------------------------------- /doc/styles/config/vocabularies/ANSYS/reject.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/changelog.d/1008.documentation.md: -------------------------------------------------------------------------------- 1 | Update index.rst -------------------------------------------------------------------------------- /doc/changelog.d/1019.maintenance.md: -------------------------------------------------------------------------------- 1 | Update LICENSE -------------------------------------------------------------------------------- /doc/changelog.d/1023.documentation.md: -------------------------------------------------------------------------------- 1 | Update index.rst -------------------------------------------------------------------------------- /doc/changelog.d/1025.documentation.md: -------------------------------------------------------------------------------- 1 | Docker image -------------------------------------------------------------------------------- /doc/changelog.d/1034.documentation.md: -------------------------------------------------------------------------------- 1 | Fix docstring -------------------------------------------------------------------------------- /doc/changelog.d/1053.documentation.md: -------------------------------------------------------------------------------- 1 | Update ci_cd.yml -------------------------------------------------------------------------------- /doc/changelog.d/1113.maintenance.md: -------------------------------------------------------------------------------- 1 | Fix: search bar -------------------------------------------------------------------------------- /doc/changelog.d/980.documentation.md: -------------------------------------------------------------------------------- 1 | Update fileio.rst -------------------------------------------------------------------------------- /doc/changelog.d/1009.documentation.md: -------------------------------------------------------------------------------- 1 | Sraj/getting started -------------------------------------------------------------------------------- /doc/changelog.d/1015.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Update Dockerfile -------------------------------------------------------------------------------- /doc/changelog.d/1018.documentation.md: -------------------------------------------------------------------------------- 1 | Maint/python 3.13 -------------------------------------------------------------------------------- /doc/changelog.d/1041.maintenance.md: -------------------------------------------------------------------------------- 1 | maint: deploy pr docs -------------------------------------------------------------------------------- /doc/changelog.d/1054.documentation.md: -------------------------------------------------------------------------------- 1 | doc: parallel gallery -------------------------------------------------------------------------------- /doc/changelog.d/1057.fixed.md: -------------------------------------------------------------------------------- 1 | fix: unique container name -------------------------------------------------------------------------------- /doc/changelog.d/1058.documentation.md: -------------------------------------------------------------------------------- 1 | Doc/parallel gallery -------------------------------------------------------------------------------- /doc/changelog.d/1145.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Update tox.ini 2 | -------------------------------------------------------------------------------- /doc/changelog.d/1010.maintenance.md: -------------------------------------------------------------------------------- 1 | Sync ADO Changes for 252 -------------------------------------------------------------------------------- /doc/changelog.d/1031.maintenance.md: -------------------------------------------------------------------------------- 1 | revert the pyproj toml file -------------------------------------------------------------------------------- /doc/changelog.d/1038.maintenance.md: -------------------------------------------------------------------------------- 1 | maint: check vulnerabilities -------------------------------------------------------------------------------- /doc/changelog.d/1050.maintenance.md: -------------------------------------------------------------------------------- 1 | maint: temporary numpy fix -------------------------------------------------------------------------------- /doc/changelog.d/1052.fixed.md: -------------------------------------------------------------------------------- 1 | fix: Revert napoleon extension -------------------------------------------------------------------------------- /doc/changelog.d/1068.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Chore: update security.md -------------------------------------------------------------------------------- /doc/changelog.d/1071.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Doc: adding deep wiki link -------------------------------------------------------------------------------- /doc/changelog.d/1102.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Doc: add graphics docs -------------------------------------------------------------------------------- /doc/changelog.d/1017.maintenance.md: -------------------------------------------------------------------------------- 1 | Maint/migrate examples to main -------------------------------------------------------------------------------- /doc/changelog.d/1027.documentation.md: -------------------------------------------------------------------------------- 1 | Update shellblcontrolstructs.py -------------------------------------------------------------------------------- /doc/changelog.d/1040.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Doc: create beta example folder -------------------------------------------------------------------------------- /doc/changelog.d/1092.maintenance.md: -------------------------------------------------------------------------------- 1 | Fix: broken method links in api -------------------------------------------------------------------------------- /doc/changelog.d/1100.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Fix: release action migration -------------------------------------------------------------------------------- /doc/changelog.d/1141.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Maint: Use merge queue 2 | -------------------------------------------------------------------------------- /doc/changelog.d/988.maintenance.md: -------------------------------------------------------------------------------- 1 | chore: update CHANGELOG for v0.8.0 -------------------------------------------------------------------------------- /doc/changelog.d/1020.maintenance.md: -------------------------------------------------------------------------------- 1 | chore: update CHANGELOG for v0.8.1 -------------------------------------------------------------------------------- /doc/changelog.d/1035.documentation.md: -------------------------------------------------------------------------------- 1 | doc: remove attributes from docs -------------------------------------------------------------------------------- /doc/changelog.d/1037.documentation.md: -------------------------------------------------------------------------------- 1 | fix: Avoid bad `trame-vtk` version -------------------------------------------------------------------------------- /doc/changelog.d/1039.maintenance.md: -------------------------------------------------------------------------------- 1 | maint: create pull_request_template.md -------------------------------------------------------------------------------- /doc/changelog.d/1051.documentation.md: -------------------------------------------------------------------------------- 1 | docs: remove extra colon in api docs -------------------------------------------------------------------------------- /doc/changelog.d/1075.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Fix: wrong param in primeplotter -------------------------------------------------------------------------------- /doc/changelog.d/1089.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Updated the version before tagging -------------------------------------------------------------------------------- /doc/changelog.d/1103.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Create solver_translation.rst 2 | -------------------------------------------------------------------------------- /doc/changelog.d/1111.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Chore: update changelog for v0.9.0 -------------------------------------------------------------------------------- /doc/changelog.d/1146.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Fix: email link in README.md 2 | -------------------------------------------------------------------------------- /doc/changelog.d/952.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Feat: Integrate geometry imports 2 | -------------------------------------------------------------------------------- /doc/changelog.d/1122.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Chore: update CHANGELOG for v0.9.1 2 | -------------------------------------------------------------------------------- /doc/changelog.d/1129.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Maint: fixed download stats badge 2 | -------------------------------------------------------------------------------- /doc/changelog.d/1157.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Chore: update CHANGELOG for v0.9.2 2 | -------------------------------------------------------------------------------- /doc/changelog.d/999.dependencies.md: -------------------------------------------------------------------------------- 1 | build(deps): bump ansys/actions from 8 to 9 -------------------------------------------------------------------------------- /doc/changelog.d/1048.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump ansys/actions from 9 to 10 -------------------------------------------------------------------------------- /doc/changelog.d/1127.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Maint: upload using trusted publisher 2 | -------------------------------------------------------------------------------- /doc/changelog.d/1005.dependencies.md: -------------------------------------------------------------------------------- 1 | build(deps): bump the pyvista group with 2 updates -------------------------------------------------------------------------------- /doc/changelog.d/1021.dependencies.md: -------------------------------------------------------------------------------- 1 | build(deps): bump the pyvista group with 2 updates -------------------------------------------------------------------------------- /doc/changelog.d/1029.maintenance.md: -------------------------------------------------------------------------------- 1 | sync up client side changes from release/release-252 -------------------------------------------------------------------------------- /doc/changelog.d/1112.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump the pyvista group with 2 updates -------------------------------------------------------------------------------- /doc/changelog.d/1124.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump actions/checkout from 4 to 5 2 | -------------------------------------------------------------------------------- /doc/changelog.d/1139.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump actions/labeler from 5 to 6 2 | -------------------------------------------------------------------------------- /doc/source/_templates/README.md: -------------------------------------------------------------------------------- 1 | ## Contains templates for the documentation build 2 | -------------------------------------------------------------------------------- /doc/source/cheatsheet/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !cheat_sheet.qmd 3 | !.gitignore 4 | /.quarto/ -------------------------------------------------------------------------------- /doc/changelog.d/1026.miscellaneous.md: -------------------------------------------------------------------------------- 1 | fix to remove %s string while printing the server name -------------------------------------------------------------------------------- /doc/changelog.d/1125.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump the pyvista group with 2 updates 2 | -------------------------------------------------------------------------------- /doc/changelog.d/1133.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Docs: update ``html_context`` with PyAnsys tags 2 | -------------------------------------------------------------------------------- /doc/source/_static/README.md: -------------------------------------------------------------------------------- 1 | Static files are found here (like images and other assets). 2 | -------------------------------------------------------------------------------- /tests/graphics/image_cache/.gitignore: -------------------------------------------------------------------------------- 1 | # avoid uploading PNGs from the cache 2 | *.png 3 | -------------------------------------------------------------------------------- /doc/changelog.d/1045.maintenance.md: -------------------------------------------------------------------------------- 1 | docs: Update ``CONTRIBUTORS.md`` with the latest contributors -------------------------------------------------------------------------------- /doc/changelog.d/1147.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Fix: Avoid running vulnerabilities action on closed PRs 2 | -------------------------------------------------------------------------------- /doc/changelog.d/1173.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump actions/upload-artifact from 4 to 5 2 | -------------------------------------------------------------------------------- /doc/changelog.d/995.maintenance.md: -------------------------------------------------------------------------------- 1 | docs: Update ``CONTRIBUTORS.md`` with the latest contributors -------------------------------------------------------------------------------- /doc/changelog.d/1011.dependencies.md: -------------------------------------------------------------------------------- 1 | build(deps): bump pyvista/setup-headless-display-action from 3 to 4 -------------------------------------------------------------------------------- /doc/changelog.d/1081.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Updated the utils.py to sync ado side prime_graphics_port handling -------------------------------------------------------------------------------- /doc/changelog.d/1131.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Increased docker run shared memory size for MPI operability 2 | -------------------------------------------------------------------------------- /doc/changelog.d/1138.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump the test-dependencies group with 2 updates 2 | -------------------------------------------------------------------------------- /doc/source/images/boi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/boi.png -------------------------------------------------------------------------------- /doc/changelog.d/1059.maintenance.md: -------------------------------------------------------------------------------- 1 | Feature: enable parallel execution of example scripts before sphinx build -------------------------------------------------------------------------------- /doc/changelog.d/1132.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump actions/download-artifact from 4.1.9 to 5.0.0 2 | -------------------------------------------------------------------------------- /doc/changelog.d/1169.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump peter-evans/create-or-update-comment from 4 to 5 2 | -------------------------------------------------------------------------------- /doc/changelog.d/1172.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump actions/download-artifact from 5.0.0 to 6.0.0 2 | -------------------------------------------------------------------------------- /doc/source/images/elbow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/elbow.png -------------------------------------------------------------------------------- /doc/source/images/fuse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/fuse.png -------------------------------------------------------------------------------- /doc/source/images/topo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/topo.png -------------------------------------------------------------------------------- /doc/changelog.d/1065.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump pytest from 8.4.0 to 8.4.1 in the test-dependencies group -------------------------------------------------------------------------------- /doc/changelog.d/1137.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump pypa/gh-action-pypi-publish from 1.12.4 to 1.13.0 2 | -------------------------------------------------------------------------------- /doc/changelog.d/990.dependencies.md: -------------------------------------------------------------------------------- 1 | build(deps): bump sphinx from 8.2.1 to 8.2.3 in the doc-dependencies group -------------------------------------------------------------------------------- /doc/source/images/graphics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/graphics.png -------------------------------------------------------------------------------- /doc/source/images/pipe_tee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/pipe_tee.png -------------------------------------------------------------------------------- /doc/source/images/scaffold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/scaffold.png -------------------------------------------------------------------------------- /doc/source/images/toy_car.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/toy_car.png -------------------------------------------------------------------------------- /doc/source/images/zonelets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/zonelets.png -------------------------------------------------------------------------------- /doc/changelog.d/1060.dependencies.md: -------------------------------------------------------------------------------- 1 | build(deps): bump the test-dependencies group across 1 directory with 2 updates -------------------------------------------------------------------------------- /doc/changelog.d/993.dependencies.md: -------------------------------------------------------------------------------- 1 | build(deps): bump the test-dependencies group across 1 directory with 2 updates -------------------------------------------------------------------------------- /doc/changelog.d/996.dependencies.md: -------------------------------------------------------------------------------- 1 | build(deps): bump pytest-cov from 6.0.0 to 6.1.1 in the test-dependencies group -------------------------------------------------------------------------------- /doc/source/images/model_iga.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/model_iga.png -------------------------------------------------------------------------------- /doc/source/images/part_type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/part_type.png -------------------------------------------------------------------------------- /doc/source/images/proximity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/proximity.png -------------------------------------------------------------------------------- /doc/changelog.d/1106.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump pytest-pyvista from 0.1.9 to 0.2.0 in the test-dependencies group -------------------------------------------------------------------------------- /doc/changelog.d/1134.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump joblib from 1.5.1 to 1.5.2 in the general-dependencies group 2 | -------------------------------------------------------------------------------- /doc/changelog.d/1177.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps-dev): bump pytest from 8.4.2 to 9.0.0 in the test-dependencies group 2 | -------------------------------------------------------------------------------- /doc/source/images/00_import_cas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/00_import_cas.png -------------------------------------------------------------------------------- /doc/source/images/00_import_cdb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/00_import_cdb.png -------------------------------------------------------------------------------- /doc/source/images/Input volume.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/Input volume.png -------------------------------------------------------------------------------- /doc/source/images/TopoEntities.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/TopoEntities.png -------------------------------------------------------------------------------- /doc/source/images/Zonelets(2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/Zonelets(2).png -------------------------------------------------------------------------------- /doc/source/images/cad_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/cad_structure.png -------------------------------------------------------------------------------- /doc/source/images/connect_fuse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/connect_fuse.png -------------------------------------------------------------------------------- /doc/source/images/connect_join.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/connect_join.png -------------------------------------------------------------------------------- /doc/source/images/constantsize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/constantsize.png -------------------------------------------------------------------------------- /doc/source/images/constantsize1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/constantsize1.png -------------------------------------------------------------------------------- /doc/source/images/contact_patch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/contact_patch.png -------------------------------------------------------------------------------- /doc/source/images/creation_body.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/creation_body.png -------------------------------------------------------------------------------- /doc/source/images/creation_part.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/creation_part.png -------------------------------------------------------------------------------- /doc/source/images/curvaturesize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/curvaturesize.png -------------------------------------------------------------------------------- /doc/source/images/docker_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/docker_image.png -------------------------------------------------------------------------------- /doc/source/images/geometricsize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/geometricsize.png -------------------------------------------------------------------------------- /doc/source/images/graphics_part.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/graphics_part.png -------------------------------------------------------------------------------- /doc/source/images/meshedsizing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/meshedsizing.png -------------------------------------------------------------------------------- /doc/source/images/part_type_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/part_type_new.png -------------------------------------------------------------------------------- /doc/source/images/pcb_stacker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/pcb_stacker.png -------------------------------------------------------------------------------- /doc/source/images/turbine_blade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/turbine_blade.png -------------------------------------------------------------------------------- /examples/gallery/README.txt: -------------------------------------------------------------------------------- 1 | Examples 2 | ======== 3 | These examples show how to use PyPrimeMesh to prepare meshes. 4 | -------------------------------------------------------------------------------- /doc/changelog.d/1168.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump pytest-pyvista from 0.2.0 to 0.3.0 in the test-dependencies group 2 | -------------------------------------------------------------------------------- /doc/source/images/00_import_pmdat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/00_import_pmdat.png -------------------------------------------------------------------------------- /doc/source/images/Stacked volume.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/Stacked volume.png -------------------------------------------------------------------------------- /doc/source/images/connect_stitch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/connect_stitch.png -------------------------------------------------------------------------------- /doc/source/images/creation_model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/creation_model.png -------------------------------------------------------------------------------- /doc/source/images/matchmorphafter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/matchmorphafter.png -------------------------------------------------------------------------------- /doc/source/images/meshbase_result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/meshbase_result.png -------------------------------------------------------------------------------- /doc/source/images/meshedgeodesic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/meshedgeodesic.png -------------------------------------------------------------------------------- /doc/source/images/meshedgeodesic1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/meshedgeodesic1.png -------------------------------------------------------------------------------- /doc/source/images/model_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/model_structure.png -------------------------------------------------------------------------------- /doc/source/images/multizone_model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/multizone_model.png -------------------------------------------------------------------------------- /doc/source/images/patchflow_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/patchflow_demo.png -------------------------------------------------------------------------------- /doc/source/images/patchflow_model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/patchflow_model.png -------------------------------------------------------------------------------- /doc/source/images/saddle_bracket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/saddle_bracket.png -------------------------------------------------------------------------------- /doc/source/images/softandhardsize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/softandhardsize.png -------------------------------------------------------------------------------- /doc/changelog.d/1022.dependencies.md: -------------------------------------------------------------------------------- 1 | build(deps): bump ansys-sphinx-theme[autoapi] from 1.4.2 to 1.4.4 in the doc-dependencies group -------------------------------------------------------------------------------- /doc/changelog.d/1032.dependencies.md: -------------------------------------------------------------------------------- 1 | build(deps): bump ansys-sphinx-theme[autoapi] from 1.4.4 to 1.5.2 in the doc-dependencies group -------------------------------------------------------------------------------- /doc/changelog.d/1114.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump numpydoc from 1.8.0 to 1.9.0 in the doc-dependencies group across 1 directory -------------------------------------------------------------------------------- /doc/changelog.d/992.dependencies.md: -------------------------------------------------------------------------------- 1 | build(deps): bump ansys-sphinx-theme[autoapi] from 1.3.2 to 1.3.3 in the doc-dependencies group -------------------------------------------------------------------------------- /doc/changelog.d/994.dependencies.md: -------------------------------------------------------------------------------- 1 | build(deps): bump ansys-sphinx-theme[autoapi] from 1.3.3 to 1.4.2 in the doc-dependencies group -------------------------------------------------------------------------------- /doc/source/images/Stacker with base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/Stacker with base.png -------------------------------------------------------------------------------- /doc/source/images/cad_structure(2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/cad_structure(2).png -------------------------------------------------------------------------------- /doc/source/images/client_exit_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/client_exit_error.png -------------------------------------------------------------------------------- /doc/source/images/connect_intersect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/connect_intersect.png -------------------------------------------------------------------------------- /doc/source/images/creation_assembly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/creation_assembly.png -------------------------------------------------------------------------------- /doc/source/images/creation_body(2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/creation_body(2).png -------------------------------------------------------------------------------- /doc/source/images/creation_model(2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/creation_model(2).png -------------------------------------------------------------------------------- /doc/source/images/creation_part(2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/creation_part(2).png -------------------------------------------------------------------------------- /doc/source/images/generic_rear_wing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/generic_rear_wing.png -------------------------------------------------------------------------------- /doc/source/images/graphics_buttons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/graphics_buttons.png -------------------------------------------------------------------------------- /doc/source/images/matchmorph_source.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/matchmorph_source.png -------------------------------------------------------------------------------- /doc/source/images/matchmorph_target.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/matchmorph_target.png -------------------------------------------------------------------------------- /doc/source/images/meshgeodesicsize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/meshgeodesicsize.png -------------------------------------------------------------------------------- /doc/source/images/meshvolumetricsize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/meshvolumetricsize.png -------------------------------------------------------------------------------- /doc/source/images/multizone_automesh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/multizone_automesh.png -------------------------------------------------------------------------------- /doc/source/images/multizone_meshing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/multizone_meshing.png -------------------------------------------------------------------------------- /doc/source/images/multizone_sizing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/multizone_sizing.png -------------------------------------------------------------------------------- /doc/source/images/patchflow_modelex1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/patchflow_modelex1.png -------------------------------------------------------------------------------- /doc/source/images/patchflow_modelex2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/patchflow_modelex2.png -------------------------------------------------------------------------------- /doc/source/images/patchflow_modelex3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/patchflow_modelex3.png -------------------------------------------------------------------------------- /doc/source/images/patchflow_modelex4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/patchflow_modelex4.png -------------------------------------------------------------------------------- /doc/source/images/stackbase_results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/stackbase_results.png -------------------------------------------------------------------------------- /doc/source/images/stacker_workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/stacker_workflow.png -------------------------------------------------------------------------------- /doc/source/images/wrapper_schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/wrapper_schematic.png -------------------------------------------------------------------------------- /doc/changelog.d/1135.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump ansys-sphinx-theme[autoapi] from 1.5.3 to 1.6.0 in the doc-dependencies group 2 | -------------------------------------------------------------------------------- /doc/changelog.d/1148.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump ansys-sphinx-theme[autoapi] from 1.6.0 to 1.6.1 in the doc-dependencies group 2 | -------------------------------------------------------------------------------- /doc/changelog.d/1170.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump ansys-sphinx-theme[autoapi] from 1.6.1 to 1.6.3 in the doc-dependencies group 2 | -------------------------------------------------------------------------------- /doc/source/images/00_after_cad_import.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/00_after_cad_import.png -------------------------------------------------------------------------------- /doc/source/images/creation_assembly(2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/creation_assembly(2).png -------------------------------------------------------------------------------- /doc/source/images/fe2ansys_cdb_export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/fe2ansys_cdb_export.png -------------------------------------------------------------------------------- /doc/source/images/generic_solid_block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/generic_solid_block.png -------------------------------------------------------------------------------- /doc/source/images/graphics_buttons(2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/graphics_buttons(2).png -------------------------------------------------------------------------------- /doc/source/images/proximityorientation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/proximityorientation.png -------------------------------------------------------------------------------- /doc/changelog.d/1006.dependencies.md: -------------------------------------------------------------------------------- 1 | build(deps): bump ansys-tools-visualization-interface from 0.8.3 to 0.9.1 in the general-dependencies group -------------------------------------------------------------------------------- /doc/source/images/fe2ansys_abaqus_import.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/fe2ansys_abaqus_import.png -------------------------------------------------------------------------------- /doc/source/images/multizone_freemeshpng.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/multizone_freemeshpng.png -------------------------------------------------------------------------------- /doc/source/images/multizone_source_target.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/multizone_source_target.png -------------------------------------------------------------------------------- /doc/source/images/thinvol_withoutimprints.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/thinvol_withoutimprints.png -------------------------------------------------------------------------------- /doc/changelog.d/1073.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump ansys-tools-visualization-interface from 0.9.2 to 0.10.0 in the general-dependencies group -------------------------------------------------------------------------------- /doc/source/images/00_after_delete_topology.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/00_after_delete_topology.png -------------------------------------------------------------------------------- /doc/source/images/00_after_mesh_generation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/00_after_mesh_generation.png -------------------------------------------------------------------------------- /doc/source/images/multi_layer_quad_mesh_pcb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/multi_layer_quad_mesh_pcb.png -------------------------------------------------------------------------------- /doc/source/images/simple-bracket-holes_stl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/simple-bracket-holes_stl.png -------------------------------------------------------------------------------- /doc/styles/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !config 3 | !config/vocabularies 4 | !config/vocabularies/ANSYS 5 | !config/vocabularies/ANSYS/** 6 | !.gitignore -------------------------------------------------------------------------------- /examples/misc/README.txt: -------------------------------------------------------------------------------- 1 | Miscellaneous examples 2 | ====================== 3 | These examples provide tips and tricks for using PyPrimeMesh. 4 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/images/bin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/src/ansys/meshing/prime/graphics/images/bin.png -------------------------------------------------------------------------------- /doc/changelog.d/1167.miscellaneous.md: -------------------------------------------------------------------------------- 1 | Build(deps): bump ansys-tools-visualization-interface from 0.11.0 to 0.12.0 in the general-dependencies group 2 | -------------------------------------------------------------------------------- /doc/source/images/multi_layer_quad_mesh_pcb_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/multi_layer_quad_mesh_pcb_2.png -------------------------------------------------------------------------------- /doc/source/images/multi_layer_quad_mesh_pcb_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/multi_layer_quad_mesh_pcb_3.png -------------------------------------------------------------------------------- /doc/source/images/simple-bracket-holes_mesh1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/simple-bracket-holes_mesh1.png -------------------------------------------------------------------------------- /doc/source/images/simple-bracket-holes_mesh2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/simple-bracket-holes_mesh2.png -------------------------------------------------------------------------------- /doc/source/images/simple-bracket-holes_mesh3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/simple-bracket-holes_mesh3.png -------------------------------------------------------------------------------- /doc/source/images/simple-bracket-holes_scdoc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/simple-bracket-holes_scdoc.png -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/images/parts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/src/ansys/meshing/prime/graphics/images/parts.png -------------------------------------------------------------------------------- /doc/source/images/bracket_mid_surface_scaffold_w.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/bracket_mid_surface_scaffold_w.png -------------------------------------------------------------------------------- /doc/source/images/solder_ball_mesh_cross_section.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/doc/source/images/solder_ball_mesh_cross_section.png -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/images/show_edges.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/src/ansys/meshing/prime/graphics/images/show_edges.png -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/images/show_ruler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/src/ansys/meshing/prime/graphics/images/show_ruler.png -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/widgets/images/bin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/src/ansys/meshing/prime/graphics/widgets/images/bin.png -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/images/selectioninfo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/src/ansys/meshing/prime/graphics/images/selectioninfo.png -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/images/surface_body.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/src/ansys/meshing/prime/graphics/images/surface_body.png -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/widgets/images/parts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/src/ansys/meshing/prime/graphics/widgets/images/parts.png -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/images/invert_visibility.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/src/ansys/meshing/prime/graphics/images/invert_visibility.png -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/widgets/images/show_edges.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/src/ansys/meshing/prime/graphics/widgets/images/show_edges.png -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/widgets/images/show_ruler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/src/ansys/meshing/prime/graphics/widgets/images/show_ruler.png -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/widgets/images/selectioninfo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/src/ansys/meshing/prime/graphics/widgets/images/selectioninfo.png -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/widgets/images/surface_body.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/src/ansys/meshing/prime/graphics/widgets/images/surface_body.png -------------------------------------------------------------------------------- /examples/gallery_beta/README.txt: -------------------------------------------------------------------------------- 1 | Examples using beta APIs 2 | ======================== 3 | These examples use beta APIs and as such their behavior and implementation may change in future. 4 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/widgets/images/invert_visibility.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansys/pyprimemesh/HEAD/src/ansys/meshing/prime/graphics/widgets/images/invert_visibility.png -------------------------------------------------------------------------------- /doc/source/examples/index.rst: -------------------------------------------------------------------------------- 1 | .. _ref_index_examples: 2 | 3 | .. === EXAMPLES Gallery === 4 | 5 | 6 | .. 7 | We have to include this rather than include it in a tree. 8 | 9 | .. include:: gallery_examples/index.rst 10 | :start-line: 2 11 | -------------------------------------------------------------------------------- /doc/source/_templates/autosummary/method.rst: -------------------------------------------------------------------------------- 1 | {{ name | escape | underline}} 2 | 3 | .. currentmodule:: {{ module }} 4 | 5 | .. automethod:: {{ fullname }} 6 | 7 | .. minigallery:: 8 | :add-heading: Examples using {{ objname }} 9 | 10 | {{ fullname }} 11 | -------------------------------------------------------------------------------- /doc/source/_templates/autosummary/function.rst: -------------------------------------------------------------------------------- 1 | {{ name | escape | underline}} 2 | 3 | .. currentmodule:: {{ module }} 4 | 5 | .. autofunction:: {{ fullname }} 6 | 7 | .. minigallery:: 8 | :add-heading: Examples using {{ objname }} 9 | 10 | {{ fullname }} 11 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | documentation: 2 | - changed-files: 3 | - any-glob-to-any-file: ['doc/source/**/*', 'README.md'] 4 | 5 | maintenance: 6 | - changed-files: 7 | - any-glob-to-any-file: ['.github/**/*', '.flake8', 'pyproject.toml', 'tox.ini', '.pre-commit-config.yaml'] 8 | 9 | testing: 10 | - changed-files: 11 | - any-glob-to-any-file: ['tests/*'] 12 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the list of PyPrimeMesh's significant contributors. 2 | # 3 | # This file does not necessarily list everyone who has contributed code. 4 | # 5 | # For contributions made under a Corporate CLA, the organization is 6 | # added to this file. 7 | # 8 | # If you have contributed to the repository and want to be added to this file, 9 | # submit a request. 10 | # 11 | # 12 | ANSYS, Inc. 13 | -------------------------------------------------------------------------------- /doc/changelog.d/changelog_template.jinja: -------------------------------------------------------------------------------- 1 | {% if sections[""] %} 2 | {% for category, val in definitions.items() if category in sections[""] %} 3 | 4 | ### {{ definitions[category]['name'] }} 5 | 6 | {% for text, values in sections[""][category].items() %} 7 | - {{ text }} {{ values|join(', ') }} 8 | {% endfor %} 9 | 10 | {% endfor %} 11 | {% else %} 12 | No significant changes. 13 | 14 | 15 | {% endif %} -------------------------------------------------------------------------------- /doc/source/api/index.rst: -------------------------------------------------------------------------------- 1 | .. _ref_index_api: 2 | 3 | ============= 4 | API reference 5 | ============= 6 | 7 | This section gives an overview of all API classes, methods, and parameters present in PyPrimeMesh. 8 | 9 | .. autosummary:: 10 | :toctree: _autosummary 11 | 12 | ansys.meshing.prime 13 | ansys.meshing.prime.examples 14 | ansys.meshing.prime.graphics 15 | ansys.meshing.prime.lucid 16 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | exclude = venv, __init__.py, doc/_build 3 | select = W191, W291, W293, W391, E115, E117, E122, E124, E125, E225, E301, E303, E501, F401, F403 4 | count = True 5 | max-complexity = 10 6 | max-line-length = 100 7 | statistics = True 8 | per-file-ignores = 9 | src/ansys/meshing/prime/autogen/*: F401, F403, E501 10 | src/ansys/meshing/prime/params/primestructs.py: F401, F403 11 | src/ansys/meshing/prime/internals/error_handling.py: E501 12 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Simple makefile to simplify repetitive build env management tasks under posix 2 | 3 | CODESPELL_DIRS ?= ./pyaedt 4 | CODESPELL_SKIP ?= "*.pyc,*.xml,*.txt,*.gif,*.png,*.jpg,*.js,*.html,*.doctree,*.ttf,*.woff,*.woff2,*.eot,*.mp4,*.inv,*.pickle,*.ipynb,flycheck*,./.git/*,./.hypothesis/*,*.yml,./docs/build/*,./docs/images/*,./dist/*,*~,.hypothesis*,./docs/source/examples/*,*cover,*.dat,*.mac,\#*,PKG-INFO,*.mypy_cache/*,*.xml,*.aedt,*.svg" 5 | CODESPELL_IGNORE ?= "ignore_words.txt" 6 | 7 | all: doctest flake8 8 | 9 | doctest: codespell 10 | 11 | codespell: 12 | @echo "Running codespell" 13 | @codespell $(CODESPELL_DIRS) -S $(CODESPELL_SKIP) # -I $(CODESPELL_IGNORE) 14 | 15 | flake8: 16 | @echo "Running flake8" 17 | @flake8 . 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # This is an example .gitignore and may need to be adapted per 2 | # project. 3 | 4 | # Compiled source # 5 | ################### 6 | *.pyc 7 | *.pyd 8 | *.c 9 | *.cpp 10 | *.so 11 | *.o 12 | *.cache 13 | .pytest_cache/ 14 | 15 | # OS generated files # 16 | ###################### 17 | .fuse_hidden* 18 | *~ 19 | *swp 20 | 21 | # emacs 22 | flycheck* 23 | 24 | # Old files # 25 | _old/ 26 | 27 | # Pip generated folders # 28 | ######################### 29 | *.egg-info/ 30 | build/ 31 | dist/ 32 | 33 | # autogenerated docs 34 | _autosummary 35 | _build/ 36 | _gallery_backreferences 37 | 38 | # Testing 39 | .coverage 40 | *,cover 41 | test-output.xml 42 | 43 | \#* 44 | .\#* 45 | /.ipynb_checkpoints 46 | 47 | .tox 48 | .venv 49 | .vscode 50 | 51 | # logger 52 | .log 53 | -------------------------------------------------------------------------------- /docker/README.md: -------------------------------------------------------------------------------- 1 | Create your own Ansys Prime Server Docker container 2 | =================================================== 3 | 4 | To learn how to build your own Ansys Server Docker container, see 5 | [Guide to building the Linux Docker container](https://prime.docs.pyansys.com/version/dev/getting_started/index.html). 6 | 7 | If you have your own Ansys installation, you can build a Docker container that uses your installation. 8 | 9 | To do this, download the Python script [build_docker_linux.py](https://github.com/ansys/pyprimemesh/blob/main/docker/build_docker_linux.py) and run it from the command line: 10 | 11 | ```bash 12 | python build_docker_linux.py 13 | ``` 14 | If you have any problems, open a [GitHub Issue](https://github.com/ansys/pyprimemesh/issues). 15 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | **Please provide a brief description of the changes made in this pull request.** 3 | 4 | ## Issue linked 5 | **Please mention the issue number or describe the problem this pull request addresses.** 6 | 7 | ## Checklist 8 | - [ ] I have tested my changes locally. 9 | - [ ] I have added necessary documentation or updated existing documentation. 10 | - [ ] I have followed the coding style guidelines of this project. 11 | - [ ] I have added appropriate unit tests. 12 | - [ ] I have reviewed my changes before submitting this pull request. 13 | - [ ] I have linked the issue or issues that are solved to the PR if any. 14 | - [ ] I have assigned this PR to myself. 15 | - [ ] I have made sure that the title of my PR follows [Conventional commits style](https://www.conventionalcommits.org/en/v1.0.0/#summary) (e.g. ``feat: wrap with feature edges``) 16 | -------------------------------------------------------------------------------- /doc/source/_templates/autosummary/class.rst: -------------------------------------------------------------------------------- 1 | .. vale off 2 | 3 | {{ name | escape | underline}} 4 | 5 | .. currentmodule:: {{ module }} 6 | 7 | .. autoclass:: {{ objname }} 8 | 9 | {% block methods %} 10 | {% if methods %} 11 | .. rubric:: {{ _('Methods') }} 12 | 13 | .. autosummary:: 14 | :toctree: 15 | {% for item in methods %} 16 | {% if item != '__init__' %}{{ name }}.{{ item }}{% endif %} 17 | {%- endfor %} 18 | {% endif %} 19 | {% endblock %} 20 | 21 | {% block attributes %} 22 | {% if attributes %} 23 | .. rubric:: {{ _('Attributes') }} 24 | 25 | .. autosummary:: 26 | :toctree: 27 | {% for item in attributes %} 28 | {{ name }}.{{ item }} 29 | {%- endfor %} 30 | {% endif %} 31 | {% endblock %} 32 | 33 | .. minigallery:: 34 | :add-heading: Examples using {{ objname }} 35 | 36 | {{ fullname }} 37 | 38 | .. vale on -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | 2 | version: 2 3 | updates: 4 | - package-ecosystem: "pip" # See documentation for possible values 5 | directory: "/" 6 | insecure-external-code-execution: allow 7 | schedule: 8 | interval: "weekly" 9 | labels: 10 | - "maintenance" 11 | - "dependencies" 12 | groups: 13 | general-dependencies: 14 | patterns: 15 | - "*" 16 | exclude-patterns: 17 | - "*sphinx*" 18 | - "numpydoc" 19 | - "pyvista*" 20 | - "pytest*" 21 | test-dependencies: 22 | patterns: 23 | - "pytest*" 24 | doc-dependencies: 25 | patterns: 26 | - "*sphinx*" 27 | - "numpydoc" 28 | pyvista: 29 | patterns: 30 | - "pyvista*" 31 | - package-ecosystem: "github-actions" 32 | directory: "/" 33 | schedule: 34 | interval: "weekly" 35 | -------------------------------------------------------------------------------- /doc/source/user_guide/logging.rst: -------------------------------------------------------------------------------- 1 | .. _ref_index_logging: 2 | 3 | ******* 4 | Logging 5 | ******* 6 | 7 | A logger can be attached to a session to handle streamed output from PyPrimeMesh. 8 | 9 | This code attaches a logger and formats the output as needed: 10 | 11 | .. code-block:: python 12 | 13 | import ansys.meshing.prime as prime 14 | import logging 15 | 16 | prime_client = prime.launch_prime() 17 | model = prime_client.model 18 | 19 | # Attach logger to PyPrimeMesh model and set logging level 20 | model.python_logger.setLevel(logging.DEBUG) 21 | ch = logging.StreamHandler() 22 | ch.setLevel(logging.DEBUG) 23 | 24 | # Create formatter for message output 25 | formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") 26 | 27 | # Add formatter to ch stream handler 28 | ch.setFormatter(formatter) 29 | model.python_logger.addHandler(ch) 30 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribute 2 | 3 | Overall guidance on contributing to a PyAnsys library appears in the 4 | [Contributing] topic in the *PyAnsys developer's guide*. Ensure that you 5 | are thoroughly familiar with this guide before attempting to contribute to 6 | PyPrimeMesh. 7 | 8 | The following contribution information is specific to PyPrimeMesh. 9 | 10 | [Contributing]: https://dev.docs.pyansys.com/how-to/contributing.html 11 | 12 | ## Run tests locally 13 | 14 | Run tests locally with this command: 15 | 16 | ```bash 17 | pytest 18 | ``` 19 | 20 | Note that you must have access to PyPrimeMesh to run the tests. 21 | Some of the graphical-related tests must have a previously generated image cache, so 22 | you might get errors due to this. 23 | 24 | ## Build documentation 25 | 26 | To build PyPrimeMesh documentation, run this command. 27 | 28 | In Windows: 29 | ```bash 30 | ./doc/make.bat html 31 | ./doc/make.bat pdf 32 | ``` 33 | 34 | In Linux: 35 | ```bash 36 | make html 37 | make pdf 38 | ``` -------------------------------------------------------------------------------- /doc/.vale.ini: -------------------------------------------------------------------------------- 1 | # Core settings 2 | # ============= 3 | 4 | # Location of our `styles` 5 | StylesPath = "styles" 6 | 7 | # The options are `suggestion`, `warning`, or `error` (defaults to “warning”). 8 | MinAlertLevel = warning 9 | 10 | # By default, `code` and `tt` are ignored. 11 | IgnoredScopes = code, tt 12 | 13 | # By default, `script`, `style`, `pre`, and `figure` are ignored. 14 | SkippedScopes = script, style, pre, figure 15 | 16 | # WordTemplate specifies what Vale will consider to be an individual word. 17 | WordTemplate = \b(?:%s)\b 18 | 19 | # List of Packages to be used for our guidelines 20 | Packages = Google 21 | 22 | # Define the Ansys vocabulary 23 | Vocab = ANSYS 24 | 25 | [*.{md,rst}] 26 | 27 | # Apply the following styles 28 | [*.{rst}] 29 | BasedOnStyles = Vale, Google 30 | Vale.Terms = NO 31 | Google.Headings = NO 32 | # Inline roles are ignored 33 | TokenIgnores = (:.*:`.*`)|(<.*>) 34 | # Removing Google-specific rule - Not applicable under some circumstances 35 | Google.Colons = NO -------------------------------------------------------------------------------- /doc/source/user_guide/index.rst: -------------------------------------------------------------------------------- 1 | .. _ref_index_user_guide: 2 | 3 | ========== 4 | User guide 5 | ========== 6 | This section provides an overview of how you use PyPrimeMesh for mesh preparation. 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | :hidden: 11 | 12 | concepts 13 | launch_prime 14 | lucid 15 | fileio 16 | solver_translation 17 | logging 18 | graphics 19 | surfer 20 | wrapper 21 | automesh 22 | iga 23 | multizone 24 | stacker 25 | matchmorph 26 | sizing 27 | connections 28 | mesh_diagnostics 29 | expressions 30 | 31 | Overview 32 | ======== 33 | The :func:`launch_prime() ` method in PyPrimeMesh launches 34 | Ansys Prime Server and returns an instance of the :class:`Client ` 35 | class. You can then send gRPC commands to Ansys Prime Server and receive responses 36 | from it. 37 | 38 | .. code-block:: python 39 | 40 | from ansys.meshing.prime import launch_prime 41 | 42 | prime_client = launch_prime() 43 | 44 | -------------------------------------------------------------------------------- /docker/linux/Dockerfile: -------------------------------------------------------------------------------- 1 | # Meshing service Linux-based Dockerfile 2 | 3 | # Unpack zip as builder stage 4 | FROM rockylinux:8 as builder 5 | 6 | # Define the working directory 7 | WORKDIR /prime 8 | 9 | COPY ./PyPrimeMeshPackage /prime 10 | 11 | RUN chmod -R 0755 /prime 12 | 13 | # Build image stage 14 | # Based on rockylinux:8 15 | FROM rockylinux:8 16 | 17 | # Define the working directory 18 | WORKDIR /prime 19 | 20 | # Copy unpacked files from builder stage 21 | COPY --from=builder /prime . 22 | 23 | # Install the libnsl 24 | RUN yum -y install libnsl 25 | 26 | # Install the glibc-langpack-en package 27 | RUN yum -y install glibc-langpack-en 28 | 29 | # Set locale environment variables 30 | ENV LANG=en_US.utf-8 \ 31 | LC_ALL=en_US.utf-8 32 | 33 | # Set env for image 34 | ENV AWP_ROOT252="/prime" 35 | 36 | # Add container labels 37 | LABEL org.opencontainers.image.authors="ANSYS Inc." 38 | LABEL org.opencontainers.image.vendor="ANSYS Inc." 39 | 40 | ENTRYPOINT [ "/prime/meshing/Prime/runPrime.sh", "server", "--ip", "0.0.0.0" ] 41 | -------------------------------------------------------------------------------- /doc/styles/config/vocabularies/ANSYS/accept.txt: -------------------------------------------------------------------------------- 1 | abc 2 | (?i)Abaqus 3 | (?i)Ansys 4 | (?i)Apis 5 | AutoMesh 6 | automesh 7 | Boolean 8 | BRep 9 | CAD 10 | conformally 11 | [Dd]efeature 12 | defeaturing 13 | discretize 14 | Fluent Meshing 15 | Fluent Meshing's 16 | geodesical 17 | hexahedra 18 | hexcore 19 | _inp 20 | ignore_orientation 21 | ignore_self_proximity 22 | IGA 23 | [Ii]sogeometric 24 | JTOpen 25 | JSON 26 | [Ll]inux 27 | [Ll]ucid 28 | Material Point Manager 29 | [Mm]eshedgeodesic 30 | Meshing's 31 | [Mm]orpher 32 | multibody 33 | multithreading 34 | MultiZone 35 | Octree 36 | params 37 | [Pp]arasolid 38 | PMDAT 39 | polyhedra 40 | PrepPost 41 | PyPrimeMesh 42 | PyVista 43 | relicense 44 | [Rr]emesh 45 | remeshing 46 | [Ss]erver 47 | SizeField 48 | sizefield 49 | stackable 50 | [Ss]tacker 51 | [Ss]weeper 52 | [Ss]weepable 53 | te 54 | tet 55 | tetrahedra 56 | [Tt]opo 57 | [Tt]opoEdges 58 | [Tt]opoEntities 59 | [Tt]opoFaces 60 | [Tt]opoVolumes 61 | (?i)towncrier 62 | [Uu]nmeshed 63 | xyz 64 | [Zz]onelet 65 | [Zz]onelets 66 | fuse_option 67 | n_layers 68 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = -j auto 6 | SPHINXBUILD = sphinx-build 7 | SOURCEDIR = source 8 | BUILDDIR = _build 9 | 10 | # Put it first so that "make" without argument is like "make help". 11 | help: 12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 13 | 14 | .PHONY: help Makefile 15 | 16 | # Catch-all target: route all unknown targets to Sphinx using the new 17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 18 | %: Makefile 19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 20 | 21 | 22 | # customized clean due to examples gallery 23 | clean: 24 | rm -rf build 25 | find . -type d -name "_autosummary" -exec rm -rf {} + 26 | 27 | # Create PDF 28 | pdf: 29 | @$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 30 | cd $(BUILDDIR)/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true 31 | (test -f $(BUILDDIR)/latex/*.pdf && echo pdf exists) || exit 1 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 - 2025 ANSYS, Inc. and/or its affiliates. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | of the Software, and to permit persons to whom the Software is furnished to do 10 | so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | description = Tox environments for PyPrimeMesh development 3 | envlist = py{310,311,312,313}, doc, style 4 | skip_missing_interpreters = true 5 | isolated_build = true 6 | isolated_build_env = build 7 | 8 | [testenv] 9 | basepython = 10 | py310: python3.10 11 | py311: python3.11 12 | py312: python3.12 13 | py313: python3.13 14 | py: python3 15 | doc: python3 16 | style: python3 17 | usedevelop = true 18 | extras = tests 19 | commands = 20 | python --version 21 | pytest {toxinidir}{/}tests 22 | setenv= 23 | AWP_ROOT252 = {env:AWP_ROOT252} 24 | ANSYSLMD_LICENSE_FILE = {env:ANSYSLMD_LICENSE_FILE} 25 | 26 | [testenv:doc] 27 | usedevelop = true 28 | extras = doc 29 | setenv = 30 | PYPRIMEMESH_SPHINX_BUILD = 1 31 | AWP_ROOT252 = {env:AWP_ROOT252} 32 | ANSYSLMD_LICENSE_FILE = {env:ANSYSLMD_LICENSE_FILE} 33 | DOCUMENTATION_CNAME = prime.docs.pyansys.com 34 | commands = 35 | sphinx-build -b html -d {toxinidir}{/}doc{/}_build{/}.doctrees {toxinidir}{/}doc{/}source {toxinidir}{/}doc{/}_build{/}html --color -vW -j auto 36 | 37 | [testenv:style] 38 | usedevelop = true 39 | deps = 40 | pre-commit 41 | commands = 42 | pre-commit run --all-files 43 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/workflows/dependabot_automerge.yml: -------------------------------------------------------------------------------- 1 | name: Dependabot auto-merge 2 | on: pull_request 3 | 4 | permissions: 5 | pull-requests: write 6 | contents: write 7 | 8 | jobs: 9 | dependabot: 10 | runs-on: ubuntu-latest 11 | if: github.actor == 'dependabot[bot]' 12 | steps: 13 | - name: Dependabot metadata 14 | id: metadata 15 | uses: dependabot/fetch-metadata@v2 16 | with: 17 | github-token: ${{ secrets.GITHUB_TOKEN }} 18 | 19 | - name: Print actor 20 | run: echo "Actor is ${{github.actor}}" 21 | 22 | - name: Approve a PR 23 | run: gh pr review --approve "$PR_URL" 24 | env: 25 | PR_URL: ${{github.event.pull_request.html_url}} 26 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} 27 | 28 | - name: PyAnsys Bot Login 29 | run: echo "${{ secrets.PYANSYS_CI_BOT_TOKEN }}" | gh auth login --with-token 30 | 31 | - name: Enable auto-merge for Dependabot PRs 32 | if: steps.metadata.outputs.update-type != 'version-update:semver-major' 33 | run: gh pr merge --auto --squash "$PR_URL" 34 | env: 35 | PR_URL: ${{github.event.pull_request.html_url}} 36 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} 37 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | from ansys.meshing.prime.graphics.plotter import Graphics, PrimePlotter 24 | -------------------------------------------------------------------------------- /.github/labels.yml: -------------------------------------------------------------------------------- 1 | - name: bug 2 | description: Something isn't working 3 | color: d42a34 4 | 5 | - name: dependencies 6 | description: Related with project dependencies 7 | color: ffc0cb 8 | 9 | - name: documentation 10 | description: Improvements or additions to documentation 11 | color: 0677ba 12 | 13 | - name: enhancement 14 | description: New features or code improvements 15 | color: FFD827 16 | 17 | - name: good first issue 18 | description: Easy to solve for newcomers 19 | color: 62ca50 20 | 21 | - name: maintenance 22 | description: Package and maintenance related 23 | color: f78c37 24 | 25 | - name: release 26 | description: Anything related to an incoming release 27 | color: ffffff 28 | 29 | - name: testing 30 | description: Anything related to testing 31 | color: 5802B8 32 | 33 | - name: graphics 34 | description: Anything related to graphics 35 | color: 5903A8 36 | 37 | - name: lucid 38 | description: Anything related to lucid 39 | color: 062f67 40 | 41 | - name: limitation 42 | description: Current limitation 43 | color: 7983A8 44 | 45 | - name: triage 46 | description: Need some assessment 47 | color: f78a50 48 | 49 | - name: top priority 50 | description: Must be fixed promptly 51 | color: ab8a50 52 | 53 | - name: aps 54 | description: Anything related to Ansys Prime Server 55 | color: db8af7 56 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/lucid/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | '''High level helper functions for PyPrimeMesh 24 | ''' 25 | from .mesh_util import LabelToZoneMethod, Mesh 26 | from .scope import SurfaceScope, VolumeScope 27 | -------------------------------------------------------------------------------- /doc/source/_templates/autosummary/module.rst: -------------------------------------------------------------------------------- 1 | .. vale off 2 | 3 | {{ fullname | escape | underline}} 4 | 5 | .. currentmodule:: {{ fullname }} 6 | 7 | {% block attributes %} 8 | {% if attributes %} 9 | .. autosummary:: 10 | :toctree: 11 | :caption: Attributes 12 | 13 | {% for item in attributes %} 14 | {{ item }} 15 | {%- endfor %} 16 | {% endif %} 17 | {% endblock %} 18 | 19 | {% block functions %} 20 | {% if functions %} 21 | .. autosummary:: 22 | :toctree: 23 | :caption: Functions 24 | 25 | {% for item in functions %} 26 | {{ item }} 27 | {%- endfor %} 28 | {% endif %} 29 | {% endblock %} 30 | 31 | {% block classes %} 32 | {% if classes %} 33 | .. autosummary:: 34 | :toctree: 35 | :caption: Classes 36 | 37 | {% for item in classes %} 38 | {{ item }} 39 | {%- endfor %} 40 | {% endif %} 41 | {% endblock %} 42 | 43 | {% block exceptions %} 44 | {% if exceptions %} 45 | .. autosummary:: 46 | :toctree: 47 | :caption: Classes 48 | 49 | {% for item in exceptions %} 50 | {{ item }} 51 | {%- endfor %} 52 | {% endif %} 53 | {% endblock %} 54 | 55 | {% block modules %} 56 | {% if modules %} 57 | .. autosummary:: 58 | :toctree: 59 | :recursive: 60 | :caption: Modules 61 | {% for item in modules %} 62 | {{ item }} 63 | {%- endfor %} 64 | {% endif %} 65 | {% endblock %} 66 | 67 | .. minigallery:: 68 | :add-heading: Examples using {{ objname }} 69 | 70 | {{ module }}.{{ objname }} 71 | 72 | .. vale on 73 | -------------------------------------------------------------------------------- /doc/source/user_guide/expressions.rst: -------------------------------------------------------------------------------- 1 | *********** 2 | Expressions 3 | *********** 4 | 5 | Expressions are used to gather named entities needed for various operations. 6 | 7 | The special characters used are ``*``, ``!``, and spaces or commas. These characters 8 | can be used within a string as follows: 9 | 10 | * ``abc\*`` collects all required entities with a name starting with abc. 11 | * ``\*abc`` collects all required entities with a name ending with abc. 12 | * ``\*abc*`` collects all required entities with a name containing abc. 13 | * ``!abc\*`` collects all required entities with a name that is not starting with abc. 14 | * ``\*abc,\*xyz`` ``\*abc \*xyz`` collects all required entities with a name ending with abc or xyz. A comma or a space represents ``OR``. 15 | 16 | The following example uses expressions in the :class:`ScopeDefinition ` 17 | class. The :attr:`part_expression ` parameter 18 | is used to gather part entities to define a scope. You can provide the exact part name or use 19 | expressions for more complex entity collections. 20 | 21 | .. code-block:: pycon 22 | 23 | >>> part = model.parts[0] 24 | >>> # First part in model 25 | >>> scope = prime.ScopeDefinition(model=model, part_expression=part.name) 26 | 27 | >>> # All parts except solid 28 | >>> scope = prime.ScopeDefinition(model=model, part_expression="* !solid") 29 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | exclude: | 2 | (?x)^( 3 | src/ansys/meshing/prime/autogen/| 4 | src/ansys/meshing/prime/__init__.py 5 | ) 6 | 7 | repos: 8 | 9 | - repo: https://github.com/psf/black 10 | rev: 22.12.0 # IF VERSION CHANGES --> MODIFY "blacken-docs" MANUALLY AS WELL!! 11 | hooks: 12 | - id: black 13 | 14 | - repo: https://github.com/adamchainz/blacken-docs 15 | rev: v1.12.1 16 | hooks: 17 | - id: blacken-docs 18 | additional_dependencies: [black==22.12.0] 19 | 20 | - repo: https://github.com/PyCQA/flake8 21 | rev: 6.0.0 22 | hooks: 23 | - id: flake8 24 | 25 | - repo: https://github.com/pycqa/isort 26 | rev: 5.12.0 27 | hooks: 28 | - id: isort 29 | args: ["--profile", "black"] 30 | 31 | - repo: https://github.com/codespell-project/codespell 32 | rev: v2.2.2 33 | hooks: 34 | - id: codespell 35 | args: ["--ignore-words", "doc/styles/config/vocabularies/ANSYS/accept.txt"] 36 | 37 | - repo: https://github.com/pre-commit/pre-commit-hooks 38 | rev: v4.4.0 39 | hooks: 40 | - id: check-merge-conflict 41 | - id: debug-statements 42 | 43 | # To be activated after quick dev cycles 44 | # 45 | - repo: https://github.com/pycqa/pydocstyle 46 | rev: 6.1.1 47 | hooks: 48 | - id: pydocstyle 49 | additional_dependencies: [toml] 50 | exclude: "tests/|examples/|__init__.py" 51 | 52 | - repo: https://github.com/ansys/pre-commit-hooks 53 | rev: v0.2.8 54 | hooks: 55 | - id: add-license-headers 56 | args: 57 | - LICENSE -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | # Contributors 2 | 3 | ## Project Lead 4 | 5 | * [Ravindra Chopade](https://github.com/rchopade7) 6 | 7 | ## Individual Contributors 8 | 9 | * [Aditya Mukane](https://github.com/asmukane) 10 | * [Alan George Varghese](https://github.com/agvarghe) 11 | * [Alex Fernandez](https://github.com/AlejandroFernandezLuces) 12 | * [Alex Kaszynski](https://github.com/akaszynski) 13 | * [Christian Frisson](https://github.com/anscfrisson) 14 | * [Dominik Gresch](https://github.com/greschd) 15 | * [Eric Peng](https://github.com/peng2001) 16 | * [giovannipappalardiansys](https://github.com/giovannipappalardiansys) 17 | * [Hao Lee](https://github.com/hlee0122) 18 | * [Kathy Pippert](https://github.com/PipKat) 19 | * [Kerry McAdams](https://github.com/klmcadams) 20 | * [Martin Walters](https://github.com/waltersma) 21 | * [Maxime Rey](https://github.com/MaxJPRey) 22 | * [nikhilpaw](https://github.com/nikhilpaw) 23 | * [nikhilpawar159](https://github.com/nikhilpawar159) 24 | * [Ninad Kamat](https://github.com/ninad-kamat) 25 | * [P1532](https://github.com/P1532) 26 | * [Prajakt Mahajan](https://github.com/prajaktmahajan) 27 | * [Rajesh Meena](https://github.com/MeenaBytes) 28 | * [Raphael Luciano](https://github.com/raph-luc) 29 | * [Revathy Venugopal](https://github.com/Revathyvenugopal162) 30 | * [Roberto Pastor Muela](https://github.com/RobPasMue) 31 | * [schadha78](https://github.com/schadha78) 32 | * [srpyprime](https://github.com/srpyprime) 33 | * [Subha Nayak](https://github.com/subhnayak) 34 | * [Sébastien Morais](https://github.com/SMoraisAnsys) 35 | -------------------------------------------------------------------------------- /doc/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | if "%SPHINXOPTS%" == "" ( 11 | set SPHINXOPTS=-n -j auto 12 | ) 13 | 14 | set SOURCEDIR=source 15 | set BUILDDIR=_build 16 | 17 | if "%1" == "" goto help 18 | if "%1" == "clean" goto clean 19 | if "%1" == "pdf" goto pdf 20 | 21 | %SPHINXBUILD% >NUL 2>NUL 22 | if errorlevel 9009 ( 23 | echo. 24 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 25 | echo.installed, then set the SPHINXBUILD environment variable to point 26 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 27 | echo.may add the Sphinx directory to PATH. 28 | echo. 29 | echo.If you don't have Sphinx installed, grab it from 30 | echo.http://sphinx-doc.org/ 31 | exit /b 1 32 | ) 33 | 34 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 35 | goto end 36 | 37 | :clean 38 | rmdir /s /q %BUILDDIR% > /NUL 2>&1 39 | for /d /r %SOURCEDIR% %%d in (_autosummary,_gallery_backreferences) do @if exist "%%d" rmdir /s /q "%%d" 40 | rmdir /s /q %SOURCEDIR%\examples\gallery_examples 41 | rmdir /s /q %SOURCEDIR%\images\auto-generated 42 | goto end 43 | 44 | :pdf 45 | %SPHINXBUILD% -M latex %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 46 | cd "%BUILDDIR%\latex" 47 | for %%f in (*.tex) do ( 48 | pdflatex "%%f" --interaction=nonstopmode) 49 | if NOT EXIST ansys-meshing-prime.pdf ( 50 | echo "no pdf generated!" 51 | exit /b 1) 52 | echo "pdf generated!" 53 | 54 | :help 55 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 56 | 57 | :end 58 | popd 59 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/_version.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """Version of PyPrimeMesh Library.""" 24 | # Version 25 | # ------------------------------------------------------------------------------ 26 | 27 | try: 28 | import importlib.metadata as importlib_metadata 29 | except ModuleNotFoundError: # pragma: no cover 30 | import importlib_metadata # type: ignore 31 | 32 | __version__ = importlib_metadata.version("ansys-meshing-prime") 33 | 34 | # ------------------------------------------------------------------------------ 35 | -------------------------------------------------------------------------------- /tests/internals/test_utils.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | from logging import Logger 24 | 25 | from ansys.meshing.prime.internals.utils import print_logs_after_command, to_camel_case 26 | 27 | 28 | def test_to_camelcase(): 29 | test_string = "snake_case_example" 30 | final_string = to_camel_case(test_string) 31 | assert "snakeCaseExample" == final_string 32 | 33 | 34 | def test_logger(): 35 | command = "ls" 36 | args = ["-la"] 37 | log = Logger(name="Test logger") 38 | log.setLevel(level="DEBUG") 39 | # there are bugs in this function 40 | # print_logs_before_command(log, command, args) 41 | print_logs_after_command(log, command, "ret") 42 | -------------------------------------------------------------------------------- /doc/source/user_guide/graphics.rst: -------------------------------------------------------------------------------- 1 | .. _ref_index_graphics: 2 | 3 | ********************************** 4 | Interactive graphics using PyVista 5 | ********************************** 6 | PyPrimeMesh provides support for interactive graphical visualisation using `PyVista `_ 7 | if this package is installed as a dependency. 8 | 9 | This code shows how to display the model using the :class:`Graphics ` class: 10 | 11 | .. code-block:: pycon 12 | 13 | >>> from ansys.meshing.prime.graphics import PrimePlotter 14 | >>> import ansys.meshing.prime as prime 15 | >>> display = PrimePlotter() 16 | >>> display.plot(model) 17 | >>> display.show() 18 | 19 | 20 | .. figure:: ../images/graphics.png 21 | :width: 400pt 22 | :align: center 23 | 24 | **Entire model displayed** 25 | 26 | Using the :class:`ScopeDefinition ` class allows 27 | you to limit the display to particular regions of the model: 28 | 29 | .. code-block:: pycon 30 | 31 | >>> # display the first part only 32 | >>> display = PrimePlotter() 33 | >>> display.plot( 34 | ... model, scope=prime.ScopeDefinition(model, part_expression=model.parts[0].name) 35 | ... ) 36 | >>> display.show() 37 | 38 | 39 | .. figure:: ../images/graphics_part.png 40 | :width: 400pt 41 | :align: center 42 | 43 | **Single part displayed** 44 | 45 | Selections can be made of displayed objects. If selections in the window are made, 46 | information about them can be printed to the console. Selections can also be hidden. 47 | 48 | These graphics buttons are provided to help navigate the model and to 49 | carry out basic verifications: 50 | 51 | .. figure:: ../images/graphics_buttons(2).png 52 | :width: 200pt 53 | :align: center 54 | 55 | **Graphics buttons** 56 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 24 | 25 | # Security Policy 26 | 27 | ## Reporting a vulnerability 28 | 29 | > [!CAUTION] 30 | > Do not use GitHub issues to report any security vulnerabilities. 31 | 32 | If you detect a vulnerability, contact the [PyAnsys Core team](mailto:pyansys.core@ansys.com), 33 | mentioning the repository and the details of your finding. The team will address it as soon as possible. 34 | 35 | Provide the PyAnsys Core team with this information: 36 | 37 | - Any specific configuration settings needed to reproduce the problem 38 | - Step-by-step guidance to reproduce the problem 39 | - The exact location of the problematic source code, including tag, branch, commit, or a direct URL 40 | - The potential consequences of the vulnerability, along with a description of how an attacker could take advantage of the issue 41 | -------------------------------------------------------------------------------- /tests/core/test_surfaceutilities.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """Tests for surfaceutilities module.""" 24 | 25 | import ansys.meshing.prime as prime 26 | 27 | 28 | def test_surface_utilities(initialized_model_elbow): 29 | """Tests the SurfaceUtilities class initialization and methods.""" 30 | model: prime.Model 31 | model, _ = initialized_model_elbow 32 | surf_utils = prime.SurfaceUtilities(model) 33 | 34 | # get the zonelets from one of the parts 35 | face_zonelets = model.parts[0].get_face_zonelets() 36 | 37 | # add some thickness to the selected face zonelets 38 | surf_utils_params = prime.AddThicknessParams(model, 0.3, False) 39 | 40 | result = surf_utils.add_thickness(face_zonelets, surf_utils_params) 41 | assert result.error_code is prime.ErrorCode.NOERROR 42 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/internals/comm_manager.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in all 12 | # copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | # SOFTWARE. 21 | 22 | """Wrapper module for Communicator class.""" 23 | from ansys.meshing.prime.internals.communicator import Communicator 24 | 25 | 26 | class CommunicationManager: 27 | """Provides the wrapper class for the communicator. 28 | 29 | Parameters 30 | ---------- 31 | comm : Communicator 32 | Wrapped ``Communicator`` class. 33 | """ 34 | 35 | def __init__(self, comm: Communicator): 36 | """Initialize the communicator.""" 37 | self._comm = comm 38 | 39 | @property 40 | def _communicator(self): 41 | """Getter for the communicator. 42 | 43 | Returns 44 | ------- 45 | Communicator 46 | Wrapped communicator. 47 | """ 48 | return self._comm 49 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/autogen/coreobject.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """ Auto-generated file. DO NOT MODIFY """ 24 | from __future__ import annotations 25 | from ansys.meshing.prime.internals.comm_manager import CommunicationManager 26 | from typing import List, Any, Union 27 | 28 | class CoreObject(object): 29 | """ 30 | 31 | """ 32 | 33 | __isfrozen = False 34 | 35 | def __setattr__(self, key, value) : 36 | """ __setattr__(CoreObject self, key, value)""" 37 | if self.__isfrozen and not hasattr(self, key) : 38 | raise TypeError("%r is an invalid attribute" % key) 39 | object.__setattr__(self, key, value) 40 | 41 | def _freeze(self) : 42 | """ _freeze(CoreObject self)""" 43 | self.__isfrozen = True 44 | 45 | def _unfreeze(self) : 46 | """ _freeze(CoreObject self)""" 47 | self.__isfrozen = False 48 | -------------------------------------------------------------------------------- /tests/internals/test_logger.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | import datetime 24 | 25 | from ansys.meshing.prime.internals.logger import PrimeLogger 26 | 27 | 28 | def test_logger(tmp_path): 29 | logs_path = str(tmp_path) + "/logs" 30 | prime_logger_setup = PrimeLogger(logger_name="Test_logger") 31 | prime_logger_setup.add_file_handler(log_dir=logs_path) 32 | logger = prime_logger_setup.python_logger 33 | 34 | logger.setLevel("INFO") 35 | msg = "this is an error" 36 | logger.error(msg) 37 | 38 | now = datetime.datetime.now() 39 | 40 | # Another call to singleton, should be configured already 41 | prime_logger_setup_2 = PrimeLogger() 42 | logger_2 = prime_logger_setup_2.python_logger 43 | msg_2 = "this is another error" 44 | logger_2.error(msg_2) 45 | 46 | # Assert we are using a singleton. 47 | with open(logs_path + '/log_' + now.strftime("%Y-%m-%d") + '.log', 'r') as file: 48 | line_1 = file.readline() 49 | assert msg in line_1 50 | line_2 = file.readline() 51 | assert msg_2 in line_2 52 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/internals/grpc_utils.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in all 12 | # copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | # SOFTWARE. 21 | 22 | """Module for gRPC utilities.""" 23 | import ansys.meshing.prime.internals.defaults as defaults 24 | 25 | 26 | def get_default_channel_args(): 27 | """Get default channel arguments for gRPC. 28 | 29 | Returns 30 | ------- 31 | List 32 | List with channel parameters. 33 | """ 34 | import os 35 | 36 | return ( 37 | [ 38 | # ('grpc.keepalive_time_ms', 60000), # 1 minute 39 | ('grpc.keepalive_timeout_ms', 60000), # 60 seconds 40 | ('grpc.keepalive_permit_without_calls', True), 41 | ('grpc.http2.max_pings_without_data', 0), # Disable 42 | ('grpc.max_send_message_length', defaults.max_message_length()), 43 | ('grpc.max_receive_message_length', defaults.max_message_length()), 44 | ] 45 | if "PYPRIMEMESH_DEVELOPER_MODE" not in os.environ 46 | else [ 47 | ('grpc.max_send_message_length', defaults.max_message_length()), 48 | ('grpc.max_receive_message_length', defaults.max_message_length()), 49 | ] 50 | ) 51 | -------------------------------------------------------------------------------- /tests/core/conftest.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """Fixtures for the core modules.""" 24 | import pytest 25 | 26 | import ansys.meshing.prime as prime 27 | 28 | 29 | @pytest.fixture(scope="module") 30 | def initialized_model_elbow(get_remote_client, get_examples): 31 | """Gets the elbow example and initializes the model and its mesher. Returns the initialized 32 | model and mesher.""" 33 | # load example from fixture 34 | elbow_lucid = get_examples["elbow_lucid"] 35 | 36 | # initialize model from fixture 37 | model = get_remote_client.model 38 | mesher = prime.lucid.Mesh(model) 39 | mesher.read(file_name=elbow_lucid) 40 | return model, mesher 41 | 42 | 43 | @pytest.fixture(scope="module") 44 | def initialized_model_toycar(get_remote_client, get_examples): 45 | """Gets the toy car example and initializes the model and its mesher. Returns the initialized 46 | model and mesher.""" 47 | # load example from fixture 48 | toy_car = get_examples["toy_car"] 49 | 50 | # initialize model from fixture 51 | model = get_remote_client.model 52 | mesher = prime.lucid.Mesh(model) 53 | mesher.read(file_name=toy_car) 54 | return model, mesher 55 | -------------------------------------------------------------------------------- /tests/test_elbow_lucid_regression.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """Integration test for the elbow example.""" 24 | import math 25 | 26 | import ansys.meshing.prime as prime 27 | 28 | 29 | def test_elbow_lucid(get_remote_client, get_examples): 30 | """Tests an use case with the elbow example.""" 31 | # downloads pmdat file 32 | elbow_lucid = get_examples["elbow_lucid"] 33 | # reads file 34 | model = get_remote_client.model 35 | fileIO = prime.FileIO(model=model) 36 | mesher = prime.lucid.Mesh(model) 37 | mesher.read(file_name=elbow_lucid) 38 | mesher.create_zones_from_labels("inlet,outlet") 39 | mesher.surface_mesh(min_size=5, max_size=20) 40 | result = mesher.volume_mesh( 41 | prism_layers=3, 42 | prism_surface_expression="* !inlet !outlet", 43 | volume_fill_type=prime.VolumeFillType.POLY, 44 | ) 45 | part = model.get_part_by_name("flow_volume") 46 | part_summary_res = part.get_summary(prime.PartSummaryParams(model=model)) 47 | # validate number of face zones 48 | assert part_summary_res.n_face_zones == 2 49 | 50 | # validate number of tri faces 51 | assert part_summary_res.n_tri_faces == 0 52 | 53 | # validate number of poly faces 54 | assert math.isclose(1964.0, float(part_summary_res.n_poly_faces), rel_tol=0.02) 55 | 56 | # validate number of poly cells 57 | assert math.isclose(7613.0, float(part_summary_res.n_poly_cells), rel_tol=0.02) 58 | -------------------------------------------------------------------------------- /tests/graphics/test_graphics.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """Module for testing plotter related functions.""" 24 | from pathlib import Path 25 | 26 | import pyvista as pv 27 | 28 | import ansys.meshing.prime as prime 29 | from ansys.meshing.prime.core.mesh import ( 30 | compute_distance, 31 | compute_face_list_from_structured_nodes, 32 | ) 33 | from ansys.meshing.prime.graphics import PrimePlotter 34 | 35 | pv.OFF_SCREEN = True 36 | IMAGE_RESULTS_DIR = Path(Path(__file__).parent, "image_cache", "results") 37 | 38 | 39 | def test_plotter(get_remote_client, get_examples, verify_image_cache): 40 | """Test the basic functionality of the plotter.""" 41 | mixing_elbow = get_examples["elbow_lucid"] 42 | model = get_remote_client.model 43 | mesh_util = prime.lucid.Mesh(model=model) 44 | mesh_util.read(mixing_elbow) 45 | 46 | mesh_util.surface_mesh(min_size=5, max_size=20) 47 | mesh_util.volume_mesh( 48 | volume_fill_type=prime.VolumeFillType.POLY, 49 | prism_surface_expression="* !inlet !outlet", 50 | prism_layers=3, 51 | ) 52 | 53 | display = PrimePlotter() 54 | display.plot(model) 55 | display.show() 56 | 57 | 58 | def test_compute_distance(): 59 | point1 = [1, 1, 3] 60 | point2 = [1, 1, 1] 61 | assert compute_distance(point1=point1, point2=point2) == 2.0 62 | 63 | 64 | def test_compute_face_list(): 65 | dim = [] 66 | dim.append(2) 67 | dim.append(2) 68 | dim.append(2) 69 | flist = compute_face_list_from_structured_nodes(dim) 70 | assert len(flist) == 30 71 | -------------------------------------------------------------------------------- /tests/test_pipe_tee_junction.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """Integration test for pipe tee example.""" 24 | import math 25 | 26 | import ansys.meshing.prime as prime 27 | 28 | 29 | def test_pipe_tee_junction(get_remote_client, get_examples): 30 | """Tests an use case with the pipe tee example.""" 31 | 32 | # downloads pmdat file 33 | pipe_tee = get_examples["pipe_tee"] 34 | # reads file 35 | model = get_remote_client.model 36 | fileIO = prime.FileIO(model=model) 37 | mesher = prime.lucid.Mesh(model) 38 | mesher.read(file_name=pipe_tee) 39 | wrap = mesher.wrap(min_size=6, region_extract=prime.WrapRegion.LARGESTINTERNAL) 40 | # set global sizing 41 | params = prime.GlobalSizingParams(model, min=6, max=50) 42 | model.set_global_sizing_params(params) 43 | 44 | mesher.create_zones_from_labels("outlet_main,in1_inlet,in2_inlet") 45 | 46 | mesher.volume_mesh( 47 | prism_layers=5, 48 | prism_surface_expression="* !*inlet* !*outlet*", 49 | volume_fill_type=prime.VolumeFillType.POLY, 50 | ) 51 | # Get statistics on the mesh 52 | part = model.get_part_by_name("__wrap__") 53 | part_summary_res = part.get_summary(prime.PartSummaryParams(model=model)) 54 | # validate number of tri faces 55 | assert part_summary_res.n_tri_faces == 0 56 | 57 | # validate number of poly faces 58 | assert math.isclose(16717, float(part_summary_res.n_poly_faces), rel_tol=0.02) 59 | # validate number of poly cells 60 | assert math.isclose(97341, float(part_summary_res.n_poly_cells), rel_tol=0.05) 61 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/examples/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | from .download_utilities import DownloadManager 24 | from .examples import ( 25 | download_block_model_fmd, 26 | download_block_model_pmdat, 27 | download_block_model_scdoc, 28 | download_bracket_dsco, 29 | download_bracket_fmd, 30 | download_bracket_scdoc, 31 | download_deformed_blade_dsco, 32 | download_deformed_blade_fmd, 33 | download_deformed_blade_scdoc, 34 | download_elbow_dsco, 35 | download_elbow_fmd, 36 | download_elbow_pmdat, 37 | download_elbow_scdoc, 38 | download_f1_rw_drs_stl, 39 | download_f1_rw_enclosure_stl, 40 | download_f1_rw_end_plates_stl, 41 | download_f1_rw_main_plane_stl, 42 | download_multi_layer_quad_mesh_pcb_dsco, 43 | download_multi_layer_quad_mesh_pcb_fmd, 44 | download_multi_layer_quad_mesh_pcb_pmdat, 45 | download_multi_layer_quad_mesh_pcb_pmdb, 46 | download_multi_layer_quad_mesh_pcb_scdoc, 47 | download_pcb_pmdat, 48 | download_pcb_scdoc, 49 | download_pipe_tee_dsco, 50 | download_pipe_tee_fmd, 51 | download_pipe_tee_pmdat, 52 | download_pipe_tee_scdoc, 53 | download_saddle_bracket_dsco, 54 | download_saddle_bracket_fmd, 55 | download_saddle_bracket_scdoc, 56 | download_solder_ball_fmd, 57 | download_solder_ball_target_fmd, 58 | download_toy_car_dsco, 59 | download_toy_car_fmd, 60 | download_toy_car_pmdat, 61 | download_toy_car_scdoc, 62 | download_turbine_blade_cdb, 63 | download_wheel_ground_dsco, 64 | download_wheel_ground_fmd, 65 | download_wheel_ground_scdoc, 66 | ) 67 | from .unit_test_examples import download_test_examples 68 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/lucid/utils.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """Util functions for lucid modules.""" 24 | import re 25 | 26 | 27 | def match_pattern(pattern: str, name: str) -> bool: 28 | """Pattern matching function for strings. 29 | 30 | Parameters 31 | ---------- 32 | pattern : str 33 | Pattern you are looking for in the string. 34 | name : str 35 | String where you look for patterns. 36 | 37 | Returns 38 | ------- 39 | bool 40 | True if the pattern is found. 41 | """ 42 | pattern = "^" + pattern.replace("*", ".*").replace("?", ".") + "$" 43 | x = re.search(pattern, name) 44 | if x: 45 | return True 46 | else: 47 | return False 48 | 49 | 50 | def check_name_pattern(name_patterns: str, name: str) -> bool: 51 | """Check several patterns in one string. 52 | 53 | Parameters 54 | ---------- 55 | name_patterns : str 56 | Patterns to check, separated by commas. 57 | If pattern starts with !, it shouldn't be found. 58 | name : str 59 | String where you look for patterns. 60 | 61 | Returns 62 | ------- 63 | bool 64 | True if all found. 65 | """ 66 | patterns = [] 67 | a = name_patterns.split(",") 68 | for aa in a: 69 | patterns.append(aa) 70 | 71 | for pattern in patterns: 72 | bb = pattern.split("!") 73 | if match_pattern(bb[0].strip(), name): 74 | if len(bb) > 1: 75 | nv = False 76 | for nvbb in bb[1:]: 77 | if match_pattern(nvbb.strip(), name): 78 | nv = True 79 | break 80 | if not nv: 81 | return True 82 | else: 83 | return True 84 | 85 | return False 86 | -------------------------------------------------------------------------------- /doc/source/user_guide/solver_translation.rst: -------------------------------------------------------------------------------- 1 | .. _ref_index_solver_translation: 2 | 3 | ****************** 4 | Solver translation 5 | ****************** 6 | 7 | Solver translation (FE2Ansys) translates Abaqus INP files to Ansys CDB and K files (MAPDL and LS-DYNA). 8 | The translation ensures that the Abaqus model can be used in Ansys without recreating from scratch. 9 | It helps to save time and effort even though minor manual adjustments may be required. 10 | The manual adjustments like redefining boundary conditions, loads, and material properties, 11 | ensures that the model behaves as expected in Ansys solver deck. 12 | 13 | The following example shows the translation of Abaqus INP file to CDB file format: 14 | 15 | 1. Import the Abaqus INP file. 16 | 17 | .. code-block:: python 18 | 19 | file_io = prime.FileIO(model=model) 20 | import_results = file_io.import_abaqus_inp( 21 | r"E:/test2/Abaqus_Input_multistep.inp", 22 | prime.ImportAbaqusParams(model), 23 | ) 24 | print(import_results) 25 | 26 | The import_abaqus_inp imports the INP file as mesh, extracts simulation specific information from the INP file and 27 | stores the information internally as a JSON document. :class:`ImportAbaqusParams ` 28 | allows you to set the parameters for importing the model. The example uses default parameters for importing the model. 29 | 30 | **Output**: 31 | 32 | .. figure:: ../images/fe2ansys_abaqus_import.png 33 | 34 | Here, the import summary provides information on the following: 35 | 36 | - Total number of keywords in the imported file. 37 | 38 | - Total number of processed keywords. 39 | 40 | - Total number of skipped or unprocessed keywords. 41 | 42 | - Number of imported nodes. 43 | 44 | - Number of imported elements(solid, shell, beam and more). 45 | 46 | - Number and type of skipped elements. 47 | 48 | - Ids of imported nodes and elements. 49 | 50 | - Number of errors and warnings that occurred while importing the file. 51 | 52 | 53 | 2. Export the CDB file. 54 | 55 | .. code-block:: python 56 | 57 | export_cdb_result = file_io.export_mapdl_cdb( 58 | r"E:\test3\Abaqus_Input_multistep.cdb", 59 | prime.ExportMapdlCdbParams(model), 60 | ) 61 | print(export_cdb_result) 62 | 63 | :class:`ExportMapdlCdbParams ` allows setting parameters to control 64 | the export of MAPDL CDB files. 65 | 66 | :class:`ExportMapdlCdbResults ` contains the summary 67 | result of the export process in json format. This writes the CDB file to the specified location. 68 | 69 | .. figure:: ../images/fe2ansys_cdb_export.png 70 | 71 | CDB Export summary provides information about: 72 | 73 | - Number of error and warnings that occurred while exporting the CDB file. 74 | 75 | - Maximum number of node ids and elements ids that are exported. 76 | 77 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/core/prismcontrol.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in all 12 | # copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | # SOFTWARE. 21 | 22 | """Module containing PrismControl related classes and methods.""" 23 | from ansys.meshing.prime.autogen.prismcontrol import PrismControl as _PrismControl 24 | 25 | # isort: split 26 | from ansys.meshing.prime.autogen.commonstructs import SetNameResults 27 | 28 | 29 | class PrismControl(_PrismControl): 30 | """PrismControl allows you to generate prisms. 31 | 32 | PrismControl allows you to control generation of prisms. 33 | Controls include setting the face scope, volume scope and growth parameters. 34 | 35 | Parameters 36 | ---------- 37 | model : Model 38 | Server model to create PrismControl object. 39 | id : int 40 | Id of the PrismControl. 41 | object_id : int 42 | Object id of the PrismControl. 43 | name : str 44 | Name of the PrismControl. 45 | """ 46 | 47 | def __init__(self, model, id, object_id, name, local=False): 48 | """Initialize class variables and the superclass.""" 49 | _PrismControl.__init__(self, model, id, object_id, name) 50 | self._model = model 51 | self._name = name 52 | 53 | def set_suggested_name(self, name: str) -> SetNameResults: 54 | """Set the unique name for the prism control based on the suggested name. 55 | 56 | Parameters 57 | ---------- 58 | name : str 59 | Suggested name for the prism control. 60 | 61 | Returns 62 | ------- 63 | SetNameResults 64 | Returns the SetNameResults. 65 | 66 | 67 | Examples 68 | -------- 69 | >>> prism_control.set_suggested_name("control1") 70 | 71 | """ 72 | result = _PrismControl.set_suggested_name(self, name) 73 | self._name = result.assigned_name 74 | return result 75 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/examples/unit_test_examples.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | import os 24 | from typing import Optional, Union 25 | 26 | from .download_utilities import DownloadManager 27 | 28 | FILE_NAMES = [ 29 | "box.psf", 30 | "box.sf", 31 | "file.cas", 32 | "file.pdmat", 33 | "file.pmdat", 34 | "hex.cas", 35 | "hex.cdb", 36 | "hex.fmd", 37 | "hex.msh", 38 | ] 39 | 40 | 41 | def download_test_examples( 42 | destination: Optional[str] = None, force: bool = False 43 | ) -> Union[str, os.PathLike]: 44 | """Download the example files necessary for unit testing. 45 | 46 | Parameters 47 | ---------- 48 | destination : str, optional 49 | Path to download the test example files to. The default 50 | is ``None``, in which case the default path for app data 51 | is used. 52 | force : bool, optional 53 | Whether to always download the test example files. The default is 54 | ``False``, in which case if the test example files are cached, they 55 | are reused. 56 | 57 | Returns 58 | ------- 59 | List[str] 60 | Local paths to the downloaded test example files. 61 | 62 | Examples 63 | -------- 64 | >>> import ansys.meshing.prime as prime 65 | >>> import ansys.meshing.prime.examples as prime_examples 66 | >>> with prime.launch_prime() as session: 67 | >>> model = session.model 68 | >>> examples = prime_examples.unit_test_examples.download_test_examples() 69 | 70 | 71 | """ 72 | 73 | download_manager = DownloadManager() 74 | unit_test_paths = [ 75 | download_manager.download_file( 76 | file, 'pyprimemesh', 'unit_test_examples', destination=destination, force=force 77 | ) 78 | for file in FILE_NAMES 79 | ] 80 | return unit_test_paths 81 | -------------------------------------------------------------------------------- /tests/test_elbow_scdoc.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | import os 24 | import platform 25 | import tempfile 26 | 27 | import pytest 28 | 29 | from ansys.meshing import prime 30 | from ansys.meshing.prime.graphics import PrimePlotter 31 | 32 | 33 | @pytest.mark.skipif(platform.system() != 'Windows', reason="Windows specific test.") 34 | def test_elbow_lucid(get_remote_client, get_examples): 35 | """Tests an use case with the elbow example.""" 36 | 37 | model = get_remote_client.model 38 | prime_client = prime.launch_prime() 39 | mesh_util = prime.lucid.Mesh(model=model) 40 | 41 | mixing_elbow = get_examples["elbow_lucid_scdoc"] 42 | mesh_util.read(file_name=mixing_elbow) 43 | mesh_util.create_zones_from_labels("inlet,outlet") 44 | 45 | mesh_util.surface_mesh(min_size=5, max_size=20) 46 | 47 | mesh_util.volume_mesh( 48 | volume_fill_type=prime.VolumeFillType.POLY, 49 | prism_surface_expression="* !inlet !outlet", 50 | prism_layers=3, 51 | ) 52 | 53 | display = PrimePlotter() 54 | display.plot(model=model) 55 | display.show() 56 | 57 | part = model.get_part_by_name("flow_volume") 58 | 59 | part_summary_res = part.get_summary(prime.PartSummaryParams(model=model)) 60 | 61 | search = prime.VolumeSearch(model=model) 62 | params = prime.VolumeQualitySummaryParams( 63 | model=model, 64 | scope=prime.ScopeDefinition(model=model, part_expression="*"), 65 | cell_quality_measures=[prime.CellQualityMeasure.SKEWNESS], 66 | quality_limit=[0.95], 67 | ) 68 | results = search.get_volume_quality_summary(params=params) 69 | 70 | with tempfile.TemporaryDirectory() as temp_folder: 71 | mesh_file = os.path.join(temp_folder, "mixing_elbow.cas") 72 | mesh_util.write(mesh_file) 73 | assert os.path.exists(mesh_file) 74 | prime_client.exit() 75 | -------------------------------------------------------------------------------- /doc/source/user_guide/matchmorph.rst: -------------------------------------------------------------------------------- 1 | .. _ref_index_matchmorph: 2 | 3 | 4 | ************** 5 | Match morphing 6 | ************** 7 | 8 | :func:`Morpher.match_morph() ` method performs face to face entity matching, providing the ability to match face pairs using match pairs. 9 | The method allows the source face to match with the corresponding target face. :class:`MatchPair ` allows you to specify sources and targets for 10 | match morphing. 11 | 12 | .. note:: 13 | Match pairs should have the same type of entities for matching. 14 | 15 | :func:`Morpher.match_morph() ` performs the following: 16 | 17 | - Matches the boundaries of the source and targets using the specified boundary condition pairs. 18 | - Matches the source entities to the target entities using the specified match pairs. 19 | - Ensures the adjacent entities to the boundaries of the matched entities are adjusted to provide a quality mesh. 20 | 21 | The below example shows how to match morph a cube of hexahedral mesh with quadratic elements to the shape of a sphere: 22 | 23 | Get the source and target faces from the source part and target part respectively. 24 | 25 | .. code-block:: python 26 | 27 | source_part = model.get_part_by_name("hex-mesh") 28 | target_part = model.get_part_by_name("sphere-topo") 29 | source = target_part.get_face_zonelets() 30 | target = source_part.get_topo_faces() 31 | 32 | .. figure:: ../images/matchmorph_source.png 33 | :width: 800pt 34 | :align: center 35 | 36 | **Source part (mesh)** 37 | 38 | .. figure:: ../images/matchmorph_target.png 39 | :width: 800pt 40 | :align: center 41 | 42 | **Target part (topology)** 43 | 44 | Initialize match morph parameters, morpher boundary condition parameters and morpher solver parameters. 45 | 46 | .. code-block:: python 47 | 48 | match_morph_params = prime.MatchMorphParams(model=model) 49 | bc_params = prime.MorphBCParams( 50 | model=model, 51 | morph_region_method=prime.BCsVolumetricModality.ALL, 52 | morphable_layers=1, 53 | morph_region_box_extension=0, 54 | ) 55 | solver_params = prime.MorphSolveParams(model=model) 56 | 57 | Set the source and target pairs for matching and specify the entity type of target surfaces. 58 | 59 | .. code-block:: python 60 | 61 | match_pairs = [] 62 | match_pair = prime.MatchPair( 63 | model=model, 64 | source_surfaces=source, 65 | target_surfaces=target, 66 | target_type=prime.MatchPairTargetType.TOPOFACE, 67 | ) 68 | match_pairs = [match_pair] 69 | 70 | Perform match morphing using the match pairs, match morph parameters, boundary condition parameters and solver parameters. 71 | 72 | .. code-block:: python 73 | 74 | morpher = prime.Morpher(model=model) 75 | morpher.match_morph( 76 | part_id=source_part.id, 77 | match_pairs=match_pairs, 78 | match_morph_params=match_morph_params, 79 | bc_params=bc_params, 80 | solve_params=solver_params, 81 | ) 82 | 83 | .. figure:: ../images/matchmorphafter.png 84 | :width: 800pt 85 | :align: center 86 | 87 | **Mesh morphed and displayed (topology deleted)** 88 | 89 | 90 | -------------------------------------------------------------------------------- /tests/test_bracket_scaffold.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """Integration test for the bracket scaffold example.""" 24 | import math 25 | 26 | import ansys.meshing.prime as prime 27 | 28 | 29 | def test_bracket_scaffold(get_remote_client, get_examples): 30 | """Tests an use case with the bracket scaffold example.""" 31 | # downloads file 32 | bracket_file = get_examples["bracket"] 33 | model = get_remote_client.model 34 | # import cad model 35 | file_io = prime.FileIO(model) 36 | file_io.import_cad( 37 | file_name=bracket_file, 38 | params=prime.ImportCadParams( 39 | model=model, 40 | length_unit=prime.LengthUnit.MM, 41 | part_creation_type=prime.PartCreationType.MODEL, 42 | ), 43 | ) 44 | part = model.get_part_by_name('bracket_mid_surface-3') 45 | part_summary_res = part.get_summary(prime.PartSummaryParams(model, print_mesh=False)) 46 | # Validate topo faces and edges 47 | assert math.isclose(67, float(part_summary_res.n_topo_edges), rel_tol=0.05) 48 | assert math.isclose(9, float(part_summary_res.n_topo_faces), rel_tol=0.02) 49 | # target element size 50 | element_size = 0.5 51 | 52 | params = prime.ScaffolderParams( 53 | model, 54 | absolute_dist_tol=0.1 * element_size, 55 | intersection_control_mask=prime.IntersectionMask.FACEFACEANDEDGEEDGE, 56 | constant_mesh_size=element_size, 57 | ) 58 | # Get existing topoface/topoedge ids 59 | faces = part.get_topo_faces() 60 | beams = [] 61 | 62 | scaffold_res = prime.Scaffolder(model, part.id).scaffold_topo_faces_and_beams( 63 | topo_faces=faces, topo_beams=beams, params=params 64 | ) 65 | # Validate scaffold Operation 66 | assert scaffold_res.error_code == prime.ErrorCode.NOERROR 67 | # Mesh topofaces with constant size and generate quad elements. 68 | surfer_params = prime.SurferParams( 69 | model=model, 70 | size_field_type=prime.SizeFieldType.CONSTANT, 71 | constant_size=element_size, 72 | generate_quads=True, 73 | ) 74 | surfer_result = prime.Surfer(model).mesh_topo_faces( 75 | part.id, topo_faces=faces, params=surfer_params 76 | ) 77 | # Validate scaffold Operation 78 | assert surfer_result.error_code == prime.ErrorCode.NOERROR 79 | -------------------------------------------------------------------------------- /examples/other/elbow_trame.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """ 24 | .. _ref_mixing_elbow_mesh_trame: 25 | 26 | =========================================== 27 | Meshing a Mixing Elbow for showcasing Trame 28 | =========================================== 29 | 30 | **Summary**: This example demonstrates how to use the Trame visualizer in PyPrime. 31 | 32 | Objective 33 | ~~~~~~~~~ 34 | 35 | In this example, you can see how to use the Trame visualizer using the mixing elbow 36 | as an example. 37 | 38 | """ 39 | 40 | ############################################################################### 41 | # Launch Ansys Prime Server 42 | # ~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | # Import all necessary modules. 44 | # Launch an instance of Ansys Prime Server. 45 | # Connect PyPrimeMesh client and get the model. 46 | # Instantiate meshing utilities from Lucid class. 47 | 48 | import ansys.meshing.prime as prime 49 | from ansys.meshing.prime.graphics import PrimePlotter 50 | 51 | # start Ansys Prime Server and get client model 52 | prime_client = prime.launch_prime() 53 | model = prime_client.model 54 | 55 | ############################################################################### 56 | # Import Geometry 57 | # ~~~~~~~~~~~~~~~ 58 | # Download the elbow geometry file (.fmd file exported by SpaceClaim). 59 | # Import geometry. 60 | 61 | mesh_util = prime.lucid.Mesh(model=model) 62 | mixing_elbow = prime.examples.download_elbow_fmd() 63 | mesh_util.read(mixing_elbow) 64 | print(model) 65 | 66 | 67 | mesh_util.surface_mesh(min_size=5, max_size=20) 68 | mesh_util.volume_mesh( 69 | volume_fill_type=prime.VolumeFillType.POLY, 70 | prism_surface_expression="* !inlet !outlet", 71 | prism_layers=3, 72 | ) 73 | 74 | ############################################################################### 75 | # Rendering graphics in Trame 76 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 | # When you want to display graphics using Trame, you just need to set the 78 | # ``use_trame`=True``. When the ``display()`` function executes, it 79 | # opens the visualizer in a browser window. 80 | 81 | display = PrimePlotter(use_trame=True) 82 | display.plot(model) 83 | display.show() 84 | 85 | 86 | ############################################################################### 87 | # Stopping Ansys Prime Server 88 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | # 90 | prime_client.exit() 91 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/widgets/toggle_edges.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | """Module for ToggleEdges widget.""" 23 | import os 24 | from typing import TYPE_CHECKING 25 | 26 | from ansys.tools.visualization_interface.backends.pyvista.widgets import PlotterWidget 27 | from vtk import vtkPNGReader 28 | 29 | if TYPE_CHECKING: 30 | from ansys.meshing.prime.graphics.plotter import PrimePlotter 31 | 32 | 33 | class ToggleEdges(PlotterWidget): 34 | """Toggles the edges of the mesh objects. 35 | 36 | Parameters 37 | ---------- 38 | prime_plotter : PrimePlotter 39 | Plotter to apply this widget to. 40 | """ 41 | 42 | def __init__(self, prime_plotter: "PrimePlotter") -> None: 43 | """Initialize the widget.""" 44 | super().__init__(prime_plotter._backend._pl.scene) 45 | self.prime_plotter = prime_plotter 46 | self._object_actors_map = self.prime_plotter._backend._object_to_actors_map 47 | self._button = self.prime_plotter._backend._pl.scene.add_checkbox_button_widget( 48 | self.callback, 49 | position=(5, 600), 50 | size=30, 51 | border_size=3, 52 | color_off="white", 53 | color_on="white", 54 | ) 55 | self._info_actor_map = self.prime_plotter._info_actor_map 56 | 57 | def callback(self, state: bool) -> None: 58 | """Toggle the edges of the mesh objects. 59 | 60 | Parameters 61 | ---------- 62 | state : bool 63 | Whether the button widget is activated. 64 | """ 65 | for key, actor in self.prime_plotter._backend._pl.scene.actors.items(): 66 | if actor in self._info_actor_map and self._info_actor_map[actor].has_mesh: 67 | actor.prop.show_edges = not state 68 | 69 | def update(self) -> None: 70 | """Define the configuration and representation of the button widget button.""" 71 | show_point_vr = self._button.GetRepresentation() 72 | show_point_icon_file = os.path.join(os.path.dirname(__file__), "images", "show_edges.png") 73 | show_point_r = vtkPNGReader() 74 | show_point_r.SetFileName(show_point_icon_file) 75 | show_point_r.Update() 76 | image = show_point_r.GetOutput() 77 | show_point_vr.SetButtonTexture(0, image) 78 | show_point_vr.SetButtonTexture(1, image) 79 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/internals/communicator.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in all 12 | # copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | # SOFTWARE. 21 | 22 | """Module for abstract communicator.""" 23 | from abc import abstractmethod 24 | 25 | 26 | class Communicator(object): 27 | """Provides the abstract class for the server communicator.""" 28 | 29 | @abstractmethod 30 | def serve(self, model, command, *args, **kwargs) -> dict: 31 | """Serve the model and send a command to the server. 32 | 33 | Parameters 34 | ---------- 35 | model : Model 36 | Model to serve. 37 | command : str 38 | Command to send to the server. 39 | 40 | Returns 41 | ------- 42 | dict 43 | Response from the server. 44 | """ 45 | pass 46 | 47 | @abstractmethod 48 | def initialize_params(self, model, param_name: str, *args) -> dict: 49 | """Initialize parameters on the server side. 50 | 51 | Parameters 52 | ---------- 53 | model : Model 54 | Model to initialize parameter on. 55 | param_name : str 56 | Parameter to initialize. 57 | 58 | Returns 59 | ------- 60 | dict 61 | Response from the server. 62 | """ 63 | pass 64 | 65 | @abstractmethod 66 | def run_on_server(self, model, recipe: str) -> dict: 67 | """Run the command on the server side. 68 | 69 | Parameters 70 | ---------- 71 | model : Model 72 | Model to run commands on. 73 | recipe : str 74 | Command to run. 75 | 76 | Returns 77 | ------- 78 | dict 79 | Response from the server. 80 | """ 81 | pass 82 | 83 | @abstractmethod 84 | def import_cad(self, model, file_name: str, *args) -> dict: 85 | """Import a CAD file from local. 86 | 87 | Parameters 88 | ---------- 89 | model : Model 90 | Model to import. 91 | file_name : str 92 | Name of the CAD file. 93 | 94 | Returns 95 | ------- 96 | dict 97 | Response from the server. 98 | """ 99 | pass 100 | 101 | @abstractmethod 102 | def close(self): 103 | """Close communication when deleting the instance.""" 104 | pass 105 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/graphics/widgets/hide_picked.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """This module contains the HidePicked class.""" 24 | import os 25 | from typing import TYPE_CHECKING 26 | 27 | from ansys.tools.visualization_interface.backends.pyvista.widgets import PlotterWidget 28 | from vtk import vtkPNGReader 29 | 30 | if TYPE_CHECKING: 31 | from ansys.meshing.prime.graphics.plotter import PrimePlotter 32 | 33 | 34 | class HidePicked(PlotterWidget): 35 | """Initializes the hide picked button widget. 36 | 37 | This widget lets you hide the picked mesh objects. 38 | 39 | Parameters 40 | ---------- 41 | prime_plotter : Plotter 42 | Plotter to apply this widget to. 43 | """ 44 | 45 | def __init__(self, prime_plotter: "PrimePlotter") -> None: 46 | """Initialize the widget.""" 47 | super().__init__(prime_plotter._backend._pl.scene) 48 | self.prime_plotter = prime_plotter 49 | self._picked_dict = self.prime_plotter._backend._custom_picker._picked_dict 50 | self._object_actors_map = self.prime_plotter._backend._object_to_actors_map 51 | self._button = self.prime_plotter._backend._pl.scene.add_checkbox_button_widget( 52 | self.callback, 53 | position=(5, 660), 54 | size=30, 55 | border_size=3, 56 | color_off="white", 57 | color_on="white", 58 | ) 59 | self._removed_actors = [] 60 | 61 | def callback(self, state: bool) -> None: 62 | """Define callback function for the button widget.""" 63 | if state: 64 | for meshobject in list(self._picked_dict.values()): 65 | self.prime_plotter._backend.pv_interface.scene.remove_actor(meshobject.actor) 66 | self._removed_actors.append(meshobject.actor) 67 | else: 68 | for actor in self._removed_actors: 69 | self.prime_plotter._backend._pl.scene.add_actor(actor) 70 | 71 | def update(self) -> None: 72 | """Define the configuration and representation of the button widget button.""" 73 | vr = self._button.GetRepresentation() 74 | icon_file = os.path.join(os.path.dirname(__file__), "images", "invert_visibility.png") 75 | r = vtkPNGReader() 76 | r.SetFileName(icon_file) 77 | r.Update() 78 | image = r.GetOutput() 79 | vr.SetButtonTexture(0, image) 80 | vr.SetButtonTexture(1, image) 81 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/core/wrappercontrol.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in all 12 | # copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | # SOFTWARE. 21 | 22 | """Module containing WrapperControl related classes and methods.""" 23 | from ansys.meshing.prime.autogen.wrappercontrol import WrapperControl as _WrapperControl 24 | 25 | # isort: split 26 | from ansys.meshing.prime.autogen.commonstructs import SetNameResults as SetNameResults 27 | from ansys.meshing.prime.internals.comm_manager import CommunicationManager 28 | 29 | 30 | class WrapperControl(_WrapperControl): 31 | """Wrapper Control to describe all parameters and controls used for wrapping.. 32 | 33 | Parameters 34 | ---------- 35 | model : Model 36 | Server model to create WrapperControl object. 37 | id : int 38 | Id of the WrapperControl. 39 | object_id : int 40 | Object id of the WrapperControl. 41 | name : str 42 | Name of the WrapperControl. 43 | """ 44 | 45 | def __init__(self, model: CommunicationManager, id: int, object_id: int, name: str): 46 | """Initialize the superclass and the ''Model'' variable.""" 47 | self._model = model 48 | _WrapperControl.__init__(self, model, id, object_id, name) 49 | 50 | def __str__(self) -> str: 51 | """Get a representation of the class in string format. 52 | 53 | Returns 54 | ------- 55 | str 56 | Class data in string format. 57 | """ 58 | return "Not implemented yet" 59 | 60 | def set_suggested_name(self, name: str) -> SetNameResults: 61 | """Set the unique name for the wrapper control based on a suggested name. 62 | 63 | Parameters 64 | ---------- 65 | name : str 66 | Suggested name for the wrapper control. 67 | 68 | Returns 69 | ------- 70 | SetNameResults 71 | Newly assigned name of the wrapper control. 72 | 73 | 74 | Examples 75 | -------- 76 | >>> wrapper_control.set_suggested_name("wrapper_control1") 77 | 78 | """ 79 | result = _WrapperControl.set_suggested_name(self, name) 80 | self._name = result.assigned_name 81 | return result 82 | 83 | @property 84 | def name(self): 85 | """Get the name of the wrapper control. 86 | 87 | Returns 88 | ------- 89 | str 90 | Name of the wrapper control. 91 | 92 | Examples 93 | -------- 94 | >>> print(wrapper_control.name) 95 | 96 | """ 97 | return self._name 98 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/autogen/toposearchstructs.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """ Auto-generated file. DO NOT MODIFY """ 24 | import enum 25 | from typing import Dict, Any, Union, List, Iterable 26 | from ansys.meshing.prime.internals.comm_manager import CommunicationManager 27 | from ansys.meshing.prime.internals import utils 28 | from ansys.meshing.prime.autogen.coreobject import * 29 | import numpy as np 30 | 31 | from ansys.meshing.prime.params.primestructs import * 32 | 33 | class TopoSearchField(enum.IntEnum): 34 | """Toposearch diagnostic field. 35 | """ 36 | OVERLAPPINGTOPOFACES = 0 37 | """Diagnoses overlapping or partially overlapping topofaces. 38 | 39 | **This is a beta parameter**. **The behavior and name may change in the future**.""" 40 | INTERSECTINGTOPOFACES = 1 41 | """Diagnoses intersecting topofaces. 42 | 43 | **This is a beta parameter**. **The behavior and name may change in the future**.""" 44 | SELFINTERSECTINGTOPOFACES = 2 45 | """Diagnoses topofaces with self intersecting bounding edges. 46 | 47 | **This is a beta parameter**. **The behavior and name may change in the future**.""" 48 | BROKENLOOPTOPOFACES = 3 49 | """Diagnoses topofaces with open or broken bounding edge loops. 50 | 51 | **This is a beta parameter**. **The behavior and name may change in the future**.""" 52 | NOBOUNDARYLOOPTOPOFACES = 4 53 | """Diagnoses topofaces without bounding edges. 54 | 55 | **This is a beta parameter**. **The behavior and name may change in the future**.""" 56 | INVALIDBOUNDARYTOPOFACES = 5 57 | """Diagnoses topofaces with incorrect bounding edge orientation. 58 | 59 | **This is a beta parameter**. **The behavior and name may change in the future**.""" 60 | SMALLTOPOEDGES = 6 61 | """Diagnoses topofaces with small topoedges. 62 | 63 | **This is a beta parameter**. **The behavior and name may change in the future**.""" 64 | INCORRECTBOUNDARYORIENTATIONTOPOFACES = 7 65 | """Diagnoses topofaces with incorrect boundary orientations. 66 | 67 | **This is a beta parameter**. **The behavior and name may change in the future**.""" 68 | INCONSISTENTNORMALORIENTATIONTOPOFACES = 8 69 | """Diagnoses topofaces with inconsistent normal orientations. 70 | 71 | **This is a beta parameter**. **The behavior and name may change in the future**.""" 72 | NUMBEROFFIELDS = 9 73 | """Diagnoses all topofaces. 74 | 75 | **This is a beta parameter**. **The behavior and name may change in the future**.""" 76 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/params/primestructs.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in all 12 | # copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | # SOFTWARE. 21 | 22 | """Module for imports of autogen modules.""" 23 | # isort: off 24 | from ansys.meshing.prime.autogen.primeconfig import * 25 | from ansys.meshing.prime.autogen.commontypes import * 26 | from ansys.meshing.prime.autogen.commonstructs import * 27 | 28 | # isort: on 29 | from ansys.meshing.prime.autogen.automeshstructs import * 30 | from ansys.meshing.prime.autogen.autoquadmesherstructs import * 31 | from ansys.meshing.prime.autogen.collapsetoolstructs import * 32 | from ansys.meshing.prime.autogen.connectstructs import * 33 | from ansys.meshing.prime.autogen.controlstructs import * 34 | from ansys.meshing.prime.autogen.deletetoolstructs import * 35 | from ansys.meshing.prime.autogen.featureextractionstructs import * 36 | from ansys.meshing.prime.autogen.fileiostructs import * 37 | from ansys.meshing.prime.autogen.igastructs import * 38 | from ansys.meshing.prime.autogen.materialpointmanagerstructs import * 39 | from ansys.meshing.prime.autogen.meshinfostructs import * 40 | from ansys.meshing.prime.autogen.modelstructs import * 41 | from ansys.meshing.prime.autogen.morpherbcsstructs import * 42 | from ansys.meshing.prime.autogen.morpherstructs import * 43 | from ansys.meshing.prime.autogen.partstructs import * 44 | from ansys.meshing.prime.autogen.periodiccontrolstructs import * 45 | from ansys.meshing.prime.autogen.prismcontrolstructs import * 46 | from ansys.meshing.prime.autogen.scaffolderstructs import * 47 | from ansys.meshing.prime.autogen.shellblcontrolstructs import * 48 | from ansys.meshing.prime.autogen.sizecontrolstructs import * 49 | from ansys.meshing.prime.autogen.sizefieldstructs import * 50 | from ansys.meshing.prime.autogen.splittoolstructs import * 51 | from ansys.meshing.prime.autogen.surfacesearchstructs import * 52 | from ansys.meshing.prime.autogen.surfaceutilitystructs import * 53 | from ansys.meshing.prime.autogen.surferstructs import * 54 | from ansys.meshing.prime.autogen.thinvolumecontrolstructs import * 55 | from ansys.meshing.prime.autogen.topodatastructs import * 56 | from ansys.meshing.prime.autogen.toposearchstructs import * 57 | from ansys.meshing.prime.autogen.topoutilitystructs import * 58 | from ansys.meshing.prime.autogen.transformstructs import * 59 | from ansys.meshing.prime.autogen.trimmedsplinestructs import * 60 | from ansys.meshing.prime.autogen.volumecontrolstructs import * 61 | from ansys.meshing.prime.autogen.volumemeshtoolstructs import * 62 | from ansys.meshing.prime.autogen.volumesearchstructs import * 63 | from ansys.meshing.prime.autogen.volumesweeperstructs import * 64 | from ansys.meshing.prime.autogen.vtcomposerstructs import * 65 | from ansys.meshing.prime.autogen.wrapperstructs import * 66 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/core/volumecontrol.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in all 12 | # copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | # SOFTWARE. 21 | 22 | """Module containing VolumeControl related classes and methods.""" 23 | from ansys.meshing.prime.autogen.volumecontrol import VolumeControl as _VolumeControl 24 | 25 | # isort: split 26 | from ansys.meshing.prime.autogen.commonstructs import SetNameResults 27 | from ansys.meshing.prime.autogen.volumecontrolstructs import VolumeControlParams 28 | 29 | 30 | class VolumeControl(_VolumeControl): 31 | """Defines the scope and type of volume mesh to generate. 32 | 33 | Parameters 34 | ---------- 35 | model : Model 36 | Server model to create VolumeControl object. 37 | id : int 38 | Id of the VolumeControl. 39 | object_id : int 40 | Object id of the VolumeControl. 41 | name : str 42 | Name of the VolumeControl. 43 | """ 44 | 45 | def __init__(self, model, id, object_id, name, local=False): 46 | """Initialize the superclass and the ``model`` variable.""" 47 | _VolumeControl.__init__(self, model, id, object_id, name) 48 | self._model = model 49 | self._name = name 50 | 51 | def __str__(self) -> str: 52 | """Get a representation of the class in string format. 53 | 54 | Returns 55 | ------- 56 | str 57 | Class data in string format. 58 | """ 59 | params = VolumeControlParams(model=self._model) 60 | # TODO: function get_summary() not implemented 61 | result = _VolumeControl.get_summary(self, params) 62 | return result.message 63 | 64 | def set_suggested_name(self, name: str) -> SetNameResults: 65 | """Set the unique name for the volume control based on a suggested name. 66 | 67 | Parameters 68 | ---------- 69 | name : str 70 | Suggested name for the volume control. 71 | 72 | Returns 73 | ------- 74 | SetNameResults 75 | Newly suggested name of the volume control. 76 | 77 | 78 | Examples 79 | -------- 80 | >>> volume_control.set_suggested_name("control1") 81 | 82 | """ 83 | result = _VolumeControl.set_suggested_name(self, name) 84 | self._name = result.assigned_name 85 | return result 86 | 87 | @property 88 | def name(self): 89 | """Get the name of the volume control. 90 | 91 | Returns 92 | ------- 93 | str 94 | Name of the volume control. 95 | 96 | Examples 97 | -------- 98 | >>> print(volume_control.name) 99 | 100 | """ 101 | return self._name 102 | -------------------------------------------------------------------------------- /tests/core/test_surfer.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """This module tests the different methods in Surfer class.""" 24 | import ansys.meshing.prime as prime 25 | 26 | 27 | def test_mesh_topo_faces(initialized_model_elbow): 28 | """Test the meshing for topo faces.""" 29 | # load example from fixture 30 | model: prime.Model 31 | mesher: prime.lucid.Mesh 32 | model, mesher = initialized_model_elbow 33 | mesher.surface_mesh(min_size=1, max_size=200) 34 | 35 | topo_faces = model.parts[0].get_topo_faces() 36 | 37 | surfer = prime.Surfer(model) 38 | surfer_params = prime.SurferParams(model) 39 | results = surfer.mesh_topo_faces(2, topo_faces, surfer_params) 40 | assert results.error_code is prime.ErrorCode.NOERROR 41 | 42 | 43 | def test_remesh_face_zonelets_locally(initialized_model_elbow): 44 | """Test the remeshing of face zonelets locally.""" 45 | # load example from fixture 46 | model: prime.Model 47 | mesher: prime.lucid.Mesh 48 | model, mesher = initialized_model_elbow 49 | mesher.surface_mesh(min_size=1, max_size=200) 50 | 51 | surfer = prime.Surfer(model) 52 | local_surfer_params = prime.LocalSurferParams(model) 53 | 54 | part = model.parts[0] 55 | part.delete_topo_entities( 56 | prime.DeleteTopoEntitiesParams(model, delete_geom_zonelets=False, delete_mesh_zonelets=True) 57 | ) 58 | face_zonelets = part.get_face_zonelets() 59 | results = surfer.remesh_face_zonelets_locally(part.id, face_zonelets, 1, local_surfer_params) 60 | assert results.error_code is prime.ErrorCode.NOERROR 61 | 62 | 63 | def test_remesh_face_zonelets(initialized_model_elbow): 64 | """Test the remeshing of face zonelets.""" 65 | # load example from fixture 66 | model: prime.Model 67 | mesher: prime.lucid.Mesh 68 | model, mesher = initialized_model_elbow 69 | mesher.surface_mesh(min_size=1, max_size=200) 70 | 71 | surfer = prime.Surfer(model) 72 | surfer_params = prime.SurferParams(model) 73 | part = model.parts[0] 74 | part.delete_topo_entities( 75 | prime.DeleteTopoEntitiesParams(model, delete_geom_zonelets=False, delete_mesh_zonelets=True) 76 | ) 77 | face_zonelets = part.get_face_zonelets() 78 | edge_zonelets = part.get_edge_zonelets() 79 | 80 | results = surfer.remesh_face_zonelets(part.id, face_zonelets, edge_zonelets, surfer_params) 81 | assert results.error_code is prime.ErrorCode.NOERROR 82 | 83 | 84 | def test_initialize_surfer_params_for_wrapper(initialized_model_elbow): 85 | """Test the initialization of surfer parameters.""" 86 | model: prime.Model 87 | model, _ = initialized_model_elbow 88 | surfer = prime.Surfer(model) 89 | surfer_params = surfer.initialize_surfer_params_for_wrapper() 90 | assert surfer_params != None 91 | -------------------------------------------------------------------------------- /tests/lucid/test_mesh_utils.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | import os 24 | 25 | import pytest 26 | 27 | from ansys.meshing.prime.lucid.mesh_util import Mesh 28 | 29 | 30 | @pytest.fixture 31 | def mesh(get_remote_client): 32 | model = get_remote_client.model 33 | mesh = Mesh(model) 34 | return mesh 35 | 36 | 37 | def test_read(mesh): 38 | mesh.read(os.path.abspath("./tests/core/test_files/hex.msh")) 39 | mesh.read(os.path.abspath("./tests/core/test_files/hex.cdb")) 40 | mesh.read(os.path.abspath("./tests/core/test_files/hex.cas")) 41 | 42 | # causes docker error 43 | # mesh.read(os.path.abspath("./tests/core/test_files/file.pmdat")) 44 | # missing CAD file 45 | 46 | 47 | def test_write(mesh, tmp_path): 48 | mesh.write(os.path.abspath(str(tmp_path) + "/file_output.msh")) 49 | mesh.read(os.path.abspath(str(tmp_path) + "/file_output.msh")) 50 | 51 | mesh.write(os.path.abspath(str(tmp_path) + "/file_output.cas")) 52 | mesh.read(os.path.abspath(str(tmp_path) + "/file_output.cas")) 53 | 54 | mesh.write(os.path.abspath(str(tmp_path) + "/file_output.cdb")) 55 | mesh.read(os.path.abspath(str(tmp_path) + "/file_output.cdb")) 56 | 57 | mesh.write(os.path.abspath(str(tmp_path) + "/file_output.pmdat")) 58 | mesh.read(os.path.abspath(str(tmp_path) + "/file_output.pmdat")) 59 | 60 | 61 | def test_create_zones(mesh, get_examples): 62 | pmdat_path = get_examples["elbow_lucid"] 63 | mesh.read(pmdat_path) 64 | mesh.create_zones_from_labels(label_expression="*") 65 | mesh.create_zones_from_labels(conversion_method=1) 66 | mesh.read(os.path.abspath("./tests/core/test_files/hex.cas")) 67 | mesh.create_zones_from_labels(label_expression="*") 68 | 69 | 70 | def test_merge(mesh): 71 | mesh.merge_parts() 72 | 73 | 74 | def test_surface_mesh(mesh): 75 | mesh.surface_mesh() 76 | mesh.surface_mesh(max_size=0.1) 77 | mesh.surface_mesh(min_size=0.1) 78 | mesh.surface_mesh(min_size=0.1, max_size=0.9) 79 | 80 | mesh.surface_mesh_with_size_controls() 81 | 82 | 83 | def test_connect_faces(mesh): 84 | mesh.connect_faces() 85 | 86 | 87 | def test_compute_volumes(mesh): 88 | mesh.compute_volumes() 89 | 90 | 91 | def test_volume_mesh(mesh): 92 | mesh.volume_mesh(quadratic=True) 93 | mesh.volume_mesh(prism_layers=True) 94 | 95 | 96 | def test_wrap(mesh): 97 | mesh.wrap() 98 | mesh.wrap(contact_prevention_size=0.01) 99 | 100 | 101 | def test_delete_topo(mesh): 102 | mesh.delete_topology() 103 | mesh.delete_topology(delete_edges=True) 104 | 105 | 106 | def test_size_control(mesh): 107 | mesh.create_constant_size_control() 108 | mesh.create_curvature_size_control(max=1.0, min=2.0) 109 | -------------------------------------------------------------------------------- /doc/source/contributing/index.rst: -------------------------------------------------------------------------------- 1 | .. _ref_index_contributing: 2 | 3 | ========== 4 | Contribute 5 | ========== 6 | 7 | Overall guidance on contributing to a PyAnsys library appears in the 8 | `Contributing `_ topic 9 | in the *PyAnsys Developer's Guide*. Ensure that you are thoroughly familiar 10 | with this guide before attempting to contribute to PyPrimeMesh. 11 | 12 | The following contribution information is specific to PyPrimeMesh. 13 | 14 | -------------------- 15 | Clone the repository 16 | -------------------- 17 | You can clone the PyPrimeMesh repository from GitHub and install the latest version in 18 | development mode with this code: 19 | 20 | >>> git clone https://github.com/ansys/pyprimemesh 21 | >>> cd pyprimemesh 22 | >>> pip install -e .[graphics] 23 | 24 | ----------- 25 | Post issues 26 | ----------- 27 | Use the `PyPrimeMesh Issues `_ 28 | page to submit questions, report bugs, and request new features. 29 | 30 | To reach the support team, email `pyansys.core@ansys.com `_. 31 | 32 | ------------------------------ 33 | View PyPrimeMesh documentation 34 | ------------------------------ 35 | Documentation for the latest stable release of PyPrimeMesh is hosted at 36 | `PyPrimeMesh Documentation `_. 37 | 38 | In the upper right corner of the documentation's title bar, there is an option 39 | for switching from viewing the documentation for the latest stable release 40 | to viewing the documentation for the development version or previously 41 | released versions. 42 | 43 | -------------------------------- 44 | Code structure and contributions 45 | -------------------------------- 46 | The PyPrimeMesh code base is primarily auto-generated from Ansys Prime Server. For the auto-generated 47 | code, contributions are limited to raising issues and enhancement requests. 48 | 49 | You should not modify files marked as auto-generated. 50 | 51 | Contributions from pull requests can be included in files in these directories of the 52 | PyPrimeMesh repository: 53 | 54 | - `examples `_, which provides examples 55 | of how you use PyPrimeMesh. 56 | 57 | - `graphics `_, 58 | which provides graphics capabilities and image files. 59 | 60 | - `lucid `_, which 61 | provides high-level APIs. 62 | 63 | 64 | If you have an idea on how to enhance PyPrimeMesh, consider first creating an issue as a feature request 65 | The PyPrimeMesh team can then use the request as a discussion thread to work on implementing the contribution. 66 | 67 | ---------- 68 | Code style 69 | ---------- 70 | PyPrimeMesh follows PEP8 standard as outlined in the `PyAnsys Development Guide 71 | `_ and implements style checking using 72 | `pre-commit `_. 73 | 74 | To ensure your code meets minimum code styling standards, run these commands:: 75 | 76 | pip install pre-commit 77 | pre-commit run --all-files 78 | 79 | You can also install this as a pre-commit hook by running this command:: 80 | 81 | pre-commit install 82 | 83 | This way, it's not possible for you to push code that fails the style checks. For example, 84 | call code styling standards must pass:: 85 | 86 | $ pre-commit install 87 | $ git commit -am "added my cool feature" 88 | black....................................................................Passed 89 | flake8...................................................................Passed 90 | 91 | --------- 92 | Licensing 93 | --------- 94 | All contributed code is licensed under the MIT License found in the repository. 95 | If you did not write the code yourself, it is your responsibility to ensure that the existing license is compatible 96 | and included in the contributed files or you obtain permission from the original author to relicense the code. 97 | 98 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/core/sizecontrol.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in all 12 | # copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | # SOFTWARE. 21 | 22 | """Module containing SizeControl related classes and methods.""" 23 | from ansys.meshing.prime.autogen.sizecontrol import SizeControl as _SizeControl 24 | 25 | # isort: split 26 | from ansys.meshing.prime.autogen.commonstructs import SetNameResults 27 | from ansys.meshing.prime.autogen.sizecontrolstructs import SizeControlSummaryParams 28 | 29 | 30 | class SizeControl(_SizeControl): 31 | """Size control is used to compute the size field. 32 | 33 | The size field is computed based on the size control defined. 34 | Different type of size controls provide control over how the mesh size is distributed on a 35 | surface or within the volume. 36 | 37 | Parameters 38 | ---------- 39 | model : Model 40 | Server model to create SizeControl object. 41 | id : int 42 | Id of the SizeControl. 43 | object_id : int 44 | Object id of the SizeControl. 45 | name : str 46 | Name of the SizeControl.. 47 | local : bool, optional 48 | Unused. The default is ``False``. 49 | """ 50 | 51 | def __init__(self, model, id, object_id, name, local=False): 52 | """Initialize class variables and the superclass.""" 53 | _SizeControl.__init__(self, model, id, object_id, name) 54 | self._model = model 55 | self._name = name 56 | 57 | def __str__(self) -> str: 58 | """Get a representation of the class in string format. 59 | 60 | Returns 61 | ------- 62 | str 63 | Class data in string format. 64 | """ 65 | params = SizeControlSummaryParams(model=self._model) 66 | result = _SizeControl.get_summary(self, params) 67 | return result.message 68 | 69 | def set_suggested_name(self, name: str) -> SetNameResults: 70 | """Set the unique name for the size control to a suggested name. 71 | 72 | Parameters 73 | ---------- 74 | name : str 75 | Suggested name for the size control. 76 | 77 | Returns 78 | ------- 79 | SetNameResults 80 | Newly suggested name for the size control. 81 | 82 | 83 | Examples 84 | -------- 85 | >>> size_control.set_suggested_name("control1") 86 | 87 | """ 88 | result = _SizeControl.set_suggested_name(self, name) 89 | self._name = result.assigned_name 90 | return result 91 | 92 | @property 93 | def name(self): 94 | """Get the name of size control. 95 | 96 | Returns 97 | ------- 98 | str 99 | Name of the size control. 100 | 101 | Examples 102 | -------- 103 | >>> print(size_control.name) 104 | 105 | """ 106 | return self._name 107 | -------------------------------------------------------------------------------- /doc/source/user_guide/launch_prime.rst: -------------------------------------------------------------------------------- 1 | .. _ref_index_launching_pyprime: 2 | 3 | ********************* 4 | Launching PyPrimeMesh 5 | ********************* 6 | 7 | ================================== 8 | Launch server from a Python script 9 | ================================== 10 | 11 | The :func:`launch_prime() ` method launches Ansys Prime Server. 12 | 13 | This code returns an instance of the PyPrimeMesh :class:`Client ` class 14 | connected to the launched server session: 15 | 16 | .. code-block:: python 17 | 18 | import ansys.meshing.prime as prime 19 | 20 | prime_client = prime.launch_prime() 21 | 22 | You can send commands to Ansys Prime Server and receive responses from it. 23 | 24 | The :class:`Client ` class gets the :attr:`model ` 25 | parameter associated with the client instance: 26 | 27 | .. code-block:: python 28 | 29 | model = prime_client.model 30 | 31 | 32 | ==================================================================== 33 | Launch server from a Windows or Linux console and connect the client 34 | ==================================================================== 35 | 36 | You can launch Ansys Prime Server on Linux or Windows from a command prompt and then connect to the client as needed. 37 | 38 | This example starts the server in parallel mode on four nodes and specifies the IP address and port on Windows: 39 | 40 | #. Launch the server from a command line: 41 | 42 | .. code-block:: shell-session 43 | 44 | "%AWP_ROOT252%\meshing\Prime\runPrime.bat" server -np 4 --ip 127.0.0.1 --port 50055 45 | 46 | 47 | #. Connect to the server in Python using the :class:`Client ` class: 48 | 49 | .. code-block:: python 50 | 51 | import ansys.meshing.prime as prime 52 | 53 | prime_client = prime.Client(ip="127.0.0.1", port=50055) 54 | model = prime_client.model 55 | 56 | 57 | .. note:: 58 | Only a single client session can be connected to an active Ansys Prime Server instance at any time. 59 | 60 | 61 | ========================== 62 | Disconnect from the server 63 | ========================== 64 | 65 | The :func:`Client.exit() ` method ends the connection with the server. 66 | 67 | If the :class:`Client ` class launched the server, then this terminates the server process. 68 | 69 | .. note:: 70 | If you use Intel(R) MPI Library, Version 2021.8, you may encounter the following error while exiting the client: 71 | 72 | .. figure:: ../images/client_exit_error.png 73 | :width: 200pt 74 | :align: center 75 | 76 | ========================================== 77 | Run a Python script in batch on the server 78 | ========================================== 79 | 80 | You can run a Python script directly on the server from a Linux or Windows console. 81 | 82 | Here is a Windows code example for running a Python script directly from the command line: 83 | 84 | .. code-block:: shell-session 85 | 86 | "%AWP_ROOT252%\meshing\Prime\runPrime.bat" my_script.py 87 | 88 | 89 | ======================================== 90 | Recommendations for launching the server 91 | ======================================== 92 | 93 | When developing, you can use Python context to launch the server so that if an exception 94 | occurs during runtime the server closes cleanly. This prevents servers being spawned and 95 | left open blocking ports. 96 | 97 | This code example shows how to manage the server lifecycle using context to make development easier: 98 | 99 | .. code-block:: python 100 | 101 | import ansys.meshing.prime as prime 102 | 103 | with prime.launch_prime() as prime_client: 104 | model = prime_client.model 105 | # Indented code to run... 106 | 107 | 108 | Using the :func:`Client.exit() ` method to close the server in this instance is not required. 109 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/core/periodiccontrol.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in all 12 | # copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | # SOFTWARE. 21 | 22 | """Module containing classes and methods related to periodic control.""" 23 | 24 | from ansys.meshing.prime.autogen.periodiccontrol import ( 25 | PeriodicControl as _PeriodicControl, 26 | ) 27 | 28 | # isort: split 29 | from ansys.meshing.prime.autogen.commonstructs import SetNameResults 30 | from ansys.meshing.prime.autogen.periodiccontrolstructs import PeriodicControlParams 31 | 32 | 33 | class PeriodicControl(_PeriodicControl): 34 | """Periodic controls provide settings for the recovery of periodic surfaces. 35 | 36 | A periodic control is specified by the scope (source surfaces) and 37 | the transformation parameters: the center, axis and angle. 38 | 39 | Parameters 40 | ---------- 41 | model : Model 42 | Server model to create PeriodicControl object. 43 | id : int 44 | Id of the PeriodicControl. 45 | object_id : int 46 | Object id of the PeriodicControl. 47 | name : str 48 | Name of the PeriodicControl. 49 | local : bool, optional 50 | Unused. The default is ``False``. 51 | """ 52 | 53 | def __init__(self, model, id, object_id, name, local=False): 54 | """Initialize class variables and the superclass.""" 55 | _PeriodicControl.__init__(self, model, id, object_id, name) 56 | self._model = model 57 | self._name = name 58 | 59 | def __str__(self) -> str: 60 | """Get a representation of the class in string format. 61 | 62 | Returns 63 | ------- 64 | str 65 | Class data in string format. 66 | """ 67 | params = PeriodicControlParams(model=self._model) 68 | result = _PeriodicControl.get_summary(self, params) 69 | return result.message 70 | 71 | def set_suggested_name(self, name: str) -> SetNameResults: 72 | """Set the unique name for the periodic control to a suggested name. 73 | 74 | Parameters 75 | ---------- 76 | name : str 77 | Suggested name for the periodic control. 78 | 79 | Returns 80 | ------- 81 | SetNameResults 82 | Newly suggested name of the periodic control. 83 | 84 | Examples 85 | -------- 86 | >>> periodic_control.set_suggested_name("control1") 87 | 88 | """ 89 | result = _PeriodicControl.set_suggested_name(self, name) 90 | self._name = result.assigned_name 91 | return result 92 | 93 | @property 94 | def name(self): 95 | """Get the name of the periodic control. 96 | 97 | Returns 98 | ------- 99 | str 100 | Name of the periodic control. 101 | 102 | Examples 103 | -------- 104 | >>> print(periodic_control.name) 105 | 106 | """ 107 | return self._name 108 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/internals/json_utils.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in all 12 | # copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | # SOFTWARE. 21 | 22 | """Module for JSON utility functions.""" 23 | import json 24 | from typing import Union 25 | 26 | import numpy as np 27 | 28 | import ansys.meshing.prime.internals.config as config 29 | import ansys.meshing.prime.relaxed_json as relaxed_json 30 | 31 | __all__ = ['loads', 'dumps'] 32 | 33 | 34 | def try_process_as_iterable(obj): 35 | """Try if an object is an iterable and return its list. 36 | 37 | Parameters 38 | ---------- 39 | obj : Any 40 | Object to test. 41 | 42 | Returns 43 | ------- 44 | List 45 | List of the object. 46 | """ 47 | iterable = iter(obj) 48 | return list(iterable) 49 | 50 | 51 | def try_process_numpy_array(obj): 52 | """Try if an object is a numpy array and return its list. 53 | 54 | Parameters 55 | ---------- 56 | obj : Any 57 | Object to test. 58 | 59 | Returns 60 | ------- 61 | bool, list 62 | Whether the object is a numpy array and the list of the object. 63 | """ 64 | if isinstance(obj, np.ndarray): 65 | return True, obj.tolist() 66 | return False, obj 67 | 68 | 69 | class _CustomJSONEncoder(json.JSONEncoder): 70 | def default(self, obj): 71 | success, obj = try_process_numpy_array(obj) 72 | if success: 73 | return obj 74 | 75 | try: 76 | return try_process_as_iterable(obj) 77 | except TypeError: 78 | pass 79 | 80 | return super().default(obj) 81 | 82 | 83 | class _CustomBinaryJSONEncoder(relaxed_json.JSONEncoder): 84 | def default(self, obj): 85 | try: 86 | return try_process_as_iterable(obj) 87 | except TypeError: 88 | pass 89 | 90 | return super().default(obj) 91 | 92 | 93 | def loads(s: Union[str, bytes, bytearray], *args, **kwargs): 94 | """Load JSON from an input string. 95 | 96 | Parameters 97 | ---------- 98 | s : Union[str, bytes, bytearray] 99 | Input string. 100 | 101 | Returns 102 | ------- 103 | json 104 | Object converted to JSON. 105 | """ 106 | if config.is_optimizing_numpy_arrays(): 107 | return relaxed_json.loads(s, *args, **kwargs) 108 | return json.loads(s, *args, **kwargs) 109 | 110 | 111 | def dumps(obj, *args, **kwargs): 112 | """Dump JSON to an object. 113 | 114 | Parameters 115 | ---------- 116 | obj : Any 117 | Input object. 118 | 119 | Returns 120 | ------- 121 | Object 122 | JSON converted to an object. 123 | """ 124 | if config.is_optimizing_numpy_arrays(): 125 | kwargs.setdefault('cls', _CustomBinaryJSONEncoder) 126 | return relaxed_json.dumps(obj, *args, **kwargs) 127 | 128 | kwargs.setdefault('cls', _CustomJSONEncoder) 129 | return json.dumps(obj, *args, **kwargs) 130 | -------------------------------------------------------------------------------- /.github/workflows/label.yml: -------------------------------------------------------------------------------- 1 | name: Labeler 2 | on: 3 | pull_request: 4 | # opened, reopened, and synchronize are default for pull_request 5 | # edited - when PR title or body is changed 6 | # labeled - when labels are added to PR 7 | types: [opened, reopened, synchronize, edited, labeled] 8 | push: 9 | branches: [ main ] 10 | paths: 11 | - '../labels.yml' 12 | 13 | concurrency: 14 | group: ${{ github.workflow }}-${{ github.ref }} 15 | cancel-in-progress: true 16 | 17 | jobs: 18 | 19 | label-syncer: 20 | name: Syncer 21 | runs-on: ubuntu-latest 22 | steps: 23 | - uses: actions/checkout@v5 24 | - uses: micnncim/action-label-syncer@v1 25 | env: 26 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 27 | 28 | labeler: 29 | name: Set labels 30 | needs: [label-syncer] 31 | permissions: 32 | contents: read 33 | pull-requests: write 34 | runs-on: ubuntu-latest 35 | steps: 36 | 37 | # Label based on modified files 38 | - name: Label based on changed files 39 | uses: actions/labeler@v6 40 | with: 41 | repo-token: ${{ secrets.GITHUB_TOKEN }} 42 | sync-labels: true 43 | 44 | # Label based on branch name 45 | - uses: actions-ecosystem/action-add-labels@v1 46 | if: | 47 | startsWith(github.event.pull_request.head.ref, 'doc') || 48 | startsWith(github.event.pull_request.head.ref, 'docs') 49 | with: 50 | labels: documentation 51 | 52 | - uses: actions-ecosystem/action-add-labels@v1 53 | if: | 54 | startsWith(github.event.pull_request.head.ref, 'maint') || 55 | startsWith(github.event.pull_request.head.ref, 'no-ci') || 56 | startsWith(github.event.pull_request.head.ref, 'ci') 57 | with: 58 | labels: maintenance 59 | 60 | - uses: actions-ecosystem/action-add-labels@v1 61 | if: startsWith(github.event.pull_request.head.ref, 'feat') 62 | with: 63 | labels: | 64 | enhancement 65 | 66 | - uses: actions-ecosystem/action-add-labels@v1 67 | if: | 68 | startsWith(github.event.pull_request.head.ref, 'fix') || 69 | startsWith(github.event.pull_request.head.ref, 'patch') 70 | with: 71 | labels: bug 72 | 73 | - uses: actions-ecosystem/action-add-labels@v1 74 | if: | 75 | startsWith(github.event.pull_request.head.ref, 'test') 76 | with: 77 | labels: testing 78 | 79 | commenter: 80 | runs-on: ubuntu-latest 81 | steps: 82 | - name: Suggest to add labels 83 | uses: peter-evans/create-or-update-comment@v5 84 | # Execute only when no labels have been applied to the pull request 85 | if: toJSON(github.event.pull_request.labels.*.name) == '{}' 86 | with: 87 | issue-number: ${{ github.event.pull_request.number }} 88 | body: | 89 | Please add one of the following labels to add this contribution to the Release Notes :point_down: 90 | - [bug](https://github.com/ansys/pyprimemesh/pulls?q=label%3Abug+) 91 | - [documentation](https://github.com/pansys/pyprimemesh/pulls?q=label%3Adocumentation+) 92 | - [enhancement](https://github.com/ansys/pyprimemesh/pulls?q=label%3Aenhancement+) 93 | - [good first issue](https://github.com/ansys/pyprimemesh/pulls?q=label%3Agood+first+issue) 94 | - [maintenance](https://github.com/ansys/pyprimemesh/pulls?q=label%3Amaintenance+) 95 | - [release](https://github.com/ansys/pyprimemesh/pulls?q=label%3Arelease+) 96 | - [testing](https://github.com/ansys/pyprimemesh/pulls?q=label%Atesting+) 97 | 98 | changelog-fragment: 99 | name: "Create changelog fragment" 100 | needs: [labeler] 101 | permissions: 102 | contents: write 103 | pull-requests: write 104 | runs-on: ubuntu-latest 105 | steps: 106 | - uses: ansys/actions/doc-changelog@v10 107 | with: 108 | token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} 109 | bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} 110 | bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} 111 | -------------------------------------------------------------------------------- /doc/source/user_guide/lucid.rst: -------------------------------------------------------------------------------- 1 | .. _ref_index_lucid: 2 | 3 | ***************************************** 4 | Common meshing tasks and the Lucid module 5 | ***************************************** 6 | 7 | The `lucid `_ module defines high-level methods to abstract 8 | and simplify common meshing tasks. Methods contained in this module are intended to demonstrate 9 | how the low-level APIs can be combined to execute meshing workflows flexibly and with minimal 10 | need for understanding PyPrimeMesh-specific concepts. The methods use global automatic defaults 11 | where possible to reduce effort in creating general purpose operations. 12 | 13 | Many common meshing tasks and workflows can be tackled easily using the functions provided. 14 | 15 | Here is an example of meshing the mixing elbow case for a fluid flow analysis: 16 | 17 | .. code-block:: python 18 | 19 | from ansys.meshing import prime 20 | 21 | # Start and connect to an Ansys Prime Server instance 22 | prime_client = prime.launch_prime() 23 | model = prime_client.model 24 | 25 | # Instantiate the lucid class 26 | mesh_util = prime.lucid.Mesh(model=model) 27 | 28 | # Read the geometry 29 | mesh_util.read("mixing_elbow.scdoc") 30 | 31 | # Mesh the geometry with a poly prism mesh 32 | mesh_util.surface_mesh(min_size=5, max_size=20) 33 | 34 | mesh_util.volume_mesh( 35 | volume_fill_type=prime.VolumeFillType.POLY, 36 | prism_surface_expression="* !inlet !outlet", 37 | prism_layers=3, 38 | ) 39 | 40 | # Prepare and write the model for the Fluent solver 41 | mesh_util.create_zones_from_labels() 42 | mesh_util.write("mixing_elbow.cas") 43 | 44 | Remesh surface using the Lucid module 45 | ------------------------------------- 46 | 47 | This code shows how to remesh the surface using the Lucid module: 48 | 49 | .. code-block:: python 50 | 51 | import ansys.meshing.prime as prime 52 | 53 | prime_client = prime.launch_prime() 54 | model = prime_client.model 55 | 56 | # Instantiate the Lucid module 57 | mesh_util = prime.lucid.Mesh(model) 58 | 59 | # Import CAD (STL) file 60 | input_file = r"D:/Examples/simple-bracket-holes.stl" 61 | mesh_util.read(input_file) 62 | 63 | Surface wrapping using the ``lucid.Mesh`` class 64 | ----------------------------------------------- 65 | 66 | This example shows you surface wrapping using lucid to get the desired surface mesh results: 67 | 68 | .. code:: python 69 | 70 | model = prime_client.model 71 | mesh_util = prime.lucid.Mesh(model) 72 | input_file = r"D:/PyPrimeMesh/cylinder_with_flange.pmdat" 73 | mesh_util.read(input_file) 74 | 75 | # Create size control for remeshing 76 | size_control2 = model.control_data.create_size_control( 77 | sizing_type=prime.SizingType.HARD 78 | ) 79 | size_control2.set_hard_sizing_params(prime.HardSizingParams(model=model, min=0.8)) 80 | size_control2.set_scope(prime.ScopeDefinition(model=model)) 81 | 82 | # Wrap and remesh the input parts 83 | mesh_util.wrap( 84 | min_size=0.2, 85 | max_size=1.0, 86 | input_parts="flange,pipe", 87 | use_existing_features=True, 88 | recompute_remesh_sizes=True, 89 | remesh_size_controls=[size_control2], 90 | ) 91 | 92 | 93 | # Surface mesh the geometry with curvature sizing 94 | # Set minimum and maximum sizing to use for curvature refinement 95 | mesh_util.surface_mesh(min_size=0.27, max_size=5.5) 96 | 97 | Prism controls for polyhedral mesh using the Lucid module 98 | --------------------------------------------------------- 99 | 100 | This example shows how to generate poly prism method using the Lucid module: 101 | 102 | .. code-block:: python 103 | 104 | # Volume mesh with polyhedral elements 105 | # Set prism layers parameter for boundary layer refinement 106 | mesh_util.volume_mesh( 107 | volume_fill_type=prime.VolumeFillType.POLY, 108 | prism_layers=5, 109 | prism_surface_expression="* !inlet !outlet", 110 | ) 111 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/autogen/topoutilities.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """ Auto-generated file. DO NOT MODIFY """ 24 | from __future__ import annotations 25 | from ansys.meshing.prime.internals.comm_manager import CommunicationManager 26 | from ansys.meshing.prime.params.primestructs import * 27 | from ansys.meshing.prime.autogen.coreobject import * 28 | from typing import List, Any, Union 29 | 30 | class TopoUtilities(CoreObject): 31 | """Performs various general topology utility algorithms. For example, fill hole. 32 | 33 | Parameters 34 | ---------- 35 | model : Model 36 | Server model to create TopoUtilities object. 37 | part_id : int 38 | Id of the part. 39 | """ 40 | 41 | def __init__(self, model: CommunicationManager, part_id: int): 42 | """ Initialize TopoUtilities """ 43 | self._model = model 44 | self._comm = model._communicator 45 | command_name = "PrimeMesh::TopoUtilities/Construct" 46 | args = {"ModelID" : model._object_id , "PartID" : part_id, "MaxID" : -1} 47 | result = self._comm.serve(model, command_name, args=args) 48 | self._object_id = result["ObjectIndex"] 49 | self._freeze() 50 | 51 | def __enter__(self): 52 | """ Enter context for TopoUtilities. """ 53 | return self 54 | 55 | def __exit__(self, type, value, traceback) : 56 | """ Exit context for TopoUtilities. """ 57 | command_name = "PrimeMesh::TopoUtilities/Destruct" 58 | self._comm.serve(self._model, command_name, self._object_id, args={}) 59 | 60 | def fill_hole(self, topo_edges : Iterable[int], params : TopoFillHoleParams) -> TopoFillHoleResult: 61 | """ Fill holes bounded by given topoedges. 62 | 63 | 64 | Parameters 65 | ---------- 66 | topo_edges : Iterable[int] 67 | Ids of topoedges to be used to find holes. 68 | params : TopoFillHoleParams 69 | Parameters to fill holes. 70 | 71 | Returns 72 | ------- 73 | TopoFillHoleResult 74 | Return the TopoFillHoleResult. 75 | 76 | 77 | Examples 78 | -------- 79 | >>> results = topo_utils.fill_hole(topo_edges, params) 80 | 81 | """ 82 | if not isinstance(topo_edges, Iterable): 83 | raise TypeError("Invalid argument type passed for 'topo_edges'. Valid argument type is Iterable[int].") 84 | if not isinstance(params, TopoFillHoleParams): 85 | raise TypeError("Invalid argument type passed for 'params'. Valid argument type is TopoFillHoleParams.") 86 | args = {"topo_edges" : topo_edges, 87 | "params" : params._jsonify()} 88 | command_name = "PrimeMesh::TopoUtilities/FillHole" 89 | self._model._print_logs_before_command("fill_hole", args) 90 | result = self._comm.serve(self._model, command_name, self._object_id, args=args) 91 | self._model._print_logs_after_command("fill_hole", TopoFillHoleResult(model = self._model, json_data = result)) 92 | return TopoFillHoleResult(model = self._model, json_data = result) 93 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/autogen/automesh.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """ Auto-generated file. DO NOT MODIFY """ 24 | from __future__ import annotations 25 | from ansys.meshing.prime.internals.comm_manager import CommunicationManager 26 | from ansys.meshing.prime.params.primestructs import * 27 | from ansys.meshing.prime.autogen.coreobject import * 28 | from typing import List, Any, Union 29 | 30 | class AutoMesh(CoreObject): 31 | """Generates volume mesh. 32 | 33 | Performs volume meshing using various volume meshing algorithms. 34 | For example, with prisms. 35 | 36 | Parameters 37 | ---------- 38 | model : Model 39 | Server model to create AutoMesh object. 40 | """ 41 | 42 | def __init__(self, model: CommunicationManager): 43 | """ Initialize AutoMesh """ 44 | self._model = model 45 | self._comm = model._communicator 46 | command_name = "PrimeMesh::AutoMesh/Construct" 47 | args = {"ModelID" : model._object_id , "MaxID" : -1 } 48 | result = self._comm.serve(model, command_name, args=args) 49 | self._object_id = result["ObjectIndex"] 50 | self._freeze() 51 | 52 | def __enter__(self): 53 | """ Enter context for AutoMesh. """ 54 | return self 55 | 56 | def __exit__(self, type, value, traceback) : 57 | """ Exit context for AutoMesh. """ 58 | command_name = "PrimeMesh::AutoMesh/Destruct" 59 | self._comm.serve(self._model, command_name, self._object_id, args={}) 60 | 61 | def mesh(self, part_id : int, automesh_params : AutoMeshParams) -> AutoMeshResults: 62 | """ Performs volume meshing on the part with the given meshing parameters. 63 | 64 | 65 | Parameters 66 | ---------- 67 | part_id : int 68 | Id of the part. 69 | automesh_params : AutoMeshParams 70 | Parameters for auto mesh. 71 | 72 | Returns 73 | ------- 74 | AutoMeshResults 75 | Returns the AutomeshResults. 76 | 77 | 78 | Examples 79 | -------- 80 | >>> auto_mesh = AutoMesh(model = model) 81 | >>> automesh_params = AutoMeshParams(model = model) 82 | >>> results = auto_mesh.mesh(part_id, automesh_params) 83 | 84 | """ 85 | if not isinstance(part_id, int): 86 | raise TypeError("Invalid argument type passed for 'part_id'. Valid argument type is int.") 87 | if not isinstance(automesh_params, AutoMeshParams): 88 | raise TypeError("Invalid argument type passed for 'automesh_params'. Valid argument type is AutoMeshParams.") 89 | args = {"part_id" : part_id, 90 | "automesh_params" : automesh_params._jsonify()} 91 | command_name = "PrimeMesh::AutoMesh/Mesh" 92 | self._model._print_logs_before_command("mesh", args) 93 | result = self._comm.serve(self._model, command_name, self._object_id, args=args) 94 | self._model._print_logs_after_command("mesh", AutoMeshResults(model = self._model, json_data = result)) 95 | return AutoMeshResults(model = self._model, json_data = result) 96 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/autogen/volumesearch.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """ Auto-generated file. DO NOT MODIFY """ 24 | from __future__ import annotations 25 | from ansys.meshing.prime.internals.comm_manager import CommunicationManager 26 | from ansys.meshing.prime.params.primestructs import * 27 | from ansys.meshing.prime.autogen.coreobject import * 28 | from typing import List, Any, Union 29 | 30 | class VolumeSearch(CoreObject): 31 | """VolumeSearch allows you to check volume mesh quality. 32 | 33 | VolumeSearch performs volume mesh quality check based on different cell quality measures. 34 | 35 | 36 | Parameters 37 | ---------- 38 | model : Model 39 | Server model to create VolumeSearch object. 40 | """ 41 | 42 | def __init__(self, model: CommunicationManager): 43 | """ Initialize VolumeSearch """ 44 | self._model = model 45 | self._comm = model._communicator 46 | command_name = "PrimeMesh::VolumeSearch/Construct" 47 | args = {"ModelID" : model._object_id , "MaxID" : -1 } 48 | result = self._comm.serve(model, command_name, args=args) 49 | self._object_id = result["ObjectIndex"] 50 | self._freeze() 51 | 52 | def __enter__(self): 53 | """ Enter context for VolumeSearch. """ 54 | return self 55 | 56 | def __exit__(self, type, value, traceback) : 57 | """ Exit context for VolumeSearch. """ 58 | command_name = "PrimeMesh::VolumeSearch/Destruct" 59 | self._comm.serve(self._model, command_name, self._object_id, args={}) 60 | 61 | def get_volume_quality_summary(self, params : VolumeQualitySummaryParams) -> VolumeQualitySummaryResults: 62 | """ Gets the volume quality summary. 63 | 64 | Diagnose volume quality for the given scope and cell quality measures provided in the VolumeQualitySummaryParams structure. 65 | Use default quality limit if the parameters are not specified. 66 | 67 | Parameters 68 | ---------- 69 | params : VolumeQualitySummaryParams 70 | Volume quality summary parameters. 71 | 72 | Returns 73 | ------- 74 | VolumeQualitySummaryResults 75 | Returns the VolumeQualitySummaryResults. 76 | 77 | Examples 78 | -------- 79 | >>> vol_search = VolumeSearch(model=model) 80 | >>> results = vol_search.get_volume_quality_summary(VolumeQualitySummaryParams(model=model)) 81 | 82 | """ 83 | if not isinstance(params, VolumeQualitySummaryParams): 84 | raise TypeError("Invalid argument type passed for 'params'. Valid argument type is VolumeQualitySummaryParams.") 85 | args = {"params" : params._jsonify()} 86 | command_name = "PrimeMesh::VolumeSearch/GetVolumeQualitySummary" 87 | self._model._print_logs_before_command("get_volume_quality_summary", args) 88 | result = self._comm.serve(self._model, command_name, self._object_id, args=args) 89 | self._model._print_logs_after_command("get_volume_quality_summary", VolumeQualitySummaryResults(model = self._model, json_data = result)) 90 | return VolumeQualitySummaryResults(model = self._model, json_data = result) 91 | -------------------------------------------------------------------------------- /src/ansys/meshing/prime/autogen/sizefield.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | """ Auto-generated file. DO NOT MODIFY """ 24 | from __future__ import annotations 25 | from ansys.meshing.prime.internals.comm_manager import CommunicationManager 26 | from ansys.meshing.prime.params.primestructs import * 27 | from ansys.meshing.prime.autogen.coreobject import * 28 | from typing import List, Any, Union 29 | 30 | class SizeField(CoreObject): 31 | """The size field is computed based on the size control defined. 32 | 33 | You can remesh surfaces and edges based on the size field. 34 | 35 | 36 | Parameters 37 | ---------- 38 | model : Model 39 | Server model to create SizeField object. 40 | """ 41 | 42 | def __init__(self, model: CommunicationManager): 43 | """ Initialize SizeField """ 44 | self._model = model 45 | self._comm = model._communicator 46 | command_name = "PrimeMesh::SizeField/Construct" 47 | args = {"ModelID" : model._object_id , "MaxID" : -1 } 48 | result = self._comm.serve(model, command_name, args=args) 49 | self._object_id = result["ObjectIndex"] 50 | self._freeze() 51 | 52 | def __enter__(self): 53 | """ Enter context for SizeField. """ 54 | return self 55 | 56 | def __exit__(self, type, value, traceback) : 57 | """ Exit context for SizeField. """ 58 | command_name = "PrimeMesh::SizeField/Destruct" 59 | self._comm.serve(self._model, command_name, self._object_id, args={}) 60 | 61 | def compute_volumetric(self, size_control_ids : Iterable[int], volumetric_sizefield_params : VolumetricSizeFieldComputeParams) -> VolumetricSizeFieldComputeResults: 62 | """ Computes the volumetric size field using given size control ids. 63 | 64 | 65 | Parameters 66 | ---------- 67 | size_control_ids : Iterable[int] 68 | Ids of size controls. 69 | 70 | Examples 71 | -------- 72 | >>> size_field.compute_volumetric( 73 | >>> [size_control.id for size_control in model.control_data.size_controls], volumetric_sizefield_params)) 74 | 75 | """ 76 | if not isinstance(size_control_ids, Iterable): 77 | raise TypeError("Invalid argument type passed for 'size_control_ids'. Valid argument type is Iterable[int].") 78 | if not isinstance(volumetric_sizefield_params, VolumetricSizeFieldComputeParams): 79 | raise TypeError("Invalid argument type passed for 'volumetric_sizefield_params'. Valid argument type is VolumetricSizeFieldComputeParams.") 80 | args = {"size_control_ids" : size_control_ids, 81 | "volumetric_sizefield_params" : volumetric_sizefield_params._jsonify()} 82 | command_name = "PrimeMesh::SizeField/ComputeVolumetric" 83 | self._model._print_logs_before_command("compute_volumetric", args) 84 | result = self._comm.serve(self._model, command_name, self._object_id, args=args) 85 | self._model._print_logs_after_command("compute_volumetric", VolumetricSizeFieldComputeResults(model = self._model, json_data = result)) 86 | return VolumetricSizeFieldComputeResults(model = self._model, json_data = result) 87 | --------------------------------------------------------------------------------