The XML definition file is set up to create an Attribute Group object for the user to browse to the macro, and a DA Result object to indicate which column from the CSV file to present results for.
It will run two scripts. Upon solve, the macro file defined by the user in the Attribute Group will be run by Mechanical APDL and the CSV file created. Upon evaluate, values will be read from the appropriate column in the CSV file and displayed in the Details view of the Design Assessment system.
<?xml version="1.0" encoding="utf-8"?>
<DARoot ObjId ="1" Type="CAERep" Ver="2">
<Attributes ObjId="2" Type="CAERepBase" Ver="2">
<DAAttribute ObjId="100" Type="DAAttribute" Ver="2">
<AttributeName PropType="string">MAPDL Macro File</AttributeName>
<AttributeType PropType="string">Browse</AttributeType>
<Application PropType="string">All</Application>
<Validation PropType="vector<string>">256</Validation>
<Default PropType="string"></Default>
</DAAttribute>
<DAAttribute ObjId="101" Type="DAAttribute" Ver="2">
<AttributeName PropType="string">Column</AttributeName>
<AttributeType PropType="string">Int</AttributeType>
<Application PropType="string">All</Application>
<Validation PropType="vector<string>">1,100</Validation>
<Default PropType="string">1</Default>
</DAAttribute>
</Attributes>
<AttributeGroups ObjId ="3" Type="CAERepBase" Ver="2">
<DAAttributeGroup ObjId ="110000" Type="DAAttributeGroup" Ver="2">
<GroupType PropType="string">Select MAPDL File</GroupType>
<GroupSubtype PropType="string">By Browsing</GroupSubtype>
<AttributeIDs PropType="vector<unsigned int>">100</AttributeIDs>
</DAAttributeGroup>
</AttributeGroups>
<DAScripts ObjId="4" Type="DAScripts" Ver="2">
<Solve PropType="string">%DAPROGFILES%\Ansys Inc\DA MAPDL Example\MAPDL_S.py</Solve>
<Evaluate PropType="string">%DAPROGFILES%\Ansys Inc\DA MAPDL Example\MAPDL_E.py</Evaluate>
<DAData PropType="int">1</DAData>
<CombResults PropType="int">0</CombResults>
</DAScripts>
<Results ObjId="5" Type="CAERepBase" Ver="2">
<DAResult ObjId ="120000" Type="DAResult" Ver="2">
<GroupType PropType="string">Select Result Column</GroupType>
<GroupSubtype PropType="string">Number Input</GroupSubtype>
<AttributeIDs PropType="vector<unsigned int>">101</AttributeIDs>
<DisplayType PropType="string">Elemental</DisplayType>
<DisplayStyle PropType="string">Scalar</DisplayStyle>
<DisplayUnits PropType="string">No Units</DisplayUnits>
</DAResult>
</Results>
</DARoot>
The Attributes section defines two DAAttributes:
1st Attribute: Enables the users to browse to the Macro file, Attribute Id = 100:
Named “MAPDL Macro File”
Browse control type
Applies to all geometry
Validates for a maximum length of 256 characters
No default entry
2nd Attribute: Enables the users to select a column in the CSV file, Attribute Id = 101:
Named “Column”
Integer entry type
Applies to all geometry
Validates to check the value is between 1 and 100 (inclusive)
Defaults to a value of 1
In the AttributeGroups section, we define a single Attribute Group object. As we have only one, the GroupType and GroupSubtype fields are effectively redundant, but ought to be entered.
Allow the users to browse to the Macro file, Attribute Id = 110000:
Type = Select MAPDL File
SubType = By Browsing
Include Attribute with Id = 100
This becomes the following object in the Mechanical application:

In the DAScripts section we set the path to the scripts to be run on Solve and on Evaluate. In this case we use the %DAPROGFILES% option to direct the program to the Program Files folder, wherever it’s defined locally. The scripts in this case are called MAPDL_S.py and MAPDL_E.py. We want to permit Design Assessment results and prevent combination results
In the Results section, we define a single DAResult object. As we have only one, the GroupType and GroupSubtype fields are effectively redundant, but ought to be entered.
Allow the users to browse to the Macro file, Attribute Id = 110000:
Type = Select Result Column
SubType = Number Input
Include Attribute with Id = 101
DisplayType is set to show results per element
DisplayStyle is set to show a single, scalar, result
There are no units associated to this result, we’ll set this in the python script
This becomes the following object in the Mechanical application:
