When displaying distribution results on a 3D model, only the surfaces of the constituent parts are visible. However, by defining a cut plane, the distribution within the model's interior can be viewed.
A cut plane is an arbitrary cross-section that can be defined as either a flat plane or a cylindrical surface.
This script creates a cut plane and configures to display that plane when displaying a contour plot.
Preconditions
- One or more studies have been created.
This script runs on the active study in the project tree. - To display the defined contour, the study has been calculated.
- The units of the setting values follow the unit system set for the model.
Script Function
- Create a cut plane
Normal vector: (5, -5, 0)
Point on the plane: (28, 28, 0) - Create a cut cylinder
Cylinder central axis direction: (0, 0, 1)
Point on the central axis: (0, 0, 0)
Radius: 13 - Create a contour plot
Set the result type to magnetic flux density.
Configure to display the previously created cut plane when displaying the contour plot. - Turn on display the defined contour plot
# 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()
def createCut(model, param):
"""Create a cut plane"""
cutList = model.GetCutList()
cutType = param[u"cutType"]
# Plane cut
if cutType == u"plane":
cutDefinition = cutList.CreateCutPlane(param[u"title"])
# Cylindrical cut
elif cutType == u"cylinder":
cutDefinition = cutList.CreateCutCylinder(param[u"title"])
cutDefinition.SetRadius(param[u"radius"])
nX, nY, nZ = param[u"normalXYZ"]
cutDefinition.SetNormalXYZ( nX, nY, nZ)
oX, oY, oZ = param[u"originXYZ"]
cutDefinition.SetOriginXYZ( oX, oY, oZ)
cutDefinition.SetDisplayType(param[u"displayType"])
return cutDefinition
def createContourWithCut(study, param):
"""Create a contour plot using the created cut plane."""
contour = study.CreateContour(param[u"title"])
contour.SetResultType(param[u"resultType"])
# The 1st argument of SetResultCoordinate
# Name or index
# The name of the preset coordinate system is fixed according to the language setting.
# The index is specified in a 0-based from the coordinate system definition list order under Project - Model - Coordinate Systems
contour.SetResultCoordinate(param[u"resultCoordinate"])
# contour.SetResultCoordinate(u"Global Rectangular")
contour.SetDisplayAllParts(param[u"displayAllParts"])
cutDefNames = param[u"cutDefNames"]
for cutDefName in cutDefNames:
contour.AddCutPlane(cutDefName)
model = app.GetCurrentModel()
cutPlaneParam = {
u"cutType" : u"plane",
u"title" : u"DiagonalCut",
u"normalXYZ" : [5, -5, 0],
u"originXYZ" : [28, 28, 0],
u"displayType" : u"ShowBehind"
}
cutPlaneDef = createCut(model, cutPlaneParam)
cutCylinderParam = {
u"cutType" : u"cylinder",
u"title" : u"CylinderCut",
u"normalXYZ" : [0, 0, 1],
u"originXYZ" : [0, 0, 0],
u"radius" : 13,
u"displayType" : u"ShowOutside"
}
cutCylinderDef = createCut(model, cutCylinderParam)
study = app.GetCurrentStudy()
contourParam = {
u"title" : u"MagFluxDensContour",
u"resultType" : u"MagneticFluxDensity",
u"resultCoordinate" : 0,
u"displayAllParts" : True,
u"cutDefNames" : [ cutPlaneDef.GetName(), cutCylinderDef.GetName() ]
}
createContourWithCut(study, contourParam)
# Turn on the contour display for the results.
app.View().SetContourView(True)


