diff --git a/src/blenderbim/desktop/Makefile b/src/blenderbim/desktop/Makefile new file mode 100644 index 0000000000..4f02ba5295 --- /dev/null +++ b/src/blenderbim/desktop/Makefile @@ -0,0 +1,29 @@ +# Linux Makefile for installing GUI desktop files, icons and ifc file associations + +DESTDIR = ${HOME}/.local + +install : + mkdir -p \ + ${DESTDIR}/bin \ + ${DESTDIR}/share/icons/hicolor/128x128/apps \ + ${DESTDIR}/share/icons/hicolor/128x128/mimetypes \ + ${DESTDIR}/share/applications \ + ${DESTDIR}/share/mime/packages + cp blenderbim.sh ${DESTDIR}/bin/ + chmod +x ${DESTDIR}/bin/blenderbim.sh + cp blenderbim.png ${DESTDIR}/share/icons/hicolor/128x128/apps/ + cp blenderbim.desktop ${DESTDIR}/share/applications/ + cp blenderbim.xml ${DESTDIR}/share/mime/packages/ + cp x-ifc_128x128.png ${DESTDIR}/share/icons/hicolor/128x128/mimetypes/x-ifc.png + update-mime-database ${DESTDIR}/share/mime/ || true + update-desktop-database ${DESTDIR}/share/applications/ || true + +uninstall : + rm -f \ + ${DESTDIR}/bin/blenderbim.sh \ + ${DESTDIR}/share/icons/hicolor/128x128/apps/blenderbim.png \ + ${DESTDIR}/share/applications/blenderbim.desktop \ + ${DESTDIR}/share/mime/packages/blenderbim.xml \ + ${DESTDIR}/share/icons/hicolor/128x128/mimetypes/x-ifc.png + update-mime-database ${DESTDIR}/share/mime/ || true + update-desktop-database ${DESTDIR}/share/applications/ || true diff --git a/src/blenderbim/desktop/README.md b/src/blenderbim/desktop/README.md new file mode 100644 index 0000000000..b4727eeda1 --- /dev/null +++ b/src/blenderbim/desktop/README.md @@ -0,0 +1,38 @@ +Desktop +======= + +This folder contains everything needed to create file associations and icons to +present BlenderBIM as a desktop application. + +Linux +----- + +Assuming that blender and BlenderBIM are already installed on your system, +configure associations and icons for a single user by running `make`: + + make install + +Test by running the wrapper script directly, this should launch BlenderBIM with +an empty IFC project: + + blenderbim.sh + +This `Makefile` installs files to `~/.local` by default, to install to an +alternative location, set `DESTDIR`: + + sudo make install DESTDIR=/usr/local + +### `command not found` error + +If you have downloaded and installed blender from blender.org, then blender may +not be findable via your `PATH` environment variable. + +Either add the folder containing the `blender` executable to your `PATH`, or +set the `BLENDER_EXE` environment variable to the location of the `blender` +executable. +Instructions will vary depending the linux distribution, consult your documentation. + +Windows +------- + +TODO diff --git a/src/blenderbim/desktop/blenderbim.desktop b/src/blenderbim/desktop/blenderbim.desktop new file mode 100644 index 0000000000..a56d68e95b --- /dev/null +++ b/src/blenderbim/desktop/blenderbim.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Application +Terminal=false +Exec=blenderbim.sh %f +Name=BlenderBIM +Icon=blenderbim +X-Desktop-File-Install-Version=0.26 +GenericName=Blender BIM add-on +MimeType=application/x-ifc; diff --git a/src/blenderbim/desktop/blenderbim.png b/src/blenderbim/desktop/blenderbim.png new file mode 100644 index 0000000000..3df402d817 Binary files /dev/null and b/src/blenderbim/desktop/blenderbim.png differ diff --git a/src/blenderbim/desktop/blenderbim.sh b/src/blenderbim/desktop/blenderbim.sh new file mode 100755 index 0000000000..21d70442c1 --- /dev/null +++ b/src/blenderbim/desktop/blenderbim.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# Wrapper script to launch BlenderBIM. + +# If the `blender` executable can't be found in your PATH environment, set +# BLENDER_EXE to the location of your preferred `blender` executable. + +: ${BLENDER_EXE:=blender} + +if [[ $# -eq 1 && -f "$@" ]]; then + "${BLENDER_EXE}" --python-expr 'import bpy; bpy.data.collections.remove(bpy.data.collections.get("Collection")); bpy.ops.bim.load_project(filepath="'$@'")' +else + "${BLENDER_EXE}" --python-expr 'import bpy; bpy.data.collections.remove(bpy.data.collections.get("Collection")); bpy.ops.bim.create_project()' +fi; diff --git a/src/blenderbim/desktop/blenderbim.xml b/src/blenderbim/desktop/blenderbim.xml new file mode 100644 index 0000000000..a38d2f085b --- /dev/null +++ b/src/blenderbim/desktop/blenderbim.xml @@ -0,0 +1,12 @@ + + + + + Industry Foundation Classes + + + + + + + diff --git a/src/blenderbim/desktop/x-ifc_128x128.png b/src/blenderbim/desktop/x-ifc_128x128.png new file mode 100644 index 0000000000..fe8c58d6ad Binary files /dev/null and b/src/blenderbim/desktop/x-ifc_128x128.png differ diff --git a/src/blenderbim/desktop/x-ifc_512x512.png b/src/blenderbim/desktop/x-ifc_512x512.png new file mode 100644 index 0000000000..adeaebec44 Binary files /dev/null and b/src/blenderbim/desktop/x-ifc_512x512.png differ