Skip to content
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

ZMT zurich med tech

  1. Home
  2. Sim4Life
  3. Analysis & Postprocessing
  4. Streamline view_arbitrary plane

Streamline view_arbitrary plane

Scheduled Pinned Locked Moved Analysis & Postprocessing
python
2 Posts 2 Posters 391 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Micol
    wrote on last edited by Sylvain
    #1

    Hello,

    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

    1 Reply Last reply
    1
    • SylvainS Offline
      SylvainS Offline
      Sylvain
      ZMT
      wrote on last edited by
      #2

      Hi,

      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"]
      document.AllAlgorithms.Add(em_sensor_extractor)
      
      # 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])
      stream_line_viewer.Update()
      document.AllAlgorithms.Add(stream_line_viewer)
      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Search