# 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 settingCompositeResultDefinition(study, fluxLine, contour, vector): """Configure simultaneous display of result plots""" compoResult = study.CreateCompositeResult(u"flux_cont_vec_compo_res") compoResult.ClearResults() compoResult.SetFluxLineDefinition(fluxLine) compoResult.SetContourDefinition(contour) compoResult.SetVectorDefinition(vector) def createFluxLine(study, typeName): """Create flux line""" fluxLine = study.CreateFluxLine("mag_flux_dens") fluxLine.SetResultType(typeName, u"") fluxLine.SetFluxLineType(u"plane") fluxLine.SetColor(u"blue") fluxLine.SetOrigin(28, 28, 15) fluxLine.SetNormal(0, 0, 1) fluxLine.SetThickness(u"5") # display type # 0:Shaded # 1:Hidden Line # 2:Wireframe fluxLine.SetDisplayType(0) return fluxLine def createContour(study, typeName, partIdList): """Create contour plot""" contour = study.CreateContour(u"contour") contour.SetResultType(typeName, u"") # The Arguments 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(0) #contour.SetResultCoordinate(u"Global Rectangular") contour.SetDisplayAllParts(False) contour.RemoveAllParts() for partId in partIdList: contour.AddPart(partId) return contour def createVector(study, typeName): """Create vector plot""" vector = study.CreateVector(u"vector") vector.SetResultType(typeName, u"") vector.SetStyle(u"Cone") vector.SetGradient(u"CMR", u"21", True) vector.SetNumVectors(u"0") # display type # 0:Shaded # 1:Hidden Line # 2:Wireframe vector.SetDisplayType(0) return vector study = app.GetCurrentStudy() typeName = u"MagneticFluxDensity" fluxLine = createFluxLine(study, typeName) typeName = u"CurrentDensity" model = app.GetCurrentModel() partGroup = model.GetGroupList().GetGroup(u"Coil") partIdList = partGroup.GetPartIDs() contour = createContour(study, typeName, partIdList) typeName = u"MagneticFieldStrength" vector = createVector(study, typeName) settingCompositeResultDefinition(study, fluxLine, contour, vector) app.View().SetCompositeView(True) # An error will occur if no analysis results are available.