AnyFE Tool for Ansys (APDL code generator)

Hi Carl,

I typically use Python to just postprocess these results. Low effort solution.
Here is a sample Python file that could be easy to modify for your needs. I hope it is readable and works (I have not tested).

The short instructions are that you need to replace ‘mycomponentnamehere’ by the component that will represent area on the vertebra. Secondly change the ‘Name=Main.Studies.HumanModel.BodyModel.Trunk.MusclesSpineLeft.PsoasMajor.PML1I_TM’ pattern for the right one.

What the change will do - it will distribute the joint load onto the selected area instead of selecting something automatically.

Regards,
Pavel

P.S. I had to rename my Python file into a txt for the forum to allow attachments.

Dear Pavel,

Thank you for your assistance. I have managed to solve the problem without using Python. I have also successfully exported forces for the L4 vertebra. At this stage, I am trying to develop a model for loading of the intervertebral disk between L3 and L4 vertebrae. I have geometries for all the disk, L3 and L4. Is there a way in which I could combine the loads for L3 and L4 without the respective reactions of from each other so that I can eventually model contact between vertebra and disk in order to obtain the stress distibution in the intervertebral disk?

Regards,
Carl

Hi Carl,

you can filter out reaction forces that you do not need and just apply the same technique:

  AnyMechOutputFileForceExport <ObjectName> = 
  {
    FileName = "";
    /*NumberFormat = 
    {
    Digits = 15;
    Width = 22;
    Style = ScientificNumber;
    FormatStr = "";
    };*/
    //UseRefFrameOnOff = Off;
    //AllSegmentsInStudyOnOff = Off;
    //XMLformatOnOff = Off;
    //ForceObjectExclude = ;   // FILTER OUT FORCES YOU DO NOT NEED
    //ForceObjectList = ;        // ADD ONLY REQUESTED FORCES 
    //AnyRefFrame &<Insert name0> = <Insert object reference (or full object definition)>; You can make any number of these objects!
    //AnySeg &<Insert name0> = <Insert object reference (or full object definition)>; You can make any number of these objects!
  };

Regards,
Pavel

dear sir i am beginner for ansys, is there any way to get Apdl code from ansys workbench.

You may be able to get an APDL script from ANSYS Mechanical. You should be able to see the scripts of your models, but I don’t think you can do it from the Workbench since the APDL is specific to ANSYS Mechanical.

Please refer to the relevant documentation of ANSYS and related products. This forum is for answering questions related to AnyBody Modeling System and AnyBody Managed Model Repository.

Regards,
Pavel

Hi everyone,

I am new to apdl and scripting as well. I have made the simple simulation of one end fixed beam and load at another side and as a result i have got von mises stress(eqv stress) in WORKBENCH. And i have saved this process as .db file and then reopened in apdl.

Now I want to do post processing of nodal solution in apdl with scripting.

(1) How to generate an array filled with result of eqv stress at each node for only 1st load step.

(2) If there are 5 load steps and i want the whole result of 5 load step in a single array at all nodes.

How can i generate commands for this description ?

Thank in advance,
Dhruv

Hi everyone,

I am new to apdl and scripting as well. I have made the simple simulation of one end fixed beam and load at another side and as a result i have got von mises stress(eqv stress) in WORKBENCH. And i have saved this process as .db file and then reopened in apdl.

Now I want to do post processing of nodal solution in apdl with scripting.

(1) How to generate an array filled with result of eqv stress at each node for only 1st load step.

(2) If there are 5 load steps and i want the whole result of 5 load step in a single array at all nodes.

How can i generate commands for this description ?

Thank in advance,
Dhruv

Hi Dhruv,

this Forum is about the AnyBody Modeling System and this post is about the interface between ANSYS and AnyBody.

Hello,
I am trying to import the lumbar spine loads derived from AnyBody and use them in my own meshed model. My “lumbar spine” is scaled in anybody. I export the files I need from anybody. Before I convert them to ANSYS using AnyFE2Ansys I want to know if the global coordinate system of ANSYS coincides with the global coordinate system of anybody.

