Thank you for the response.
vocx wrote: ↑Sun Oct 04, 2020 2:49 pm
So you should place the new modules in /usr/share/freecad/Mod.
This seems not to work. However, if placed in the AppImage /usr/Mod they are being picked up.
But I get a warning when FreeCAD is started (regardless of which addon is installed):
Code: Select all
/tmp/.mount_FreeCAGLzChr/usr/lib/python3.8/site-packages/mpmath/ctx_mp_python.py:892: SyntaxWarning: "is" with a literal. Did you mean "=="?
if other is 0:
/tmp/.mount_FreeCAGLzChr/usr/lib/python3.8/site-packages/mpmath/ctx_mp_python.py:986: SyntaxWarning: "is" with a literal. Did you mean "=="?
if other is 0:
Since I don't get this message when the modules are installed in $HOME/.FreeCAD/Mod, I assume something is not right.
vocx wrote: ↑Sun Oct 04, 2020 2:49 pm
The directory /usr/local is not searched, unless you compile FreeCAD yourself, and install there.
Which is very unfortunate. It would make for a much simpler global addon installation.
vocx wrote: ↑Sun Oct 04, 2020 2:49 pm
However, since you are using an AppImage, this directory is probably packed inside the AppImage. What you should do is unpack the AppImage, add the modules that you want inside the structure, and then repackage the AppImage. This is shown in
AppImage.
That's quite an involved process and has to be done anew for every FreeCAD upgrade. Therefore I wrote a short script to do the task, which I tried to attach to this post, but the forum won't let me and throws an error (Invalid file extension) for whatever reason, so I'll post it inline below. But as I mentioned above, it throws a warning when FC launches, so there's an issue somewhere.
Code: Select all
#!/bin/sh
################
#
# Extracts the FreeCAD AppImage and loads a selection of addons into the
# AppImage. Then it repackages the AppImage so the modules are available
# out-of-the-box.
#
# Note: After this action the AppImage cannot be updated using regular methods
# any longer.
#
# Usage: freecad-add-addons <file>
#
################
# exit on error
set -e
if [ "$#" -lt 1 ]; then
printf 'Error: not enough arguments provided.\n'
printf '%s %s %s\n\n' 'Usage:' "$0" '<file>'
exit 98
fi
# list of additional addons to include in the AppImage
addons='https://github.com/Zolko-123/FreeCAD_Assembly4.git Assembly4'
addons="$addons;https://github.com/boltsparts/BOLTSFC.git BOLTSFC"
addons="$addons;https://github.com/shaise/FreeCAD_FastenersWB Fasteners"
freecad_appimage="$PWD/$1"
freecad_appimage_new="${freecad_appimage%.AppImage}-addons.AppImage"
# we need the internet
nc -z -w 2 github.com 80 2>/dev/null || exit 97
# clean up after yourself
temp_dir=$(mktemp --directory --tmpdir=/dev/shm)
trap 'rm -rf "$temp_dir"' EXIT INT TERM
# unpacking
cd "$temp_dir"
"$freecad_appimage" --appimage-extract
# install addons
cd squashfs-root/usr/Mod
printf '%s\n' "$addons" | tr ';' '\n' | while read -r addon; do
url="$(printf '%s\n' "$addon" | cut -d' ' -f 1)"
name="$(printf '%s\n' "$addon" | cut -d' ' -f 2)"
git clone --depth=1 "$url" "$name"
done
cd ../../..
# fetch required tools
wget 'https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage'
appimagetool='./appimagetool-x86_64.AppImage'
chmod +x "$appimagetool"
# repacking
"$appimagetool" squashfs-root "$freecad_appimage_new"
exit 0