Script Tip Friday- From ODB++ to Modal Analysis
We have a treat for you on this Script Tip Friday! Enrico Bedogni, an R&D Simulation Engineer at Meta System SpA, reached out with a tip that goes above and beyond. He shares his 4-step process to go from ODB++ To Modal Analysis. Thanks so much Enrico, amazing work!
From ODB++ to Modal Analysis - Short introduction and overview
This work comes out from a deep study of the ODB++ file framework (PCB exchange file), this file is an ordered collection of folders/subfolders and text files.
The main target is to automatically generate a simplify modal analysis of a PCB starting from the ODB++ to get quick results in the early design stages.?The image below describes the full workflow. Ideally, the input file is the only ODB++ but in this first draft we also use an external library to add some extra information.
How to Start scripting – official documentations
Before I show you the script step by step, I’d like to share with you the resources that I found most useful.
Workbench and Mechanical are well documented with great guides full of examples and pre-written code to use:
I’ve found a Developers Guide.pdf that gives a good overview of the SpaceClaim API and its fundamental concepts in the installation folder (e.g. C:\Program Files\ANSYS Inc\v222\scdm\SpaceClaim.Api.V23). Then, for those who have access to Ansys Learning Hub (ALH), I suggest to look for the course Scripting in Ansys SpaceClaim. In this course, many topics are covered like objects, selections, named selections, feature operations and parameters.
In the end, YouTube is always a good way to go, here the best to me:
?
Workbench script – How to
In this post I’m going to focus on the Workbench script only, because I want to highlight its capability.
The whole workflow is managed by the workbench script that, during its execution, recalls two other scripts. This is amazing because one can script on single products and take care of the details (like SPCM and Mechanical) and then glue up all together to automate in just one script. Here just an overview on the scripting interface:
The script step by step:
At the script level, the approach is quite similar when you use the interface; you must first get a System and then reach all the green checks in order to get the results. Below I’ve associated the code to what it is done usually using the interface.
I want to highlight two commands at line 30 and line 41 in particular, they allowed to run the SPCM script and Mechanical script.
Even if they do the same things, they work a bit different. SPCM only needs the path of the script file, while Mechanical needs to read the file as txt then send it to interpreter with ad hoc command (see in the script).
Overview of what they do:
SPCM script:
领英推荐
Mechanical script:
System creation
Lines 2 to 5 – Definition of the project folder (line 3) and creation of a result folder (line 4 and 5) where to store the final results (this is possible importing an external line 2).
Line 9 – Saving the project in the project folder.
Line 13 to 17 – Instantiating of a modal template and creation of a System.
Engineering Data
Line 21 – Getting the container
Line 22 – Importing a standard material from Lib.
Geometry
Line 28 – Getting the container
Line 29-30 – Running a SPCM script.
Line 31-32 – Exit from SPCM and refresh the geometry
Model, Setup, Solution and Results
Line 36 – Getting the container
Line 39-40-41 – Running a Mechanical script.
Line 42-43 – Exit from Mechanical and refresh the model
All Together
Keep Coding!
FEA | CFD | DEM | Multiphysics Simulation | Mission Engineering | Digital Twin | SaaS | Digital Thread | CAE | CAD | Engineering Simulations | MBSE |
2 年A full tutorial to discovery scripting is here for anyone who is interested: https://www.youtube.com/playlist?list=PLvsJbyBB0CMcLkhinxjCtJwRaVZkRitAf
Regional Sales Team Lead at ANSYS, Inc.
2 年Great job! Enrico Bedogni !!
Mechanical Engineer Manager presso Meta System spa
2 年Good job Enrico !!
Mechanical Design Engineer presso Meta System S.p.A
2 年Enrico Bedogni ragazzo sei un grande!
Researcher
2 年Nicely explained thanks