Is there an option to change visualization settings from the code in Python? Every time I run my simulation I always have to go through View > Viewing options > Mesh > Show filled triangles and then View > Solution data >… and more. Is there a way to set this up in the code?
ngsolve.internal you can import
visoptions that let you change these settings. See in the code what is available. For example to set show filled triangles to off you have to do
from ngsolve.internal import viewoptions viewoptions.drawfilledtrigs = 0
Thank you @christopher, this is what I was looking for. Could you help me to figure out what am I supposed to assign to the scalar function attribute visoptions.scalfunction? Passing a function name as a string or a variable name doesn’t work.
think it should be “name:i” for the i-th component of a function, starting counting from one. Here is the code processing the variables:
Thank you for the answer @joachim, but unfortunately it doesn’t work.
here is a complete example, you can select u, and components of the gradient.
drawtcl.py (509 Bytes)
It makes sense to set this after the Draw function. Is it possible to build fieldlines from code? The option visoptions.fieldlinesvecfunction = ‘gradient:1’ doesn’t work and I don’t know how to proceed with building fieldlines and saving them to a file automatically.
drawing fieldlines from Python:
draw_fieldlines.py (627 Bytes)
I was copying from the Tcl gui-code: