Material synchronization settings for an analysis group can be used to synchronize material parameters assigned to the same part across multiple studies.
By synchronizing the materials, material parameters that are treated separately in each study can be handled as a single variable, ensuring that the same material is assigned.
This script sets the material synchronization in the analysis group for material parametric parameters obtained from each study.
Preconditions
- An analysis group has been created.
This script example runs on the active analysis group in the project tree. - Multiple studies in the analysis group have a part to be synchronized with the same name and assigned a material.
- The target part name to be synchronized is known.
- The material synchronization settings for an analysis group is available in JMAG-Designer v25.1 and later.
Script Function
- Obtain the material parametric parameter of the specified part from each study in the analysis group.
- Create a reference item from one of the obtained material parametric parameters.
- Add the other material parametric parameters to the reference item to synchronize the material.
# Copyright (c) 2026 JSOL CORPORATION
#
# This script is released under the MIT License.
# See the full license text at:
# https://www.jmag-international.com/scriptlibrary/jmag_script_library_mit/
app = designer.GetApplication()
# Target part name for material synchronization
TargetPartName = u"Magnet"
def getMaterialParametricItem(designTable, partName):
"""Obtain the material parametric item of the specified part from the DesignTable."""
for parameterIndex in range(designTable.NumParameters()):
if not designTable.IsMaterialItem(parameterIndex):
continue
parameterName = designTable.ParameterName(parameterIndex)
if parameterName.startswith(partName + u":"):
return designTable.GetMaterialParametricItem(parameterName)
def getMaterialParametricItems(analysisGroup, partName):
"""Obtain the material parametric items of the specified part from all studies in the analysis group."""
materialItems = []
for studyIndex in range(analysisGroup.NumStudies()):
study = analysisGroup.GetStudy(studyIndex)
materialItem = getMaterialParametricItem(
study.GetDesignTable(),
partName
)
if materialItem is not None:
materialItems.append(materialItem)
return materialItems
def syncMaterialParametricItems(designTable, materialItems):
"""Synchronize the specified material parametric items."""
referenceItem = designTable.CreateReferenceItem(materialItems[0])
for materialItem in materialItems[1:]:
referenceItem.AddParametricItemObject(materialItem)
referenceItem.Build()
def main():
"""Synchronize the material of the specified part across the studies in the analysis group."""
analysisGroup = app.GetCurrentAnalysisGroup()
designTable = analysisGroup.GetDesignTable()
materialItems = getMaterialParametricItems(
analysisGroup,
TargetPartName
)
if len(materialItems) < 2:
print("Error: Material parametric items for the target part were found in fewer than two studies.")
return
syncMaterialParametricItems(designTable, materialItems)
main()


