Analysis
Last update: 16.07.2025The following sample code illustrates how to create a simple example.
- The examples provided below can be found within the 'Install_Path\Motion\Document\Postprocessor API for Python.zip' compressed file.
Sound Pressure
Sound pressure analysis (SPA) can be used to analyze the sound pressure generated by the vibration of the system surface based on "Rayleigh Integral". this example describes how to create the Sound Pressure.
- Before the analysis, the bodies that are the source of sound pressure must be defined as FE or EasyFlex bodies in the preprocessor.
- The coordinate systems must be created to define the microphone positions which are the target positions for sound pressure calculation.
# OperationAPI_CreatingASoundPressure.py
import sys
current_dir = __file__.rsplit('\\', 1)[0]
external_modules_path = current_dir + '\\..\\..\\Modules'
sys.path.append(external_modules_path)
from OperationAPI import *
# Start the headless application interface
applicationHandler = ApplicationHandler()
# Import result file
result_file_path = get_result_file_path()
# Set array about result file
filepaths = List[str]()
filepaths.Add(result_file_path)
# Open about result files
applicationHandler.AddDocument(filepaths)
# Find Page
pages = applicationHandler.GetPages()
findViews = list()
for page in pages :
views = page.GetViews()
animationViews = [view for view in views if view.ViewType == ViewType.Animation]
for animationView in animationViews :
if animationView.DocumentFilePath == result_file_path and animationView.AnalysisResultType == AnalysisResultType.Dynamics :
findViews.append(animationView)
viewCount = len(findViews)
if viewCount > 0 :
animationview = findViews[0]
animationview.CreateCoordinateSystem("Microphone", "Ground")
microphone = animationview.GetViewModelByName("Microphone")
microphone.TransformationOffsetPosition = Vector(0,300,0)
bodynames = List[str](1)
bodynames.Add(r'FEBody_01')
microphoneNames = List[str](1)
microphoneNames.Add(r'Microphone')
# Creates sound pressure data based on the Rayleigh Integral for analyzing sound pressure generated by vibrations on the system surface.
# bodyNames - The list of entity names whose surfaces generate the sound pressure.</param>
# coordinateNames - The list of coordinate system names used in the analysis.</param>
# coarseningRate - Percentage of the number of nodes remaining in the sampling result with respect to the initial number of nodes.</param>
# maxAreaFactor - Maximum allowable area of each element generated by the sampling result. It sets the condition that the area of each element cannot be greater than (Max Area Factor) * (Average element area).</param>
# maxAspectRatio - Maximum allowable aspect ratio of each element generated by the sampling result.</param>
# airDensity - Density of the air.</param>
# soundVelocity - Speed of sound in air.</param>
# frequency - The number of analysis results per second is determined as 10*analysis frequency.</param>
# start - The start frame for the time range to be analyzed.</param>
# end - The end frame for the time range to be analyzed.</param>
# isDeicbelScale - The decibel scale.</param>
animationview.CreateSoundPressure(bodynames, microphoneNames, 10.0, 100.0, 3.0, 1.21E-09, 343000.0, 2000.0, 1, 10, False)
# Close the Pages
pages = applicationHandler.GetPages()
for page in pages :
page.Close()
# Close the Document
applicationHandler.CloseDocument(result_file_path)