[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.

import math

# radius

R = 27.5

# initial value

Ini = 0

# height

Z = 5

app = designer.GetApplication()

# Get the study

study = app.GetCurrentStudy()

# Create a flux line

study.CreateFluxLine("FluxLine")

# Get flux line

flux = study.GetFluxLine("FluxLine")

# Set the line color

flux.SetColor("red")

# Set the type of results

flux.SetResultType("MagneticFluxDensity", "")

# Delete the rendering start point

flux.ClearPoints()

# Change the name of the rendering start point

flux.RenamePoint(0, u"Point 1")

# Set the position of the first rendering start point

flux.SetPoint(0, app.CreatePoint(R*math.cos((Ini)*math.pi/180), R*math.sin((Ini)*math.pi/180), Z))

# Add a rendering start point every 10 degrees

for i in range(9):

   flux.AddPoint(app.CreatePoint(R*math.cos((Ini+(i+1)*10)*math.pi/180), R*math.sin((Ini+(i+1)*10)*math.pi/180), Z), f"Point {i+2}")

How to use script file

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