The extension GenericMaterialTransfer implements two custom
material transfer task groups, each passing material data to a downstream task group
or task.
The first task group references a single custom task that passes MatML-formatted material data to a downstream external Engineering Data task group.
The second task group references both a custom task and an external task. The custom Material task passes MatML-formatted material data to the downstream external Engineering Data task.
This example also demonstrates input and output specification and file management capabilities.
The XML extension definition file GenericMaterialTransfer.xml specifies the custom task groups that are to appear in your custom ACT Workflows task group in the Workbench Toolbox.
This XML file performs the following actions:
References the IronPython script generic_material_transfer.py.
Defines a single task in the <tasks> block.
Specifies that the callback <onupdate>
invokes the IronPython function producer_update,
which accesses a materials file.
Defines the inputs and outputs in the
<inputs> and
<outputs> blocks. Note that an empty
input and an output are defined. The attribute
outputtype is set to
MatML31, specifying the kind of data exposed
and generated by this task.
Defines two custom task groups in the
<taskgroups> block.
The first task group,
GenericMaterialTransfer,
references the custom task Material
and transfers material data to an external task group
Engineering Data that has been
added downstream.
The second task group,
GenericMaterialTransferComplete,
references the custom task Material
and also, by using the attribute
external, the external task
Engineering Data. The custom task
transfers material data to the downstream external task.
The file GenericMaterialTransfer.xml contains the following code:
<extension version="1" name="GenericMaterialTransfer">
<guid shortid="GenericMaterialTransfer">69d0095b-e138-4841-a13a-de12238c83f8</guid>
<script src="generic_material_transfer.py" />
<interface context="Project">
<images>images</images>
</interface>
<workflow name="wf5" context="Project" version="1">
<tasks>
<task name="Material" caption="Material" icon="material_cell" version="1">
<callbacks>
<onupdate>update</onupdate>
</callbacks>
<inputs>
<input/>
</inputs>
<outputs>
<output format="" type="MatML31"/>
</outputs>
</task>
</tasks>
<taskgroups>
<taskgroup name="GenericMaterialTransfer" caption="Generic Material" icon="material_system"
category="ACT Custom Workflows" abbreviation="GenMatXfer" version="1">
<includeTask name="Material" caption="Material"/>
</taskgroup>
<taskgroup name="GenericMaterialTransferComplete" caption="Generic Material Complete"
icon="material_system" category="ACT Custom Workflows" abbreviation="GenMatXferComplete" version="1">
<includeTask name="Material" caption="Material"/>
<includeTask external="True" name="EngDataCellTemplate" caption="Engineering Data"/>
</taskgroup>
</taskgroups>
</workflow>
</extension>The IronPython script generic_material_transfer.py
contains the code for passing the MatML-formatted material data to a downstream
Engineering Data task group or task. This includes
the method update (invoked by the callback
<onupdate> in the XML file), which accesses the
file SampleMaterials.xml.
The script generic_material_transfer.py contains the following code:
def update(task):
container = task.InternalObject
extensionDir = ExtAPI.ExtensionManager.CurrentExtension.InstallDir
matFilePath = System.IO.Path.Combine(extensionDir, "Sample_Materials.xml")
matFileRef = None
isRegistered = IsFileRegistered(FilePath=matFilePath)
if isRegistered == True:
matFileRef = GetRegisteredFile(matFilePath)
else:
matFileRef = RegisterFile(FilePath=matFilePath)
AssociateFileWithContainer(matFileRef, container)
outputRefs = container.GetOutputData()
matOutputSet = outputRefs["MatML31"]
matOutput = matOutputSet[0]
matOutput.TransferFile = matFileRefThe file Sample_Materials.xml that is accessed by the
IronPython method update contains the MatML-formatted
material data:
<?xml version="1.0" encoding="UTF-8"?>
<EngineeringData version="16.1">
<Notes />
<Materials>
<MatML_Doc>
<Material>
<BulkDetails>
<Name>Sample Material</Name>
<Description>Sample material from Driver</Description>
<PropertyData property="pr0">
<Data format="string">-</Data>
<ParameterValue parameter="pa0" format="float">
<Data>494.1474492,912.7972764,1172.453938,1941.495468,2803.754154,3869.063522,5245.395513,
10378.82012,18192.58268,28438.67868,57755.1982,94951.87682,135751.6191,178064.7612,216504.4272,261538.9311,
304701.5076,333300.2826,364061.2544,397079.5705,432533.1159,457543.8578,483751.5301</Data>
<Qualifier name="Variable Type">Dependent,Dependent,Dependent,Dependent,Dependent,Dependent,
Dependent,Dependent,Dependent,Dependent,Dependent,Dependent,Dependent,Dependent,Dependent,Dependent,
Dependent,Dependent,Dependent,Dependent,Dependent,Dependent,Dependent</Qualifier>
</ParameterValue>
<ParameterValue parameter="pa1" format="float">
<Data>0.1338,0.2675,0.3567,0.6242,0.8917,1.1592,1.4268,2.051,2.586,3.0318,3.7898,4.3694,4.8153,
5.172,5.4395,5.707,5.9299,6.0637,6.1975,6.3312,6.465,6.5541,6.6433</Data>
<Qualifier name="Variable Type">Independent,Independent,Independent,Independent,Independent,
Independent,Independent,Independent,Independent,Independent,Independent,Independent,Independent,Independent,
Independent,Independent,Independent,Independent,Independent,Independent,Independent,Independent,
Independent</Qualifier>
</ParameterValue>
</PropertyData>
<PropertyData property="prDriver">
<Data format="string">-</Data>
<Qualifier name="Data Link Version">1</Qualifier>
<Qualifier name="Model Type">Linear;Isotropic</Qualifier>
<Qualifier name="Sample Property">Value</Qualifier>
</PropertyData>
</BulkDetails>
</Material>
<Metadata>
<ParameterDetails id="pa0">
<Name>Stress</Name>
<Units>
<Unit>
<Name>Pa</Name>
</Unit>
</Units>
</ParameterDetails>
<ParameterDetails id="pa1">
<Name>Strain</Name>
<Units>
<Unit>
<Name>m</Name>
</Unit>
<Unit power="-1">
<Name>m</Name>
</Unit>
</Units>
</ParameterDetails>
<PropertyDetails id="pr0">
<Unitless />
<Name>Sample Property</Name>
</PropertyDetails>
<PropertyDetails id="prDriver">
<Unitless />
<Name>Driver Link Details</Name>
</PropertyDetails>
</Metadata>
</MatML_Doc>
</Materials>
<Loads />
<BeamSections />
</EngineeringData>