p.s. I would move the ANSYS working plane to a local coordinate system, as shown in the tutorial, on any of my lumbar vertebrae’s local coordinate system, but when I attach a local coordinate system on any of my vertebrae, it is basically attached on the node of the sacrum.

thank you very much in advance.

George

George,

You need to define an output reference point in AnyBody model that you could reconstruct in your FE model - for example use 3 points to construct a point and the orientation. And output all loads using this ref. frame from AnyBody.

In ANSYS APDL code you need to define a working plane using exactly the same 3 points, (for example, you could check the WP keyword). And this is the working plane which should be used to add AnyBody loads.

You may want to modify the template.

Hope this makes sense.
Regards,
Pavel

What I have done is :

AnySeg &L5Seg =Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.L5Seg;
L5Seg = {
AnyRefNode localrefframe = {
sRel = {0, 0, 0};
//ARel = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
AnyDrawRefFrame drws = {ScaleXYZ = {1,1,1}*0.3;RGB={0,0,1};};
};
};
as it is shown in the tutorial.

If I understand correctly, I have to add 2 more points in the same folder with the “AnyRefNode” command with sRel {1,0,0} and {0,1,0} respectively and then add a reference frame by these 3 points.
Is there any command that does this thing?

Thanks,
Giorgos

Not exactly, it will be hard to find points matching these 3 on your mesh.

You need to select 3 points on the surface of the bone - this way you can select the same points on your mesh and construct relevant WP in ANSYS, whereas you would use constructed ref. frame in AnyBody for output.

Regards,
P.

Where to insert this code

AnyOperationShellExec ConvertToAPDL={
Show=On;
FileName = “AnyFE2APDL.exe”;
Arguments = “-i …\files_in\clavload.xml -o …\files_out -t …\APDLTemplate.txt”;
WorkDir=“C:\Users\sd.ANYBODY\TEMP\AMMRV1.2\AMMRV1.2\Application\Examples\StandingModel\Converter”;
};

How I have to change arguments directory for a file on desktop “C:\Users\Asad\Desktop” (for example) please give complete path of input, output, and template

Hi Ali,

The code can be inserted anywhere you want. If you want it to be called as a part of the analysis - you can access the folder of InverseDynamics.PostOperation and insert as an internal folder, e.g.:

AnyBodyStudy myStudy = {
...
InverseDynamics.PostOperation = {
AnyOperationShellExec = {
...
};
};
};

And regarding the paths - I would recommend to copy the converter into Converter folder inside of you model, like it is done in the Tutorials:

AMMRPATH\StandingModel\Converter..

And it should supposedly work. But you might want to try and see what needs to be changed.

Regards,
Pavel

HI dear sir I am unable to get ADPL file whenever I am following the steps from the lesson anybody to ansys interface it is giving me this error i have tried what you tol to me.Please help me out sir

ERROR(OBJ.FILE1) : C:/U…s/t…k/D…p/A…3/AMMR/A…n/E…s/S…l/SitUpModel.Main.any(104) : FE_out.FileName : Problem with file : C:\Users amuk\Desktop\AMMRV1.6.3\AMMR\Application\Examples\SitUpModel\files_in\ForceL5.xml : The output data file does not exist and cannot be created

#include “…/libdef.any”

// Find a detailed description here
#include “Model/Description.any”

