Simpack Post QSA Scripting (Contour Bound Settings)

Hi! I have a question regarding the topic "QSA Scripting in Simpack Post". I want to automize the post processing of an offline time integration results file (.sbr). I am simulating a human spine in which the vertebrae are set as rigid bodies and the intervertebral discs are set as flexible bodies (.fbi). In order to create an animation of the stress distribution (stress equivalent to Mises) within the flexible bodies I wrote a script which creates a new Simpack project, adds the results file, creates an animation and enables the contouring of the discs. The Script is also able to save the .mp4 file of the animation correctly. So in other words I am almost done. The only thing which is not working and I could not find out via the documentation is how I access the bound settings for the contour plot. So the initial bounds are set from 0 to 1 and all the simulated stresses are of course exceeding these values. As a consequence, every disc is displayed with maximum red color and the animation is not useable. Does anybody know how to code in QSA Simpack Post? I would really appreciate some help/ ideas. Thank you very much!

 

 

Here is my higlighted script and a snippet of the documentation, which I think holds the needed information, but when I try to implement the property of dynamicContouring the QSA editor in Simpack throws an error. (Error. Trying to access undefined member 'stress_equiv_mises')

 

// Function to create a new project and load a result file

function createAndLoadProject() {

var project = Spck.addProject();

 

// Load the result file into the project

var resultFileLoaded = project.addResultFile("C:/Users/.../CoSimulationModel/SpineModelTest.output/SpineModelTest.sbr");

return project;

}

 

function configureAndExportAnimation(project) {

// Page exists and we add the animation frame at the first position

var animationFrame = project.pset1.page1.addAnimationFrame(0);

 

// Load result file and add the model animation to the animation frame

var resultFile = project.addResultFile("C:/Users/ge86yod/Documents/SpineTest/CoSimulationModel/SpineModelTest.output/SpineModelTest.sbr");

var modelAnimation = animationFrame.addModel(resultFile);

 

// Access the animation frame's dynamic contouring settings

var dCS = animationFrame.contouring.dynamicContouring;

 

// Enables Contouring and switches the tick from the box "none" to "Flexible bodies"

dCS.enabled = true;

 

// Set the contouring component to STRESS_EQUIV_MISES (ticks the stress box)

dCS.component = dCS.STRESS_EQUIV_MISES;

 

// Access the bounds settings for stress_equiv_mises and set them

dCS.stress_equiv_mises.autoBounds = false;

dCS.stress_equiv_mises.boundsMin = 0;

dCS.stress_equiv_mises.boundsMax = 1000000;

 

// Set further properties on the animation frame

animationFrame.width = 1920;

animationFrame.height = 1080;

animationFrame.keepAspectRatio = true;

animationFrame.compression = 30; // Compression rate for MP4 output

animationFrame.framerate = 30;

 

// Export the animation to a .mp4 file

var exported = AnimationExporter.exportAniFrame(animationFrame, "C:/Users/.../CoSimulationModel/SpineModelTest.output/SpineModelAnimation.mp4");

}

 

// Main function to orchestrate the script

function main() {

var project = createAndLoadProject();

if (project) {

configureAndExportAnimation(project);

}

}

 

// Execute the main function

main();

 

 

Here is the documentation snippet. It says that stress_equiv_mises is a bound variable, but I could not find how these are handled.

                  DynamicContouring Class Reference
                  The possible options for dynamic contouring. More...


Properties

Bounds     stress_equiv_mises
                 Access the bounds settings stress_equiv_mises. 
 

Thank you very much!

Edu SIMULATION