Streamline view_arbitrary plane


Could you tell me if there is a way to obtain streamline view with a plane source on an arbitrary plane (of which I know origin and normal) via a Python script?

Thank you for your help


Yes, this is possible, as shown in the example below.
Note that this sort of scripts can in principle be automatically generated using the "To Python" function from the GUI (in this case by right-clicking on the Streamline Viewer). Here, however, the autogenerated script did not fully work, as it forgets a crucial Update() call before setting up the Plane Center and Normal.

I hope this helps!

# Creating the analysis pipeline
# Adding a new SimulationExtractor
simulation = document.AllSimulations["EM"]
simulation_extractor = simulation.Results()

# Adding a new EmSensorExtractor
em_sensor_extractor = simulation_extractor["Overall Field"]

# Adding a new StreamLineViewer
inputs = [em_sensor_extractor.Outputs["EM E(x,y,z,f0)"]]
stream_line_viewer = analysis.viewers.StreamLineViewer(inputs=inputs)
stream_line_viewer.Streamline.SeedSource = stream_line_viewer.Streamline.SeedSource.enum.PlaneSource
stream_line_viewer.Update() # this line is needed, otherwise the next lines have no effect
stream_line_viewer.Streamline.Plane.PlaneCenter = numpy.array([0.2, 0.05, 0.002])
stream_line_viewer.Streamline.Plane.PlaneNormal = numpy.array([0.2, 0.5, 1.2])
Log in to reply