Main = {
// ----------------------------------------------------------
// Path to draw settings
// ----------------------------------------------------------
#path BM_DRAWSETTINGS_FILE “Model/DrawSettings.any”

// ----------------------------------------------------------
// Model configuration:
// For more info on body model configuration options please load the model and double click on:
// #include “<ANYBODY_PATH_BODY>\Documentation\BodyModel.param eters.any”
// ----------------------------------------------------------

// The Mannequin file specifies load-time positions for all the segments
// in the HumanModel. This is important for the model’s ablity to resolve
// all the kinematic constraints when the model is analyzed.
// The mannequin file also drives those degrees of freedom of the human
// model that are not governed by problem-specific drivers at run time.
#path BM_MANNEQUIN_FILE “Model/Mannequin.any”

// #define BM_TRUNK_MUSCLES CONST_MUSCLES_NONE
// #define BM_LEG_MUSCLES_BOTH CONST_MUSCLES_NONE
// #define BM_ARM_MUSCLES_BOTH CONST_MUSCLES_NONE

// Model of the human body to be used for the analysis
#include “<ANYBODY_PATH_BODY>/HumanModel.any”

/// The actual model where all components are assembled
AnyFolder Model =
{
/// Body model without default drivers
AnyFolder &HumanModel=.HumanModel.BodyModel;
/// Reference to the mannequin folder (used by drivers)
AnyFolder &Mannequin =.HumanModel.Mannequin;

#include "Model/Environment.any"   

AnyFolder ModelEnvironmentConnection = {
  #include "Model/JointsAndDrivers.any"
};

//--&gt;Folder for design parameters
AnyFolder Parameters = 
{
  AnyVar Distance_From_PelvisContactNode_To_HeelNode = 0.6;
};
//&lt;--

//--&gt;Use of the object name to insert additional objects inside
HumanModel.Trunk.SegmentsLumbar.PelvisSeg = 
{
  AnyRefNode ContactNode = 
  {
    sRel = .Scale({-0.02, -0.18, 0});
    AnyDrawRefFrame Drw = 
    {
      ScaleXYZ = 0.1*{1, 1, 1};
      RGB = {1, 0, 0};
    };
  };
};
//&lt;--

};

AnyBodyStudy Study = {
AnyOperationShellExec ConvertToAPDL=
{
Show=On;
FileName =“AnyFE2APDL.exe”;
Arguments ="-i\C:\Users amuk\Desktop\AMMRV1.6.3\AMMR\Applicati on\Examples\SitUpModel\Model\ForceL5.xml-o\C:\Users amuk\Desktop\AMMRV1.6.3\AMMR\Applicati on\Examples\SitUpModel\Model-t\C:\Users amuk\Desktop\AMMRV1.6.3\AMMR\Applicati on\Examples\SitUpModel\Model\APDLsitup.txt";
WorkDir=“C:\Users amuk\Desktop\AMMRV1.6.3\AMMR\Ap plication\Examples\SitUpModel\Model”;
};

AnyFolder &Model = .Model;

tEnd = 10.0;
Gravity = {0.0, -9.81, 0.0};
nStep = 51;
AnyMechOutputFileForceExport ForceOutput = 
 {
   FileName = "Output\ForceL5.xml";
   /*NumberFormat = thats fine t
   {
   Digits = 15;
   Width = 22;
   Style = ScientificNumber;
   FormatStr = "";
   };*/
   AllSegmentsInStudyOnOff = Off;
   XMLformatOnOff = On;
   UseRefFrameOnOff = Off;
   AnySeg &L5Seg = Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.L5S  eg;
   AnyRefFrame &L5RefFrame = Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.L5S  eg;
 };    

AnyMechOutputFileForceExport FE_out =
{
FileName = “files_in/ForceL5.xml”;
UseRefFrameOnOff = On;
AnyRefFrame &L5RefFrame = Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.L5S eg;
AllSegmentsInStudyOnOff = Off;
XMLformatOnOff = On;
//AllSegmentsInStudyOnOff = Off;
AnySeg &L5 = Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.L5S eg;
};

//include the next line to have a camera in the model

}; // End of study

// Include an operation sequence to run all required steps of your application (see Operations tab)
#include “<ANYBODY_PATH_TOOLBOX>\Operations\RunAppSequence. any”

}; //Main

Try to create “files_in” folder in your model folder.

Kind regards,
Pavel