JMAG Script Library

Users can operate almost every feature in JMAG through scripts. Although the JMAG website previously restricted access to sample scripts to authenticated users, we would now like to make this library available to everyone.
Most of the sample scripts written in Python are easy to use with some general programming knowledge. In addition, we are also releasing instructional materials that describe various scripting methods alongside usage examples. These materials should give even those new to JMAG confidence to use the scripting tools to easily automate and streamline analyses and design processes. Going forward, we will continue to enhance this library so that everyone can realize more flexible workflows through scripts.

[D0001] Add magnetic field strength contour

Add magnetic field strength contour definition to the current study.

[D0002] Run all studies

Run all studies in the project.

[D0003] Add current condition to coils

Set a current condition on all parts named "Coil" in the current study.

[D0004] Set the coil material

Sets the material for parts in the current study named "Coil" to copper.

[D0005] All case create mesh

Create mesh for all cases if the case does not have a mesh.

[D0007] Electrostatic Capacitance Coefficient Calculation

Outputs the capacitance coefficient of a system consisting of multiple conductors in CSV file format.

[D0008] Switch all FEM coils to FEM conductors

This script will replace all FEM coils with FEM conductor in the current study. Requires Version 15.1 or later.

[D0009] Recommended settings for 3D FEM conductor conditions

Apply recommended settings for 3D FEM conductor conditions.

[D0010] Switch all FEM conductors to FEM coils

This script replace all FEM conductors with FEM coils in the current study. Requires Version 15.1 or later

[D0013] Create transfer function csv file

Create a csv file of a transfer function.

[D0014] Calculate Efficiency from Drive Mode

Uses results of the efficiency map analysis study to calculate efficiency of electric vehicles in a specified drive mode.

[D0015] Export Jcf For External Circuit Link

Export Jcf For External Circuit Link.

[D0016] Extract anomalous eddy current loss coefficient

Make anomalous eddy current loss coefficient table from a Custom material.

[D0017] Generate sampling cases

Generate sampling cases.

[D0019] Highlight parts that allow eddy current

This script highlights parts where eddy currents will be calculated.

[D0021] Loading Topology Optimization Geometry

Loading selected topology optimization geometry

[D0024] NVH Force Export (Nodal Force)

Export toque and force to the CSV file for motor NVH.

[D0025] NVH Force Export (Surface Force)

Export toque and force to the CSV file for motor NVH.

[D0028] Search Size Range in Optimization Table

Search for the maximum value and the minimum value of the parametric variable range of optimization.

[D0030] Allow Eddy Current for selected parts

This script sets the "Allow Eddy Current" flag for selected parts.

[D0031] Set FEM Conductors for Parts in a set

This script set FEM conductor conditions on all wires of a set in the current study. Requires V15.1 or later.

[D0032] Setup study for transfer function creation

Set up a frequency analysis study for transfer function creation.

[D0035] Vibration Evaluation with Transfer Function

Evaluate the vibration of an observation point using the transfer function.

[D0036] Heat Transfer at Airgap

Set Heat Transfer at Airgap

[D0037] Set Cooling (Forced Convection)

Set Cooling by Forced Convection

[D0038] Contact Resistance between Magnet and Rotor Core

Set Contact Heat Resistance between Magnet and Rotor Core

[D0039] Set Cooling (Natural Convection)

Set Cooling by Natural Convection

[D0040] Contact Resistance between Stator Core and Case

Contact Resistance between Stator Core and Case

JMAG Script Library Terms of Use

JMAG Script Library Terms of Use This is an agreement between JSOL Corporation (hereinafter referred to as “JSOL”) and the user who is licensed to use this script library (hereinafter referred to as “the user”). The user acknowledges that they are bound by the terms and conditions in this agreement when the user saves all […]

[S8329] Script to create a sectiongraph and export the results to a CSV file

The following is an example of a script to export a CSV file after setting up a new arc graph from the displayed model using “Results” > ‘Section’ > “Arbitrary Region” > “New Arc ...”.

[S8332] Script to add cases and specify the direction of magnetization for each

The following is an example of a script that adds three cases and sets the direction of the reference axis for the magnetization direction for each.

[S8333] Script to FFT and output csv

I want to automate the process of performing FFT on the results and outputting them as a CSV file.

[S8339] Script to add cases with different current amplitude values and output the results of each case to a csv file

The following is an example script that adds cases with different current amplitude values and outputs the results of each case to a csv file.

[S8341] Script to get the maximum flux density of a contour plot for any part

The following is an example script to obtain the maximum flux density of a contour plot on an arbitrary part.

[S8344] Script to obtain flux values for current conditions

The following is an example of a script that retrieves the value of the magnetic flux in the current condition from the results of a magnetic field static analysis.

[S8346] Script to output the results of multiple case probes in a batch to a csv file

The following is an example of a script that outputs the results of a multi-case probe in a batch to a csv file.

[S8350] Script for importing CSV files with conditions, circuits, and materials

The following is an example of a script that reads CSV files  on conditions, circuits, and materials.

[S8352] Script to export the results of any case from multiple cases to a single CSV file

