Plotting - zanoni-mbdyn/blendyn GitHub Wiki

Blendyn relies on the Python module Pygal for generating 2D plots of MBDyn output variables.

Plotting is, currently, enabled only for NetCDF results. You can refer to the Installation guide to setup the additional packages that you need to enable both the NetCDF output in MBDyn and its import and plotting in Blendyn.

When NetCDF and Pygal modules are found, the add-on will create two additional panels devoted to plotting: one in the Object Properties panel and the second one in the Scene Properties panel.

Plotting a variable belonging to an object

Once you have correcly imported an element into the Blender scene, a panel called MBDyn data plot will appear in the Object Properties panel, as shown in the image below


plotting panel in Object Properties panel


All the NetCDF variables in the MBDyn output related to the currently selected object will be shown in the drop-down menu next to the Variables: label. You can select the variable you want to plot, and optionally deselect the components you're not interested in. You can plot the variable in the time domain or in the frequency domain, selecting "Autospectrum" in the plot type dropdown menu. Upper and lower limits to the abscissa values can be set via the two dialog boxes underneath the selection of the plot type.

The frequency property has the same meaning of the import frequency shown in the Animation Toolbar under Animate scene: set it to n to plot the variable using one point in every n. The Use import freq button can be used to set the plotting frequency equal to the import frequency.

When you press on the Plot variable button for the first time, the add-on will try to create a directory called plots in the directory holding the current .blend file. If you have not yet saved the Blender file, you'll be asked to do so. Then, an .svg file and a preview .png file of the plot you requested will be created. You can load the .png file in the Image Editor simply by clicking on the image icon next to Image and selecting the file.

If you plot multiple variables before switching to the Image Editor, all the plots images will be available in the list, as shown in the picture below


linking a plotted image in the Image Editor


Plotting a variable belonging to the model

Instead of selecting an object and plotting variables belonging to the associated MBDyn entity, you can also use the Scene Property panel shown in the picture below


plotting panel in Scene Properties panel


Here, all the variables found in the NetCDF output of the model are listed. Again, you can choose the variable that you want to plot, activate/de-activate the components that you are interested in, and plot it with the Plot variable button, possibly after setting the plotting frequency.

Notice that the list of variables that appears in the panel can also be filtered in the usual way for Blender UI lists: click on the small + button at the lower left corner of the list to bring up the filtering and ordering options.