diff --git a/examples/01-project-configuration/add_cca.py b/examples/01-project-configuration/add_cca.py index 730bdb90..b411db85 100644 --- a/examples/01-project-configuration/add_cca.py +++ b/examples/01-project-configuration/add_cca.py @@ -44,7 +44,7 @@ import os from ansys.sherlock.core import launcher -from ansys.sherlock.core.errors import SherlockAddCCAError, SherlockImportODBError +from ansys.sherlock.core.errors import SherlockAddCCAError, SherlockImportProjectZipArchiveError ############################################################################### # Launch PySherlock service @@ -68,7 +68,7 @@ archive_file=(os.path.join(ANSYS_ROOT, "sherlock", "tutorial", "Tutorial Project.zip")), ) print("Tutorial project imported successfully.") -except SherlockImportODBError as e: +except SherlockImportProjectZipArchiveError as e: print(f"Error importing ODB++ archive: {str(e)}") ############################################################################### diff --git a/examples/02-analyses/run_harmonic_vibe_strain_map_analysis.py b/examples/02-analyses/run_harmonic_vibe_strain_map_analysis.py index 17c56631..e36f581b 100644 --- a/examples/02-analyses/run_harmonic_vibe_strain_map_analysis.py +++ b/examples/02-analyses/run_harmonic_vibe_strain_map_analysis.py @@ -81,8 +81,12 @@ except SherlockImportProjectZipArchiveError as e: print(f"Error importing project zip archive: {e}") +############################################################################### +# Add Strain Map +# ==================================== +# Add a strain map to the project. + try: - # Add strain maps to the project strain_map_path = os.path.join( ANSYS_ROOT, "sherlock", "tutorial", "StrainMaps", "StrainMap.csv" ) @@ -145,15 +149,12 @@ # Run the strain map analysis, including harmonic vibration and other analysis types. try: - analysis_type_enum = RunStrainMapAnalysisRequest.StrainMapAnalysis.AnalysisType - - analysis_type = analysis_type_enum.HarmonicVibe sherlock.analysis.run_strain_map_analysis( "Test", "Main Board", [ [ - analysis_type, + RunStrainMapAnalysisRequest.StrainMapAnalysis.AnalysisType.HarmonicVibe, [ ["On The Road", "5 - Harmonic Vibe", "TOP", "StrainMap - Top"], ["On The Road", "5 - Harmonic Vibe", "BOTTOM", "StrainMap - Bottom"], diff --git a/examples/02-analyses/run_mechanical_shock_strain_map_analysis.py b/examples/02-analyses/run_mechanical_shock_strain_map_analysis.py index 0aad6001..b69d0882 100644 --- a/examples/02-analyses/run_mechanical_shock_strain_map_analysis.py +++ b/examples/02-analyses/run_mechanical_shock_strain_map_analysis.py @@ -1,4 +1,4 @@ -# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -43,14 +43,13 @@ # sphinx_gallery_thumbnail_path = './images/sherlock_run_mechanical_shock_analysis_example.png' import os -import time from SherlockAnalysisService_pb2 import RunStrainMapAnalysisRequest from ansys.sherlock.core import launcher from ansys.sherlock.core.errors import ( SherlockAddStrainMapsError, - SherlockImportODBError, + SherlockImportProjectZipArchiveError, SherlockRunStrainMapAnalysisError, ) from ansys.sherlock.core.types.analysis_types import ModelSource @@ -67,42 +66,28 @@ sherlock = launcher.launch_sherlock(port=9092) ############################################################################### -# Import ODB Archive and Strain Maps -# =================================== -# Import a project and add strain maps to the Sherlock project. +# Import Tutorial Project +# ======================== +# Import the tutorial project zip archive from the Sherlock tutorial directory. try: - # Import ODB++ archive into the project - sherlock.project.import_odb_archive( - ANSYS_ROOT - + os.path.sep - + "sherlock" - + os.path.sep - + "tutorial" - + os.path.sep - + "ODB++ Tutorial.tgz", - True, - True, - True, - True, + sherlock.project.import_project_zip_archive( project="Test", - cca_name="Card", + category="Demos", + archive_file=(os.path.join(ANSYS_ROOT, "sherlock", "tutorial", "Tutorial Project.zip")), ) -except SherlockImportODBError as e: - print(f"Error importing ODB archive: {str(e)}") + print("Tutorial project imported successfully.") +except SherlockImportProjectZipArchiveError as e: + print(f"Error importing project zip archive: {e}") + +############################################################################### +# Add Strain Map +# ==================================== +# Add a strain map to the project. try: - # Add strain maps to the project - strain_map_path = ( - ANSYS_ROOT - + os.path.sep - + "sherlock" - + os.path.sep - + "tutorial" - + os.path.sep - + "StrainMaps" - + os.path.sep - + "StrainMap.csv" + strain_map_path = os.path.join( + ANSYS_ROOT, "sherlock", "tutorial", "StrainMaps", "StrainMap.csv" ) sherlock.project.add_strain_maps( "Test", @@ -114,13 +99,14 @@ 0, "SolidID", "PCB Strain", - "\u03bc\u03b5", - ["Card"], + "µε", + ["Main Board"], ) ], ) + print("Strain maps added successfully.") except SherlockAddStrainMapsError as e: - print(f"Error adding strain maps: {str(e)}") + print(f"Error adding strain maps: {e}") ############################################################################### # Update Mechanical Shock Properties @@ -133,7 +119,7 @@ "Test", [ { - "cca_name": "Card", + "cca_name": "Main Board", "model_source": ModelSource.STRAIN_MAP, "shock_result_count": 1, "part_validation_enabled": False, @@ -148,8 +134,9 @@ } ], ) + print("Mechanical shock properties updated successfully.") except SherlockRunStrainMapAnalysisError as e: - print(f"Error updating mechanical shock properties: {str(e)}") + print(f"Error updating mechanical shock properties: {e}") ############################################################################### # Run Mechanical Shock Analysis @@ -159,25 +146,25 @@ try: sherlock.analysis.run_strain_map_analysis( "Test", - "Card", + "Main Board", [ [ RunStrainMapAnalysisRequest.StrainMapAnalysis.AnalysisType.MechanicalShock, [ - ["Phase 1", "Shock Event", "TOP", "StrainMap - Top"], - ["Phase 1", "Shock Event", "BOTTOM", "StrainMap - Bottom"], + ["On The Road", "2 - Pothole", "TOP", "StrainMap - Top"], + ["On The Road", "3 - Collision", "BOTTOM", "StrainMap - Bottom"], ], ] ], ) + print("Mechanical shock analysis executed successfully.") except SherlockRunStrainMapAnalysisError as e: - print(f"Error running mechanical shock analysis: {str(e)}") + print(f"Error running mechanical shock analysis: {e}") ############################################################################### # Exit Sherlock # ============= # Exit the gRPC connection and shut down Sherlock. -time.sleep(5) sherlock.common.exit(True) print("Sherlock gRPC connection closed successfully.") diff --git a/examples/02-analyses/run_random_vibe_strain_map_analysis.py b/examples/02-analyses/run_random_vibe_strain_map_analysis.py index 669663fa..7f02cc49 100644 --- a/examples/02-analyses/run_random_vibe_strain_map_analysis.py +++ b/examples/02-analyses/run_random_vibe_strain_map_analysis.py @@ -1,4 +1,4 @@ -# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -43,14 +43,13 @@ # sphinx_gallery_thumbnail_path = './images/sherlock_run_random_vibe_analysis_example.png' import os -import time from ansys.api.sherlock.v0 import SherlockAnalysisService_pb2 from ansys.sherlock.core import launcher from ansys.sherlock.core.errors import ( SherlockAddStrainMapsError, - SherlockImportODBError, + SherlockImportProjectZipArchiveError, SherlockRunStrainMapAnalysisError, ) from ansys.sherlock.core.types.analysis_types import ( @@ -70,42 +69,28 @@ sherlock = launcher.launch_sherlock(port=9092) ############################################################################### -# Import ODB Archive and Strain Maps -# ================================== -# Import a project and add strain maps to the Sherlock project. +# Import Tutorial Project +# ======================== +# Import the tutorial project zip archive from the Sherlock tutorial directory. try: - # Import ODB++ archive into the project - sherlock.project.import_odb_archive( - ANSYS_ROOT - + os.path.sep - + "sherlock" - + os.path.sep - + "tutorial" - + os.path.sep - + "ODB++ Tutorial.tgz", - True, - True, - True, - True, + sherlock.project.import_project_zip_archive( project="Test", - cca_name="Card", + category="Demos", + archive_file=(os.path.join(ANSYS_ROOT, "sherlock", "tutorial", "Tutorial Project.zip")), ) -except SherlockImportODBError as e: - print(f"Error importing ODB archive: {str(e)}") + print("Tutorial project imported successfully.") +except SherlockImportProjectZipArchiveError as e: + print(f"Error importing project zip archive: {e}") + +############################################################################### +# Add Strain Map +# ==================================== +# Add a strain map to the project. try: - # Add strain maps to the project - strain_map_path = ( - ANSYS_ROOT - + os.path.sep - + "sherlock" - + os.path.sep - + "tutorial" - + os.path.sep - + "StrainMaps" - + os.path.sep - + "StrainMap.csv" + strain_map_path = os.path.join( + ANSYS_ROOT, "sherlock", "tutorial", "StrainMaps", "StrainMap.csv" ) sherlock.project.add_strain_maps( "Test", @@ -118,12 +103,13 @@ "SolidID", "PCB Strain", "µε", - ["Card"], + ["Main Board"], ) ], ) + print("Strain maps added successfully.") except SherlockAddStrainMapsError as e: - print(f"Error adding strain maps: {str(e)}") + print(f"Error adding strain maps: {e}") ############################################################################### # Update Random Vibration Properties @@ -131,10 +117,9 @@ # Configure properties for random vibration analysis using strain maps. try: - # Update properties for random vibration analysis sherlock.analysis.update_random_vibe_props( project="Test", - cca_name="Card", + cca_name="Main Board", model_source=ModelSource.STRAIN_MAP, random_vibe_damping="0.01", part_validation_enabled=False, @@ -150,7 +135,7 @@ strain_map_natural_freqs="100, 200, 300", ) except SherlockRunStrainMapAnalysisError as e: - print(f"Error updating random vibration properties: {str(e)}") + print(f"Error updating random vibration properties: {e}") ############################################################################### # Run Random Vibration Analysis @@ -161,25 +146,24 @@ analysis_request = SherlockAnalysisService_pb2.RunStrainMapAnalysisRequest sherlock.analysis.run_strain_map_analysis( "Test", - "Card", + "Main Board", [ [ RunStrainMapAnalysisRequestAnalysisType.RANDOM_VIBE, [ - ["Phase 1", "Random Event", "TOP", "StrainMap - Top"], - ["Phase 1", "Random Event", "BOTTOM", "StrainMap - Bottom"], + ["On The Road", "1 - Vibration", "TOP", "StrainMap - Top"], + ["On The Road", "1 - Vibration", "BOTTOM", "StrainMap - Bottom"], ], ] ], ) except SherlockRunStrainMapAnalysisError as e: - print(f"Error running random vibration analysis: {str(e)}") + print(f"Error running random vibration analysis: {e}") ############################################################################### # Exit Sherlock # ============= # Exit the gRPC connection and shut down Sherlock. -time.sleep(5) sherlock.common.exit(True) print("Sherlock gRPC connection closed successfully.") diff --git a/examples/02-analyses/update_harmonic_vibe_properties.py b/examples/02-analyses/update_harmonic_vibe_properties.py index 8c513202..03fb668a 100644 --- a/examples/02-analyses/update_harmonic_vibe_properties.py +++ b/examples/02-analyses/update_harmonic_vibe_properties.py @@ -1,4 +1,4 @@ -# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -44,7 +44,10 @@ import os from ansys.sherlock.core import launcher -from ansys.sherlock.core.errors import SherlockImportODBError, SherlockUpdateHarmonicVibePropsError +from ansys.sherlock.core.errors import ( + SherlockImportProjectZipArchiveError, + SherlockUpdateHarmonicVibePropsError, +) ############################################################################### # Launch PySherlock service @@ -57,29 +60,19 @@ sherlock = launcher.launch_sherlock(port=9092) ############################################################################### -# Import ODB Archive -# ================== -# Import a project into the Sherlock environment. +# Import Tutorial Project +# ======================== +# Import the tutorial project zip archive from the Sherlock tutorial directory. try: - # Import ODB++ archive into the project - sherlock.project.import_odb_archive( - ANSYS_ROOT - + os.path.sep - + "sherlock" - + os.path.sep - + "tutorial" - + os.path.sep - + "ODB++ Tutorial.tgz", - True, - True, - True, - True, + sherlock.project.import_project_zip_archive( project="Test", - cca_name="Card", + category="Demos", + archive_file=(os.path.join(ANSYS_ROOT, "sherlock", "tutorial", "Tutorial Project.zip")), ) -except SherlockImportODBError as e: - print(f"Error importing ODB archive: {str(e)}") + print("Tutorial project imported successfully.") +except SherlockImportProjectZipArchiveError as e: + print(f"Error importing project zip archive: {e}") ############################################################################### # Update Harmonic Vibration Properties @@ -92,19 +85,20 @@ "Test", [ { - "cca_name": "Card", + "cca_name": "Main Board", "harmonic_vibe_count": 2, "harmonic_vibe_damping": "0.01, 0.05", "part_validation_enabled": False, "require_material_assignment_enabled": False, - "analysis_temp": 20, + "analysis_temp": 23.8, "analysis_temp_units": "C", "filter_by_event_frequency": False, } ], ) + print("Harmonic vibration properties updated successfully.") except SherlockUpdateHarmonicVibePropsError as e: - print(f"Error updating harmonic vibration properties: {str(e)}") + print(f"Error updating harmonic vibration properties: {e}") ############################################################################### # Exit Sherlock diff --git a/examples/02-analyses/update_ict_properties.py b/examples/02-analyses/update_ict_properties.py index 635cca64..dc79e08c 100644 --- a/examples/02-analyses/update_ict_properties.py +++ b/examples/02-analyses/update_ict_properties.py @@ -1,4 +1,4 @@ -# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -44,7 +44,10 @@ import os from ansys.sherlock.core import launcher -from ansys.sherlock.core.errors import SherlockImportODBError, SherlockUpdateICTAnalysisPropsError +from ansys.sherlock.core.errors import ( + SherlockImportProjectZipArchiveError, + SherlockUpdateICTAnalysisPropsError, +) ############################################################################### # Launch PySherlock service @@ -57,29 +60,19 @@ sherlock = launcher.launch_sherlock(port=9092) ############################################################################### -# Import ODB Archive -# ================== -# Import a project into the Sherlock environment. +# Import Tutorial Project +# ======================== +# Import the tutorial project zip archive from the Sherlock tutorial directory. try: - # Import ODB++ archive into the project - sherlock.project.import_odb_archive( - ANSYS_ROOT - + os.path.sep - + "sherlock" - + os.path.sep - + "tutorial" - + os.path.sep - + "ODB++ Tutorial.tgz", - True, - True, - True, - True, + sherlock.project.import_project_zip_archive( project="Test", - cca_name="Card", + category="Demos", + archive_file=(os.path.join(ANSYS_ROOT, "sherlock", "tutorial", "Tutorial Project.zip")), ) -except SherlockImportODBError as e: - print(f"Error importing ODB archive: {str(e)}") + print("Tutorial project imported successfully.") +except SherlockImportProjectZipArchiveError as e: + print(f"Error importing project zip archive: {e}") ############################################################################### # Update ICT Analysis Properties @@ -92,7 +85,7 @@ "Test", [ { - "cca_name": "Card", + "cca_name": "Main Board", "ict_application_time": 2, "ict_application_time_units": "sec", "ict_number_of_events": 10, @@ -101,8 +94,9 @@ } ], ) + print("ICT analysis properties updated successfully.") except SherlockUpdateICTAnalysisPropsError as e: - print(f"Error updating ICT analysis properties: {str(e)}") + print(f"Error updating ICT analysis properties: {e}") ############################################################################### # Exit Sherlock diff --git a/examples/02-analyses/update_mechanical_shock_properties.py b/examples/02-analyses/update_mechanical_shock_properties.py index ed0933c9..7feddae4 100644 --- a/examples/02-analyses/update_mechanical_shock_properties.py +++ b/examples/02-analyses/update_mechanical_shock_properties.py @@ -1,4 +1,4 @@ -# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -44,7 +44,7 @@ from ansys.sherlock.core import launcher from ansys.sherlock.core.errors import ( - SherlockImportODBError, + SherlockImportProjectZipArchiveError, SherlockUpdateMechanicalShockPropsError, ) from ansys.sherlock.core.types.analysis_types import ModelSource @@ -60,29 +60,19 @@ sherlock = launcher.launch_sherlock(port=9092) ############################################################################### -# Import ODB Archive -# ================== -# Import a project into the Sherlock environment. +# Import Tutorial Project +# ======================== +# Import the tutorial project zip archive from the Sherlock tutorial directory. try: - # Import ODB++ archive into the project - sherlock.project.import_odb_archive( - ANSYS_ROOT - + os.path.sep - + "sherlock" - + os.path.sep - + "tutorial" - + os.path.sep - + "ODB++ Tutorial.tgz", - True, - True, - True, - True, + sherlock.project.import_project_zip_archive( project="Test", - cca_name="Card", + category="Demos", + archive_file=(os.path.join(ANSYS_ROOT, "sherlock", "tutorial", "Tutorial Project.zip")), ) -except SherlockImportODBError as e: - print(f"Error importing ODB archive: {str(e)}") + print("Tutorial project imported successfully.") +except SherlockImportProjectZipArchiveError as e: + print(f"Error importing project zip archive: {e}") ############################################################################### # Update Mechanical Shock Properties @@ -95,7 +85,7 @@ "Test", [ { - "cca_name": "Card", + "cca_name": "Main Board", "model_source": ModelSource.GENERATED, "shock_result_count": 3, "critical_shock_strain": 5, @@ -112,8 +102,9 @@ } ], ) + print("Mechanical shock properties updated successfully.") except SherlockUpdateMechanicalShockPropsError as e: - print(f"Error updating mechanical shock properties: {str(e)}") + print(f"Error updating mechanical shock properties: {e}") ############################################################################### # Exit Sherlock diff --git a/examples/02-analyses/update_part_validation_properties.py b/examples/02-analyses/update_part_validation_properties.py index 752f399f..fd55120c 100644 --- a/examples/02-analyses/update_part_validation_properties.py +++ b/examples/02-analyses/update_part_validation_properties.py @@ -1,4 +1,4 @@ -# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -46,7 +46,7 @@ from ansys.sherlock.core import launcher from ansys.sherlock.core.errors import ( - SherlockImportODBError, + SherlockImportProjectZipArchiveError, SherlockUpdatePartListValidationAnalysisPropsError, ) @@ -61,29 +61,19 @@ sherlock = launcher.launch_sherlock(port=9092) ############################################################################### -# Import ODB Archive -# ================== -# Import a project into the Sherlock environment. +# Import Tutorial Project +# ======================== +# Import the tutorial project zip archive from the Sherlock tutorial directory. try: - # Import ODB++ archive into the project - sherlock.project.import_odb_archive( - ANSYS_ROOT - + os.path.sep - + "sherlock" - + os.path.sep - + "tutorial" - + os.path.sep - + "ODB++ Tutorial.tgz", - True, - True, - True, - True, + sherlock.project.import_project_zip_archive( project="Test", - cca_name="Card", + category="Demos", + archive_file=(os.path.join(ANSYS_ROOT, "sherlock", "tutorial", "Tutorial Project.zip")), ) -except SherlockImportODBError as e: - print(f"Error importing ODB archive: {str(e)}") + print("Tutorial project imported successfully.") +except SherlockImportProjectZipArchiveError as e: + print(f"Error importing project zip archive: {e}") ############################################################################### # Update Part List Validation Properties @@ -96,7 +86,7 @@ "Test", [ { - "cca_name": "Card", + "cca_name": "Main Board", "process_use_avl": True, "process_use_wizard": True, "process_check_confirmed_properties": False, @@ -108,8 +98,9 @@ } ], ) + print("Part list validation analysis properties updated successfully.") except SherlockUpdatePartListValidationAnalysisPropsError as e: - print(f"Error updating part list validation analysis properties: {str(e)}") + print(f"Error updating part list validation analysis properties: {e}") ############################################################################### # Exit Sherlock diff --git a/examples/02-analyses/update_pcb_modeling_properties.py b/examples/02-analyses/update_pcb_modeling_properties.py index 207900be..9ad0e6e1 100644 --- a/examples/02-analyses/update_pcb_modeling_properties.py +++ b/examples/02-analyses/update_pcb_modeling_properties.py @@ -1,4 +1,4 @@ -# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -44,7 +44,10 @@ import os from ansys.sherlock.core import launcher -from ansys.sherlock.core.errors import SherlockImportODBError, SherlockUpdatePcbModelingPropsError +from ansys.sherlock.core.errors import ( + SherlockImportProjectZipArchiveError, + SherlockUpdatePcbModelingPropsError, +) from ansys.sherlock.core.types.analysis_types import ( ElementOrder, UpdatePcbModelingPropsRequestAnalysisType, @@ -63,29 +66,19 @@ sherlock = launcher.launch_sherlock(port=9092) ############################################################################### -# Import ODB Archive -# ================== -# Import a project into the Sherlock environment. +# Import Tutorial Project +# ======================== +# Import the tutorial project zip archive from the Sherlock tutorial directory. try: - # Import ODB++ archive into the project - sherlock.project.import_odb_archive( - ANSYS_ROOT - + os.path.sep - + "sherlock" - + os.path.sep - + "tutorial" - + os.path.sep - + "ODB++ Tutorial.tgz", - True, - True, - True, - True, + sherlock.project.import_project_zip_archive( project="Test", - cca_name="Card", + category="Demos", + archive_file=(os.path.join(ANSYS_ROOT, "sherlock", "tutorial", "Tutorial Project.zip")), ) -except SherlockImportODBError as e: - print(f"Error importing ODB archive: {str(e)}") + print("Tutorial project imported successfully.") +except SherlockImportProjectZipArchiveError as e: + print(f"Error importing project zip archive: {e}") ############################################################################### # Update PCB Modeling Properties @@ -95,7 +88,7 @@ try: sherlock.analysis.update_pcb_modeling_props( "Test", - ["Card"], + ["Main Board"], [ ( UpdatePcbModelingPropsRequestAnalysisType.HARMONIC_VIBE, @@ -113,7 +106,7 @@ ) sherlock.analysis.update_pcb_modeling_props( "Test", - ["Card"], + ["Main Board"], [ ( UpdatePcbModelingPropsRequestAnalysisType.NATURAL_FREQUENCY, @@ -131,7 +124,7 @@ ) sherlock.analysis.update_pcb_modeling_props( "Test", - ["Card"], + ["Main Board"], [ ( UpdatePcbModelingPropsRequestAnalysisType.ICT, @@ -149,7 +142,7 @@ ) sherlock.analysis.update_pcb_modeling_props( "Test", - ["Card"], + ["Main Board"], [ ( UpdatePcbModelingPropsRequestAnalysisType.MECHANICAL_SHOCK, @@ -167,7 +160,7 @@ ) sherlock.analysis.update_pcb_modeling_props( "Test", - ["Card"], + ["Main Board"], [ ( UpdatePcbModelingPropsRequestAnalysisType.RANDOM_VIBE, @@ -186,7 +179,7 @@ ) sherlock.analysis.update_pcb_modeling_props( "Test", - ["Card"], + ["Main Board"], [ ( UpdatePcbModelingPropsRequestAnalysisType.THERMAL_MECH, @@ -203,8 +196,9 @@ ) ], ) + print("PCB modeling properties updated successfully.") except SherlockUpdatePcbModelingPropsError as e: - print(f"Error updating PCB modeling properties: {str(e)}") + print(f"Error updating PCB modeling properties: {e}") ############################################################################### # Exit Sherlock diff --git a/examples/02-analyses/update_random_vibe_properties.py b/examples/02-analyses/update_random_vibe_properties.py index 4ad3425f..e98d380b 100644 --- a/examples/02-analyses/update_random_vibe_properties.py +++ b/examples/02-analyses/update_random_vibe_properties.py @@ -1,4 +1,4 @@ -# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -44,7 +44,10 @@ import os from ansys.sherlock.core import launcher -from ansys.sherlock.core.errors import SherlockImportODBError, SherlockUpdateRandomVibePropsError +from ansys.sherlock.core.errors import ( + SherlockImportProjectZipArchiveError, + SherlockUpdateRandomVibePropsError, +) ############################################################################### # Launch PySherlock service @@ -57,29 +60,19 @@ sherlock = launcher.launch_sherlock(port=9092) ############################################################################### -# Import ODB Archive -# ================== -# Import a project into the Sherlock environment. +# Import Tutorial Project +# ======================== +# Import the tutorial project zip archive from the Sherlock tutorial directory. try: - # Import ODB++ archive into the project - sherlock.project.import_odb_archive( - ANSYS_ROOT - + os.path.sep - + "sherlock" - + os.path.sep - + "tutorial" - + os.path.sep - + "ODB++ Tutorial.tgz", - True, - True, - True, - True, + sherlock.project.import_project_zip_archive( project="Test", - cca_name="Card", + category="Demos", + archive_file=(os.path.join(ANSYS_ROOT, "sherlock", "tutorial", "Tutorial Project.zip")), ) -except SherlockImportODBError as e: - print(f"Error importing ODB archive: {str(e)}") + print("Tutorial project imported successfully.") +except SherlockImportProjectZipArchiveError as e: + print(f"Error importing project zip archive: {e}") ############################################################################### # Update Random Vibration Properties @@ -89,14 +82,15 @@ try: sherlock.analysis.update_random_vibe_props( "Test", - "Card", + "Main Board", random_vibe_damping="0.01, 0.03", part_validation_enabled=False, require_material_assignment_enabled=False, model_source="GENERATED", ) + print("Random vibration properties updated successfully.") except SherlockUpdateRandomVibePropsError as e: - print(f"Error updating random vibration properties: {str(e)}") + print(f"Error updating random vibration properties: {e}") ############################################################################### # Exit Sherlock diff --git a/examples/02-analyses/update_solder_fatigue_properties.py b/examples/02-analyses/update_solder_fatigue_properties.py index 1835ad8c..6e0333ea 100644 --- a/examples/02-analyses/update_solder_fatigue_properties.py +++ b/examples/02-analyses/update_solder_fatigue_properties.py @@ -1,4 +1,4 @@ -# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -44,7 +44,10 @@ import os from ansys.sherlock.core import launcher -from ansys.sherlock.core.errors import SherlockImportODBError, SherlockUpdateSolderFatiguePropsError +from ansys.sherlock.core.errors import ( + SherlockImportProjectZipArchiveError, + SherlockUpdateSolderFatiguePropsError, +) ############################################################################### # Launch PySherlock service @@ -57,18 +60,19 @@ sherlock = launcher.launch_sherlock(port=9092) ############################################################################### -# Import ODB Archive -# ================== -# Import a project into the Sherlock environment. +# Import Tutorial Project +# ======================== +# Import the tutorial project zip archive from the Sherlock tutorial directory. try: - # Import ODB++ archive into the project - odb_path = os.path.join(ANSYS_ROOT, "sherlock", "tutorial", "ODB++ Tutorial.tgz") - sherlock.project.import_odb_archive( - odb_path, True, True, True, True, project="Test", cca_name="Card" + sherlock.project.import_project_zip_archive( + project="Test", + category="Demos", + archive_file=(os.path.join(ANSYS_ROOT, "sherlock", "tutorial", "Tutorial Project.zip")), ) -except SherlockImportODBError as e: - print(f"Error importing ODB archive: {str(e)}") + print("Tutorial project imported successfully.") +except SherlockImportProjectZipArchiveError as e: + print(f"Error importing project zip archive: {e}") ############################################################################### # Update Solder Fatigue Properties @@ -80,7 +84,7 @@ "Test", [ { - "cca_name": "Card", + "cca_name": "Main Board", "solder_material": "TIN-LEAD (63SN37PB)", "part_temp": 70, "part_temp_units": "F", @@ -89,8 +93,9 @@ } ], ) + print("Solder fatigue properties updated successfully.") except SherlockUpdateSolderFatiguePropsError as e: - print(f"Error updating solder fatigue properties: {str(e)}") + print(f"Error updating solder fatigue properties: {e}") ############################################################################### # Exit Sherlock diff --git a/src/ansys/sherlock/core/lifecycle.py b/src/ansys/sherlock/core/lifecycle.py index e57b4efb..31de09a8 100644 --- a/src/ansys/sherlock/core/lifecycle.py +++ b/src/ansys/sherlock/core/lifecycle.py @@ -1228,10 +1228,10 @@ def add_harmonic_vibe_profiles( Frequency of the harmonic profile expressed in frequency units. - load: float Load of the harmonic profile expressed in load units. - - triaxial_axis: str - Axis that this profile should be assigned to if the harmonic - profile type is ``"Triaxial"``. Options are: ``"x"``, ``"y"``, - and ``"z"``. + - triaxial_axis: str + Axis that this profile should be assigned to if the harmonic + profile type is ``"Triaxial"``. Options are: ``"x"``, ``"y"``, + and ``"z"``. Returns ------- diff --git a/src/ansys/sherlock/core/stackup.py b/src/ansys/sherlock/core/stackup.py index 4faf6c9e..33847132 100644 --- a/src/ansys/sherlock/core/stackup.py +++ b/src/ansys/sherlock/core/stackup.py @@ -490,7 +490,7 @@ def update_laminate_layer( cca_name : str Name of the CCA. layer : str - Layer ID associated with the conductor layer. + Layer ID associated with the laminate layer. manufacturer : str, optional Manufacturer of the material for the laminate layer. The default is ``""``. To update the material, the