# 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/ import os app = designer.GetApplication() def getFolderpathOfOpenedProjectFile(): """Get folder path of opened jproj file""" openedJprojFilePath = app.GetProjectPath() folderPath = os.path.dirname(openedJprojFilePath) return folderPath def createRttExportParameters(filePath): """Set the information to be exported from the calculation table to an RTT file""" fileExporter = app.CreateRttFileParameter() fileExporter.SetResponseTableName(u"Calculated Table") fileExporter.SetOutputFilepath(filePath) fileExporter.SetTitle(u"MutualInductance") fileExporter.SetAuthor(u"JMAG User") fileExporter.SetIsWindingSettingsPublic(True) fileExporter.SetConductorsSlotHeight(6) fileExporter.SetConductorsSlotWidth(4) fileExporter.SetSlotsPerPhase(2) fileExporter.SetAveragedSlotWidth(12) # Conductor Type # 0:Rectangle # 1:Round fileExporter.SetConductorType(1) fileExporter.SetConductorDiameter(1.8) fileExporter.SetCoreStackLength(15) fileExporter.SetConductivity(59600000) return fileExporter study = app.GetCurrentStudy() rttFileName = u"saves.rtt" rttFilePath = os.path.join(getFolderpathOfOpenedProjectFile(), rttFileName) fileExporter = createRttExportParameters(rttFilePath) study.ExportRttFile(fileExporter)