diff --git a/src/ansys/meshing/prime/examples/__init__.py b/src/ansys/meshing/prime/examples/__init__.py index 4d90b88b59..61a68eac09 100644 --- a/src/ansys/meshing/prime/examples/__init__.py +++ b/src/ansys/meshing/prime/examples/__init__.py @@ -1,5 +1,8 @@ from .download_utilities import DownloadManager from .examples import ( + download_block_model_fmd, + download_block_model_pmdat, + download_block_model_scdoc, download_bracket_dsco, download_bracket_fmd, download_bracket_scdoc, diff --git a/src/ansys/meshing/prime/examples/examples.py b/src/ansys/meshing/prime/examples/examples.py index f05b8bcef3..e2dbdb98f3 100644 --- a/src/ansys/meshing/prime/examples/examples.py +++ b/src/ansys/meshing/prime/examples/examples.py @@ -36,6 +36,9 @@ "download_f1_rw_enclosure_stl", "download_f1_rw_end_plates_stl", "download_f1_rw_main_plane_stl", + "download_block_model_scdoc", + "download_block_model_fmd", + "download_block_model_pmdat", ] @@ -70,6 +73,9 @@ class Examples(Enum): F1_RW_END_PLATES_STL = {"filename": "f1_rw_enclosure.stl", "git_folder": "f1_rear_wing"} F1_RW_ENCLOSURE_STL = {"filename": "f1_rw_end_plates.stl", "git_folder": "f1_rear_wing"} F1_RW_MAIN_PLANE_STL = {"filename": "f1_rw_main_plane.stl", "git_folder": "f1_rear_wing"} + BLOCK_MODEL_SCDOC = {"filename": "pyprime_block_import.scdoc", "git_folder": "block_model"} + BLOCK_MODEL_FMD = {"filename": "pyprime_block_import.fmd", "git_folder": "block_model"} + BLOCK_MODEL_PMDAT = {"filename": "pyprime_block_import.pmdat", "git_folder": "block_model"} _DOWNLOADS = [] @@ -1010,7 +1016,7 @@ def download_f1_rw_drs_stl( >>> model = session.model >>> f1_rw_drs = prime_examples.download_f1_rw_drs_stl() >>> with prime.FileIO(model) as io: - >>> _ = io.read_pmdat(pcb, params=prime.FileReadParams(model)) + >>> _ = io.read_cad(f1_rw_drs, params=prime.FileReadParams(model)) >>> print(model) """ @@ -1045,7 +1051,7 @@ def download_f1_rw_enclosure_stl( >>> model = session.model >>> f1_rw_enclosure = prime_examples.download_f1_rw_enclosure_stl() >>> with prime.FileIO(model) as io: - >>> _ = io.read_pmdat(pcb, params=prime.FileReadParams(model)) + >>> _ = io.read_cad(f1_rw_enclosure, params=prime.FileReadParams(model)) >>> print(model) """ @@ -1080,7 +1086,7 @@ def download_f1_rw_end_plates_stl( >>> model = session.model >>> f1_rw_end_plates = prime_examples.download_f1_rw_end_plates_stl() >>> with prime.FileIO(model) as io: - >>> _ = io.read_pmdat(pcb, params=prime.FileReadParams(model)) + >>> _ = io.read_cad(f1_rw_end_plates, params=prime.FileReadParams(model)) >>> print(model) """ @@ -1115,8 +1121,113 @@ def download_f1_rw_main_plane_stl( >>> model = session.model >>> f1_rw_main_plane = prime_examples.download_f1_rw_main_plane_stl() >>> with prime.FileIO(model) as io: - >>> _ = io.read_pmdat(pcb, params=prime.FileReadParams(model)) + >>> _ = io.read_cad(f1_rw_main_plane, params=prime.FileReadParams(model)) >>> print(model) """ return get_file(Examples.F1_RW_MAIN_PLANE_STL, destination, force) + + +def download_block_model_scdoc( + destination: Optional[str] = None, force: bool = False +) -> Union[str, os.PathLike]: + """Download CAD file for the block model example. + + Parameters + ---------- + destination: Optional[str] + Destination for the file to be downloaded. + If nothing is provided, the default path in app data is used. + force: bool + Option to download the file. + If true, the file is always downloaded. + If false, an existing file in the cache may be reused. + + Returns + ------- + str + Local path to the downloaded file. + + Examples + -------- + >>> import ansys.meshing.prime as prime + >>> import ansys.meshing.prime.examples as prime_examples + >>> with prime.launch_prime() as session: + >>> model = session.model + >>> block_model = prime_examples.download_block_model_scdoc() + >>> with prime.FileIO(model) as io: + >>> _ = io.import_cad(block_model, params=prime.FileReadParams(model)) + >>> print(model) + + """ + return get_file(Examples.BLOCK_MODEL_SCDOC, destination, force) + + +def download_block_model_fmd( + destination: Optional[str] = None, force: bool = False +) -> Union[str, os.PathLike]: + """Download CAD file for the block model example. + + Parameters + ---------- + destination: Optional[str] + Destination for the file to be downloaded. + If nothing is provided, the default path in app data is used. + force: bool + Option to download the file. + If true, the file is always downloaded. + If false, an existing file in the cache may be reused. + + Returns + ------- + str + Local path to the downloaded file. + + Examples + -------- + >>> import ansys.meshing.prime as prime + >>> import ansys.meshing.prime.examples as prime_examples + >>> with prime.launch_prime() as session: + >>> model = session.model + >>> block_model = prime_examples.download_block_model_fmd() + >>> with prime.FileIO(model) as io: + >>> _ = io.import_cad(block_model, params=prime.FileReadParams(model)) + >>> print(model) + + """ + return get_file(Examples.BLOCK_MODEL_FMD, destination, force) + + +def download_block_model_pmdat( + destination: Optional[str] = None, force: bool = False +) -> Union[str, os.PathLike]: + """Download PMDAT file for the block model example. + + Parameters + ---------- + destination: Optional[str] + Destination for the file to be downloaded. + If nothing is provided, the default path in app data is used. + force: bool + Option to download the file. + If true, the file is always downloaded. + If false, an existing file in the cache may be reused. + + Returns + ------- + str + Local path to the downloaded file. + + Examples + -------- + >>> import ansys.meshing.prime as prime + >>> import ansys.meshing.prime.examples as prime_examples + >>> with prime.launch_prime() as session: + >>> model = session.model + >>> block_model = prime_examples.download_block_model_pmdat() + >>> with prime.FileIO(model) as io: + >>> _ = io.read_pmdat(block_model, params=prime.FileReadParams(model)) + >>> print(model) + + """ + return get_file(Examples.BLOCK_MODEL_PMDAT, destination, force)