Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
robotran
mbsysc
Commits
d44e5ca8
Commit
d44e5ca8
authored
Feb 09, 2021
by
Olivier Lantsoght
Browse files
[MBsysPy][MbsDirdyn] Add user output in load_results_from_file() function.
parent
9a42a998
Changes
1
Hide whitespace changes
Inline
Side-by-side
MBsysC/mbs_interface/MBsysPy/mbsyspy/mbs_dirdyn.py
View file @
d44e5ca8
...
...
@@ -943,7 +943,8 @@ class MbsResult(object):
self
.
outputs
=
{}
self
.
mbs
=
mbs
def
load_results_from_file
(
self
,
filename
,
result_path
=
"resultsR"
,
module
=
0
):
def
load_results_from_file
(
self
,
filename
,
result_path
=
"resultsR"
,
module
=
0
,
user_output
=
None
,
user_vector
=
None
):
"""
Load the results from the files into a MbsResult instance.
...
...
@@ -951,17 +952,23 @@ class MbsResult(object):
Parameters
----------
filename: str
filename
: str
The resfilename containing the results to load. The required suffix
(ie. "_q.res") will be added automatically
result_path: str, optional
result_path
: str, optional
The relative path of the result folder from the project folder.
default is "resultsR"
module: int
module
: int
The module in which this function is called. In some modules, some
results files don't exist. Module ids corresponds to the
'MbsData.process' value. If set to 0 we try to load all files
default is 0
user_output : list
List containing the user output files to be loaded if not None.
default is None.
user_vector : list
List containing the user vector output files to be loaded if not None.
default is None.
"""
project_path
=
self
.
mbs
.
project_path
baseFileName
=
os
.
path
.
basename
(
filename
)
...
...
@@ -1075,3 +1082,23 @@ class MbsResult(object):
else
:
if
__DEBUG__
:
mbs_msg
(
"DEBUG>> file '"
+
CurFile
+
"' not found in folder '"
+
os
.
path
.
dirname
(
path
))
if
user_output
:
for
CurFile
in
user_output
:
path
=
os
.
path
.
abspath
(
os
.
path
.
join
(
result_path
,
CurFile
))
name
=
CurFile
[
len
(
baseFileName
)
+
1
:
-
4
]
if
(
os
.
path
.
isfile
(
path
)):
self
.
outputs
[
name
]
=
np
.
loadtxt
(
path
)[:,
1
:]
else
:
if
__DEBUG__
:
mbs_msg
(
"DEBUG>> file '"
+
CurFile
+
"' not found in folder '"
+
os
.
path
.
dirname
(
path
))
if
user_vector
:
for
CurFile
in
user_vector
:
path
=
os
.
path
.
abspath
(
os
.
path
.
join
(
result_path
,
CurFile
))
name
=
CurFile
[
len
(
baseFileName
)
+
1
:
-
4
]
if
(
os
.
path
.
isfile
(
path
)):
self
.
outputs
[
name
]
=
np
.
loadtxt
(
path
)
else
:
if
__DEBUG__
:
mbs_msg
(
"DEBUG>> file '"
+
CurFile
+
"' not found in folder '"
+
os
.
path
.
dirname
(
path
))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment