zanoni-mbdyn / blendyn Goto Github PK
View Code? Open in Web Editor NEWMBDyn (https://www.mbdyn.org/) graphical post-processor for blender (https://www.blender.org/)
License: GNU General Public License v2.0
MBDyn (https://www.mbdyn.org/) graphical post-processor for blender (https://www.blender.org/)
License: GNU General Public License v2.0
When plotting NetCDF
variables, if a request is made to plot variables that differ only for lowercase/uppercase, e.g.
dd0.elem.joint.11.D
dd0.elem.joint.11.d
an exception is raised:
Traceback (most recent call last):
File "/usr/lib64/python3.5/urllib/request.py", line 1410, in open_local_file
stats = os.stat(localfile)
FileNotFoundError: [Errno 2] No such file or directory: '/home/zanoni/lavoro/mbdyn/mbdyn-src/tests/joints/deformablehinge/test/plots/dd0.elem.joint.11.D.svg'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/zanoni/.config/blender/2.78/scripts/addons/blendyn-master/plotlib.py", line 517, in execute
cairosvg.svg2png(url = outfname + ".svg", write_to = outfname + ".png")
File "/usr/lib64/python3.5/site-packages/cairosvg/__init__.py", line 45, in <lambda>
surface_type.convert(*args, **kwargs))(_surface_type)
File "/usr/lib64/python3.5/site-packages/cairosvg/surface.py", line 135, in convert
tree = Tree(**kwargs)
File "/usr/lib64/python3.5/site-packages/cairosvg/parser.py", line 385, in __init__
parse_url(self.url), 'image/svg+xml')
File "/usr/lib64/python3.5/site-packages/cairosvg/parser.py", line 258, in fetch_url
return read_url(url, self.url_fetcher, resource_type)
File "/usr/lib64/python3.5/site-packages/cairosvg/url.py", line 96, in read_url
return url_fetcher(url, resource_type)
File "/usr/lib64/python3.5/site-packages/cairosvg/url.py", line 42, in fetch
return urlopen(Request(url, headers=HTTP_HEADERS)).read()
File "/usr/lib64/python3.5/urllib/request.py", line 163, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib64/python3.5/urllib/request.py", line 466, in open
response = self._open(req, data)
File "/usr/lib64/python3.5/urllib/request.py", line 484, in _open
'_open', req)
File "/usr/lib64/python3.5/urllib/request.py", line 444, in _call_chain
result = func(*args)
File "/usr/lib64/python3.5/urllib/request.py", line 1388, in file_open
return self.open_local_file(req)
File "/usr/lib64/python3.5/urllib/request.py", line 1428, in open_local_file
raise URLError(exp)
urllib.error.URLError: <urlopen error [Errno 2] No such file or directory: '/home/zanoni/lavoro/mbdyn/mbdyn-src/tests/joints/deformablehinge/test/plots/dd0.elem.joint.11.D.svg'>
location: <unknown location>:-1
location: <unknown location>:-1
and the resulting files in the plots/
directory are
dd0.elem.joint.11.d.png
dd0.elem.joint.11.d.svg
dd0.elem.joint.11.d (Conflitto di maiuscole o minuscole (1)).png
dd0.elem.joint.11.d (Conflitto di maiuscole o minuscole (1)).svg
My guess here is that Pygal
is the culprit, but I haven't had the time to investigate thoroughly...
Blender standard way of displaying a message to the user is to print it in the topbar, something that is accomplished with the report
method of operators. However, the report
messages are easy to miss: therefore it would be better to store them in a log file in the Text Editor, that gets updated during the current session.
An error popped up when I tried to run simulation after selecting input file.
Python: Traceback (most recent call last):
File "C:\Users\Xiang\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\blendyn-master\blendyn.py", line 1328, in invoke
return self.execute(context)
File "C:\Users\Xiang\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\blendyn-master\blendyn.py", line 1255, in execute
self.timer = context.window_manager.event_timer_add(0.5, context.window)
TypeError: WindowManager.event_timer_add(): required parameter "window" to be a keyword argument!
location: <unknown location>:-1
Conditions to reproduce:
Ubuntu 20.04.4
MBDyn 1.7.3
Current version of Blendyn
Blender 3.1.2
Python 3.10.4
All dependencies of MBDyn, Blender and Blendyn installed
Steps to reproduce:
1.Save an example as txt file.
2.Select the file as input file.
3.click Run Simulation
.
Hi,when I using Blender2.79 and Mbdyn1.7.3 to learn Wiki on Helicopter blade flapping analysis,I found that something differences:in Scene Property panel the node_10 and 11 is lost;And I can't find the 3-no:qde beam element under the elements list,as well as Data Properties panel.
I don't know what's the problem ,How can I get the right way?Any idea or help would be great :)
Best wishes,
goodluckko
Hi,
I am trying to install the add-on on blender. Things go smothly until I check the box to enable the add-on. At that moment, blender closes. If I open blender from termina, this is what I have:
myuser@mycomputer:~$ blender
Read prefs: /home/ion/.config/blender/2.82/config/userpref.blend
Warning: property 'release_confirm' not found in keymap item 'OperatorProperties'
reloading addon: blendyn-master 1589898681.8350818 1589899370.8320978 '/home/ion/.config/blender/2.82/scripts/addons/blendyn-master/__init__.py'
Modules Installed () from '/home/ion/Downloads/blendyn-master.zip' into '/home/ion/.config/blender/2.82/scripts/addons'
WARN (rna.define): /build/blender-RL3axj/blender-2.82.a+dfsg/source/blender/makesrna/intern/rna_define.c:1647 RNA_def_property_ui_text: 'Collector of rotational offsets of element attach R.Fs.' description from 'rotoffsets' '' ends with a '.' !
WARN (rna.define): /build/blender-RL3axj/blender-2.82.a+dfsg/source/blender/makesrna/intern/rna_define.c:1239 RNA_def_struct_ui_text: ' Plots the selected variable in the image editor
and optionally save it as .svg in the 'plots' directory.
The user can choose among all the variables of all the
MBDyn entitites found in the output NetCDF fila.' description from 'BLENDYN_OT_plot_var_scene' '' ends with a '.' !
blender(BLI_system_backtrace+0x37) [0x562a9bdfa897]
blender(BLI_ghash_insert+0xe2) [0x562a9bd997e2]
blender(+0x18ef87b) [0x562a99c0987b]
blender(+0x1913a0f) [0x562a99c2da0f]
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0(+0x258be2) [0x7f12141ccbe2]
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0(+0x72ffd) [0x7f1213fe6ffd]
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0x3c6b) [0x7f1213feb06b]
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyEval_EvalCodeWithName+0x8fb) [0x7f121413988b]
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyFunction_Vectorcall+0x90) [0x7f1214214cd0]
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0(+0x72ffd) [0x7f1213fe6ffd]
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0x8067) [0x7f1213fef467]
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyEval_EvalCodeWithName+0x8fb) [0x7f121413988b]
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyFunction_Vectorcall+0x90) [0x7f1214214cd0]
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0(+0x72ffd) [0x7f1213fe6ffd]
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0x4ea2) [0x7f1213fec2a2]
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyEval_EvalCodeWithName+0x8fb) [0x7f121413988b]
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyFunction_Vectorcall+0x90) [0x7f1214214cd0]
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0(PyVectorcall_Call+0x5c) [0x7f12142153cc]
blender(+0x19116bf) [0x562a99c2b6bf]
blender(+0x18ed199) [0x562a99c07199]
blender(+0x15d1a78) [0x562a998eba78]
blender(+0x15d20fb) [0x562a998ec0fb]
blender(WM_operator_name_call_ptr+0x4a) [0x562a998ec5ca]
blender(+0x1b954b6) [0x562a99eaf4b6]
blender(+0x1ba672d) [0x562a99ec072d]
blender(+0x15d549f) [0x562a998ef49f]
blender(+0x15d73ec) [0x562a998f13ec]
blender(wm_event_do_handlers+0x50d) [0x562a998f1c6d]
blender(WM_main+0x20) [0x562a998e7160]
blender(main+0x2b6) [0x562a996ba3d6]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f1211d4f0b3]
blender(_start+0x2e) [0x562a997088ae]
BLI_assert failed: /build/blender-RL3axj/blender-2.82.a+dfsg/source/blender/blenlib/intern/BLI_ghash.c:464, ghash_insert_ex(), at '(gh->flag & GHASH_FLAG_ALLOW_DUPES) || (BLI_ghash_haskey(gh, key) == 0)'
Aborted (core dumped)
Of course, previous to installing the add-on I installed mbdyn and all its dependencies as explained at the wiki.
I will appreciate any help. Thanks for doing a so great job.
Regards,
Ion
Hello everyone,
executing the following code below, I am wondering, why the rotation icon (in red) is not centered to the actual rotation center, but offset by the blue line.
The real rotation center in the animation is between the two nodes.
# double_rotation.mbd
begin: data;
problem: initial value;
end: data;
begin: initial value;
initial time: 0.;
final time: 5.;
time step: 1.e-3;
max iterations: 10;
tolerance: 1.e-6;
end: initial value;
begin: control data;
structural nodes: 3;
rigid bodies: 2;
joints: 3;
forces: 1;
default orientation: orientation vector;
end: control data;
# Design Variables
set: real M = 1.; # Mass of Link1 and Link2
set: real L = 1.; # Length of Link1 and Link2
set: real theta1 = pi/6.; # Initial angle of Link1 w.r.t vertical line
set: real theta2 = pi/6.; # Initial angle of Link2 w.r.t Link1
# Reference Labels
set: integer Ref_Ground = 1;
set: integer Ref_Link1 = 2;
set: integer Ref_Link2 = 3;
# Node Labels
set: integer Node_Ground = 1;
set: integer Node_Link1 = 2;
set: integer Node_Link2 = 3;
# Body Labels
set: integer Body_Link1 = 1;
set: integer Body_Link2 = 2;
# Joint Labels
set: integer JoClamp_Ground = 1;
set: integer JoRevp_Link1 = 2;
set: integer JoRevh_Link1_Link2 = 3;
# Reference
reference: Ref_Ground,
null, # absolute position
eye, # absolute orientation
null, # absolute velocity
null; # absolute angular velocity
reference: Ref_Link1,
reference, Ref_Ground, null, # absolute position
reference, Ref_Ground, euler, 0., pi/2.-theta1, 0., # absolute orientation
reference, Ref_Ground, null, # absolute velocity
reference, Ref_Ground, null; # absolute angular velocity
reference: Ref_Link2,
reference, Ref_Link1, L, 0., 0., # absolute position
reference, Ref_Link1, euler, 0., -theta2, 0., # absolute orientation
reference, Ref_Link1, null, # absolute velocity
reference, Ref_Link1, null; # absolute angular velocity
begin: nodes;
structural: Node_Ground, static,
reference, Ref_Ground, null, # absolute position
reference, Ref_Ground, eye, # absolute orientation
reference, Ref_Ground, null, # absolute position
reference, Ref_Ground, null; # absolute position
structural: Node_Link1, dynamic,
reference, Ref_Link1, 1./2.*L, 0., 0., # absolute position
reference, Ref_Link1, eye, # absolute orientation
reference, Ref_Link1, null, # absolute velocity
reference, Ref_Link1, null; # absolute angular velocity
structural: Node_Link2, dynamic,
reference, Ref_Link2, 1./2.*L, 0., 0., # absolute position
reference, Ref_Link2, eye, # absolute orientation
reference, Ref_Link2, null, # absolute velocity
reference, Ref_Link2, null; # absolute angular velocity
end: nodes;
begin: elements;
#-----------------------------------------------------------------------------
# Bodies
body: Body_Link1, Node_Link1,
M, # mass
null, # relative center of mass
diag, 0., M*L^2./12., M*L^2./12.; # inertia matrix
body: Body_Link2, Node_Link2,
M, # mass
null, # relative center of mass
diag, 0., M*L^2./12., M*L^2./12.; # inertia matrix
#-----------------------------------------------------------------------------
# Joints
joint: JoClamp_Ground,
clamp,
Node_Ground,
null, # absolute position
eye; # absolute orientation
joint: JoRevp_Link1,
axial rotation,
Node_Ground,
null, # relative offset
hinge, reference, Ref_Link1, 1, 1., 0., 0., 3, 0., 1., 0., # relative orientation
Node_Link1,
reference, Ref_Link1, null, # relative offset
hinge, reference, Ref_Link1, 1, 1., 0., 0., 3, 0., 1., 0., # relative axis orientation
const, 2.*pi; # angular velocity
joint: JoRevh_Link1_Link2,
axial rotation,
Node_Link1,
reference, Ref_Link2, 0,0,0, # relative offset
hinge, reference, Ref_Link2, 1, 1., 0., 0., 3, 0., 1., 0., # relative axis orientation
Node_Link2,
reference, Ref_Link2, 0,0,0, # relative offset
hinge, reference, Ref_Link2, 1, 1., 0., 0., 3, 0., 1., 0., # relative axis orientation
const, 2.*pi; # angular velocity
force: 10, absolute, Node_Link2, position, 0., 1., 0., 0., 0., 0., const, 11.;
end: elements;
I get the error seen on the image below when hitting the "Animate scene" button.
Traceback (most recent call last):
File "/home/rock/.config/blender/3.6/scripts/addons/blendyn-master/blendyn.py", line 1499, in invoke
return self.execute(context)
^^^^^^^^^^^^^^^^^^^^^
File "/home/rock/.config/blender/3.6/scripts/addons/blendyn-master/blendyn.py", line 1488, in execute
ret_val = set_motion_paths_mov(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/rock/.config/blender/3.6/scripts/addons/blendyn-master/baselib.py", line 1066, in set_motion_paths_mov
rw_mov = np.array(next(reader_mov)).astype(np.float)
^^^^^^^^
File "/usr/lib/python3/dist-packages/numpy/__init__.py", line 305, in __getattr__
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'cfloat'?
Error: Python: Traceback (most recent call last):
File "/home/rock/.config/blender/3.6/scripts/addons/blendyn-master/blendyn.py", line 1499, in invoke
return self.execute(context)
^^^^^^^^^^^^^^^^^^^^^
File "/home/rock/.config/blender/3.6/scripts/addons/blendyn-master/blendyn.py", line 1488, in execute
ret_val = set_motion_paths_mov(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/rock/.config/blender/3.6/scripts/addons/blendyn-master/baselib.py", line 1066, in set_motion_paths_mov
rw_mov = np.array(next(reader_mov)).astype(np.float)
^^^^^^^^
File "/usr/lib/python3/dist-packages/numpy/__init__.py", line 305, in __getattr__
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'cfloat'?
-- System Information:
Debian 13
Blender 3.6.2
Python 3.11.6
NumPy 1.24.2
Blendyn: commit ee0853d
-- Edit:
Swapped error image with error text for (better?) readability.
This issue can count towards the entry exam for the Blendyn related projects for MBDyn-GSoC2017
This is more a feature request than an issue.
When importing the data into an already animated scene but using a newly created .nc or .mov file which ends before the previous import, the frames that come after the last timestep (may depend also on import frequency) of the new results will remain as they were before and this creates confusion by mixing results from two simulations. An ideal behavior would be that the nodes/elements frames that are present in the new results file get cleared before importing the new results.
Andrea may want to give his point of view on this one...
This issue can count towards the entry exam for the Blendyn related projects for MBDyn-GSoC2017
Although the Blendyn addon is fairly compact, in its current form, the repository is roughly 100mb.
This is due to the presence of the .pack file which keeps track of all historical changes in the repository.
Identify the files which could be removed from history and suggest a fix.
Hint: http://stackoverflow.com/questions/11050265/remove-large-pack-file-created-by-git#11277929
When I plot using Blendyn's embedded interface, I noticed that each Blender object has its own plotting frequency which defaults to 1. For example, if I choose one object, set the plot frequency, and then select another Blender object, the frequency resets itself to 1. Is assume this may not be the desired behavior...
the tutorial shows UI of Blender that is different than the UI of the newest version "2.82".
of course I installed the Blendyn addone and it is there but couldn't access the Blendyn features from the toolbar since it does not show up (which is already mentioned in the main page).
Usually it should show up in the animation toolbar, right? Even clicking 'N' doesn't bring it up!
here are screenshots to understand more what is going on.
The blendyn "features" show up but No 'Load Results'
What could be wrong? did I mess up the installation?
In the meantime, I will try to install Blender v2.7* from source and use the older version, but it should be a temporary solution.
When using textual output (.mov file), Blender objects with MBDyn nodes assigned are not moved at each timestep as one would expect, but "jump" to the simulation final position at frame 1.
The issue is probably located in the method set_motion_paths_mov(context)
found at line 279
of file base.py
, which in turn calls the method set_obj_locrot_mov(obj, rw)
defined at line 48
of file nodelib.py
.
The output of specific nodes can be disabled in MBDyn, for example using the
output, no
directive at the end of their definition in the input file.
Blendyn gathers the information about the nodes present in the model from the .log file, in which no information about their output is given. So it is possible that a node without any output is imported in the Blender scene, causing trouble when the animation is requested.
Blendyn should be able to recognise that the output of specific nodes has been disabled, and just warn the user without stopping the animation of the other nodes.
I am running Blender 3.4 on Windows 10, and I am having some trouble with Blendyn.
Then, when I animate the node, everything appears to work but actually no animation is created (meaning in the timeline my animation is a point, so the node doesn't follow the motion it is supposed to follow). I also run the mbdyn file with Matlab and plotted the motion to check the .nc file is in order and I think it is, since I get good motion plots in Matlab. Therefore, I was wondering if maybe I am doing something wrong?
I upload also my input file in case it is needed.
rigidbody.txt
Thank you in advance,
Lidia
From a this issue, now closed:
Check, when re-loading the .log file, if a node or an element associated to some Blender object present in the scene has been removed from the MBDyn input file, and remove both the reference to the entity in the bpy.context.scene.mbdyn.{nodes,elems} dictionaries and the corresponding Blender object in the scene.
[...] it is probably better to tackle it when the user loads the .log file after having done so already. Off the top of my head, we could flag all the nodes/elements as "not imported" before re-reading the .log file (there is an is_imported Bool Property in the MBDynNodesDictionary and MBDynElemsDictionary collection properties), flag them as "imported" as we find them in the .log file, and then check which one are left as "not imported" at the end of the process, and get rid of them.
Hello,
I'm trying to use "MBDyn Standard Import" in order to add all elements to the scene, however I get an error and blendyn stops working as soon as I click on Import Button. In addition, when I'm going to add elements from the scene property panel, for example adding a spherical hinge (or many others), I get the same error and same situation of blendyn!
Btw, I'm using Blender2.76b and mbdyn-1.7.3. Also, here is the error that I get:
blender: /build/blender-40PcOX/blender-2.76.b+dfsg0/source/blender/blenlib/intern/math_rotation.c:1328: get_rotation_order_info: Assertion `order >= 0 && order <= 6' failed.
Aborted (core dumped)
Any idea or help would be great :)
Best,
Neda
As reported by Thomas in the mailing list, text output import fails with the following error.
Happens also with the rolling cylinder example of SkyEngin.
This issue can count towards the entry exam for the Blendyn related projects for MBDyn-GSoC2017
This issue may be quite challenging and not much support can be given by the mentors
In its current form, the Blendyn plugin needs a series of Python packages such as numpy, netCDF4, pygal, cairosvg, tinycss, lxml, cssselect, etc. to run with full potential. These packages are not part of the official Blender binaries that are released on the official Blender website. Furthermore, the pip
interface required to install Python packages is not available in the Python that comes with precompiled versions of Blender.
This means that only the system's installed Blender, which uses the system's installed Python, which in turn has the pip
package manager can be used adequately with Blendyn.
A solution would be useful for all those who want to use the latest Blender version with Blendyn.
As stated above, it may be a challenging and long task as we have already attempted solutions such as installing precompiled Blenders from different sources, compiling Blender, using the system's Python with a precompiled Blender, copying/linking the interested packages from the system's Python into Blender's Python and none of those solutions worked properly. Good luck.
If I were to try to develop the project https://github.com/zanoni-mbdyn/blendyn/projects/3, what is the path for getting the beam internal forces from MBDyn?
Thanks
Rafael
An error popped up when I tried to load .log
file after importing .mov
file, as shown below:
Python: Traceback (most recent call last):
File "/home/tranhuunhathuy/.config/blender/3.1/scripts/addons/blendyn-master/blendyn.py", line 931, in invoke
return self.execute(context)
File "/home/tranhuunhathuy/.config/blender/3.1/scripts/addons/blendyn-master/blendyn.py", line 866, in execute
ret_val, obj_names = parse_log_file(context)
File "/home/tranhuunhathuy/.config/blender/3.1/scripts/addons/blendyn-master/baselib.py", line 384, in parse_log_file
mbs.num_timesteps = mbs.num_rows/mbs.num_nodes
TypeError: bpy_struct: item.attr = val: BLENDYN_PG_settings_scene.num_timesteps expected an int type, not float
location: <unknown location>:-1
.mov
output file by clicking Select results file
.Load .log file
.Force type-cast to int for mbs.num_timesteps.
Line 493 in 231cce6
The ability to load labels from MBDyn is, in my opinion, extremely useful, as it allows to stop worrying about which number goes with which node and in a case where someone is using a preprocessor, to actually not even see these numbers anymore.
That said, I find it somewhat restrictive. For example, I use my own (integer) variable naming convention which is incompatible with what is allowed by Blendyn.
I also often use the same numerical value for different objects (ie: a node, a joint, and a reference frame) and this is currently disallowed by the code. I am conscious that there is a bit of risk in doing what I am proposing here, but it could perhaps be associated with a "extreme" checkbox next to the load labels button? So the code below does load any integer from the log file and will assign it to any beam, node, ref frame, or joint that has the matching number. Note that if both a beam and a node have the same label as a result of this method, it is guaranteed to be wanted by the user.
PS: I've also changed type and dict to some more generic terms, to avoid confusion...
def assign_labels_extreme(context):
""" Function that parses the (optional) labels file and assigns \
the string labels it can find to the respective MBDyn objects """
mbs = context.scene.mbdyn
nd = mbs.nodes
ed = mbs.elems
rd = mbs.references
objList = [nd,ed,rd]
labels_changed = False
log_file = os.path.join(os.path.dirname(mbs.file_path), \
mbs.file_basename + '.log')
set_strings_any = [" const integer", \
" integer"]
def assign_label(line, set_string, theObj):
line_str = line.rstrip()
eq_idx = line_str.find('=') + 1
label_int = int(line_str[eq_idx:].strip())
label_str = line_str[len(set_string):(eq_idx -1)].strip()
print ("set_string:" + set_string)
print ("line_str:" + line_str)
print ("label_str:" + label_str)
for item in theObj:
if item.int_label == label_int:
if item.string_label != label_str:
item.string_label = label_str
return True
break
return False
try:
with open(log_file) as lf:
for line in lf:
found = False
for set_string in set_strings_any:
if set_string in line:
for theObj in objList:
labels_changed += (assign_label(line, set_string, theObj))
found = True
break
except IOError:
print("Blendyn::assign_labels_extreme(): can't read from file {}, \
sticking with default labeling...".format(log_file))
return {'FILE_NOT_FOUND'}
if labels_changed:
return {'LABELS_UPDATED'}
else:
return {'NOTHING_DONE'}
# -----------------------------------------------------------
# end of assign_labels_extreme() function
This feature request may require a lot of work.
When creating a scientific simulation, the interest of the user is quite often in the actual numbers.
In its current state, Blendyn does not provide a simple method to print data from the simulation in text form above the rendered animation. It would be great feature if this were made possible. Perhaps the best approach would be to let the user create an equation from the results. For example, if the user wants to show absolute velocity of a node, they could have the "(X_vel^2+Y_vel^2+Z_vel^2)^(1/2)" info printed for each frame of the animation. Time would obviously also be useful.
Here are some examples from animations I have done in the past, but I always did them using post-processing on the Blender/OtherSoftware rendered animation images:
Here a simple example: https://youtu.be/VG4qZFkcFnU
And a more complex one: http://louisgagnon.com/pressPlot.gif
One of the two boxes of the standard import visualization of deformable displacement joint is placed incorrectly with respect to the node.
Could be a similar problem as in #47
Hello, everyone.
I am a new user of blendyn. It looks insteresting to render MBDyn model in blender.
However, when I tried to render a rotating beam, I find the beam will rotate 360deg (eg. from -180 to 180) druing the rotation, resulting in a flip in the animation, such as the one in the gif.
Is it about the description of rotation in two softwares?
And do you have any idea to fix it, or any suggestion ?
Thanks,
Best regards,
Runsen.
Currently, the Blendyn interface reports the name of the MBDyn results file which has been imported, but does not give the path. In some cases this can lead to confusion. For example, I run parametric iterations of the same model which always gets created with the same filename but in a different folder. It can be confusing for me to remember which one I have loaded.
I think a simple solution to this would be to have the full path of the imported file show up when the user places the mouse over the short name of the imported file.
@louisgag, I'm opening this in relation to #38 : seems to me that the correct interpretation was actually the previous one, in which the order of the three Euler angles should be reversed in Blender, with respect to MBDyn conventions.
Simple test: define a new Empy Axes, rotate it of some amount about its X axis, then of some other amount about the new Y axis, then again of something about the new Z axis. Read the angles in the Item tab and you'll see that the angles differ with respect to those you gave during the individual rotations. Now switch to the 'ZYX' parametrization, redo the same and you'll see that this time the values coincide.
So it seems that the Blender convention is to store in the Euler angles the three subsequent rotations that bring the object from the global orientation to the local one and not, as usual, the opposite direction.
I'm reverting back to how things were done before #38, in the new branch eulerangles
. Can you please test and report? I'm doing the same.
Blendyn seems to not like handling the output of an MBDyn simulation in which output meter
was set.
Both Standard Import
and eigenanalysis visualization fail, with index out of range
errors.
I downloaded the zip and I used blender 2.80. And I followed the pendulum tutorial second case(https://www.mbdyn.org/userfiles/documents/tutorials.pdf) so here is my mbd file. From the case, the body should be at the same position as the node while the joint should be at the origin. But in my blendyn, I have the joint at the node while the body somewhere below the node.
begin: data;
problem: initial value; # the default
end: data;
begin: initial value;
initial time: 0.;
final time: 1.;
time step: 1.e-3;
max iterations: 10;
tolerance: 1.e-6;
end: initial value;
begin: control data;
structural nodes:
+1 # node in the constraint
;
rigid bodies:
+1 # node in the constraint
;
joints:
+1 # node in the constraint: revolute
;
gravity;
end: control data;
set: integer Pendulum = 1;
set: integer Mass = 2;
set: real M = 1.;
set: real L = .5;
set: real Omega0 = .2;
reference: Pendulum,
reference, global, null,
reference, global, eye,
reference, global, null,
reference, global, 0., Omega0, 0.;
reference: Mass,
reference, Pendulum, 0., 0., -L,
reference, Pendulum, eye,
reference, Pendulum, null,
reference, Pendulum, null;
begin: nodes;
structural: 2000+Mass, dynamic,
reference, Mass, null,
reference, Mass, eye,
reference, Mass, null,
reference, Mass, null;
# no dynamic dofs (it will be fully grounded)
end: nodes;
begin: elements;
body: 2000+Mass, 2000+Mass,
M,
reference, Mass, null,
null;
/* The problem is non-singular
* because of the constraint */
joint: 2000+Mass, revolute pin,
2000+Mass,
reference, Pendulum, null,
hinge, reference, Pendulum,
1, 1.,0.,0., 3, 0.,1.,0.,
reference, Pendulum, null,
hinge, reference, Pendulum,
1, 1.,0.,0., 3, 0.,1.,0.;
gravity: 0., 0., -1., const, 9.81;
end: elements;
Nodes whose output is disabled by "output, no" cards are not handled correctly:
Standard Import
button;A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.