-
Notifications
You must be signed in to change notification settings - Fork 0
/
solver.sh
executable file
·51 lines (44 loc) · 1019 Bytes
/
solver.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
#
# Modify plugins.xml to switch solver
export PLUGINS_PATH=${PLUGINS_PATH:-${SHAPER_ROOT_DIR}/share/salome/resources/shaper/plugins.xml}
while [[ $# > 0 ]]; do
key="$1"
case $key in
solvespace|ss)
export solver=SolveSpace
shift
;;
planegcs|gcs)
export solver=PlaneGCS
shift
;;
-p)
export PLUGINS_PATH="$2"
shift
shift
;;
*)
shift
;;
esac
done
if [[ -z ${solver:-} ]]; then exit 0; fi
case $solver in
PlaneGCS)
export SWITCH_ON=PlaneGCSSolver
export SWITCH_OFF=SolveSpaceSolver
;;
SolveSpace|*)
export SWITCH_ON=SolveSpaceSolver
export SWITCH_OFF=PlaneGCSSolver
;;
esac
echo "Switch $solver solver in ${PLUGINS_PATH}"
cat ${PLUGINS_PATH} \
| tr '\n' '\r' \
| sed -e "s|\r <plugin library=\"[^\r]*Solver\"\/>\r<!--|\r <plugin library=\"${solver}Solver\"\/>\r<!--|" \
| tr '\r' '\n' \
> ${PLUGINS_PATH}_out
mv -f ${PLUGINS_PATH}_out ${PLUGINS_PATH}
cat ${PLUGINS_PATH}