The following is an example of a script that writes the results of any case from multiple cases to a single CSV file.

[S8356] Script for running analysis by specifying a folder using JMAG-Scheduler

The following is an example of a script that uses JMAG-Scheduler to specify a folder and execute analysis. Open in JMAG-Designer the model that contains the study to be calculated using JMAG-Scheduler in advance, and then run it from the script editor.

[S8360] Script to check the storage location of project files (.jproj)

The following is an example of a script that checks the storage location of project files (.jproj).

[S8366] Script for manipulating the perspective of the model display

The following is an example of a script that manipulates the perspective of the model display.

[S8369] Script for performing Boolean operations by specifying part names in the Geometry Editor

The following is an example of a script that performs Boolean operations on specified parts using the Geometry Editor.

[S8372] Get area or volume in script

Obtain area/volume of a part or group of parts

[S8374] Script for specifying part colors and grouping parts

The following is an example of a script that specifies part colors and performs grouping.

[S8376] Script to export csv with model ID, study ID and case number

I want to specify model ID, study ID and case number in a script and export the results in csv.

[S8384] Script to check the number of jobs that have not been completed in JMAG-Scheduler

The following is an example of a script for checking the number of jobs that have not been completed in JMAG-Scheduler.

[S8386] Script for exporting images to the same directory as the JPROJ file

The following is an example of a script that exports images to the same directory as the JPROJ file.

[S8389] Script to obtain vertex coordinates from the Geometry Editor

The following is an example of a script that obtains the coordinates of vertices in the  Geometry Editor.

[S8401] Script for specifying parts by coordinates and setting conditions

The following is an example of a script that specifies parts by coordinates and sets conditions.

[S8406] Script to launch multiple JMAG-Designers

The following is an example of a script that launches multiple JMAG-Designer instances.

[S8415] Script to display the results of section graphs for all cases in a single graph and output CSV files.

The following is an example of a script that displays the results of section graphs for all cases in a single graph and outputs a CSV file.

[S8426] Script to create response data by determining duplicates and create response graphs

The following is an example of a script that checks for duplicates, creates response data, and creates a response graph.

[S8432] Script to obtain the setting value of conditions with unknown condition names and indexes

The following is an example of a script that obtains the setting values of conditions whose names and indexes are unknown.

[S8434] Script for selecting elements by circular selection and writing out the result table.

I want to use a script to select elements by circular selection and write out the result table.

[S8436] Script to acquire set value information for [Current Source (1 Terminal)] and [Electric Potential Source (1 Terminal)].

I want to get the setting value information of [Current Source (1 Terminal)] or [Electric Potential Source (1 Terminal)] by a script.

[S8441] Script for performing FFT on torque waveforms and extracting the maximum amplitude from each frequency component

The following is an example of a script that performs FFT on torque waveforms and extracts the maximum amplitude from each frequency component. 

[S8447] Script to add a case with modified design parameters including geometry dimensions.

I want to add a case and change design parameters including geometry dimensions with a script.

[S8451] Script to create probes in 1deg increments in the circumferential direction

I want to create probes in 1deg increments in the circumferential direction in a script.

[S8455] Script to change the background color

The following is an example of a script that changes the background color.

[S8458] Script to obtain the coordinates of the vertices of parts

The following is an example of a script that obtains the coordinates of the vertices of parts.

[S8467] Create a project file in the folder containing the script.

I want to create a project file in the folder where the script is located using a script.

[S8469] Script to register the rotation angle at which torque is maximized as a response value

I want to register the rotation angle at which the torque is maximum in the response value in the script.

[S8477] Script for calculating and graphing induced voltage (dφ/dt)

I want to calculate the induced voltage (dφ/dt) using a script and display a graph.

[S8481] Script for placing the starting point of flux line rendering circumferentially in a 3D model

The following is an example of a script that places the starting point of the flux line rendering in a circular direction in a 3D model.

[S8493] Script to calculate the induced voltage constant Ke from the analysis results and register it in the response value

The following is an example of a script that calculates the induced voltage constant Ke from the analysis results and registers it in the response value.

[S8507] Script to output a result table of nodes with nodal forces above the threshold value

The following is an example of a script that outputs a result table of nodes with nodal forces above the threshold.

[S8545] Script to set concentrated load conditions at nodes on a circle

The following is an example of a script for setting concentrated load conditions at nodes on a circle.

[S8553] Script for performing assembly circular pattern copying in the Geometry Editor

The following is an example of a script for performing an assembly circular pattern copy in the Geometry Editor.

[S8570] Script to remove duplicate nodes in the Geometry Editor

The following is an example of a script for removing duplicate nodes in the Geometry Editor.

[S8626] Script for setting skin depth based on material and frequency

The following is an example of a script for setting the skin depth based on material and frequency.

[S9210] Script to create a DC superimposed current sequence and set it as the current condition

I want to create a DC superimposed current sequence using a script and set it as the current condition.

[S9390] Script for setting the switching timing of the PAM inverter

The following is an example of a script for setting the switching timing of a PAM inverter.

How to use script file

Use the JMAG Script Library after reading and agreeing to the following terms of use.