Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
koendv committed Feb 9, 2021
1 parent f832bbf commit d9ebd34
Showing 1 changed file with 76 additions and 79 deletions.
155 changes: 76 additions & 79 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,98 @@
# OpenSCAD on Raspberry Pi Build Notes

*This project is no longer needed, you can download OpenSCAD for 64-bit raspberry pi from the [OpenSCAD website](http://www.openscad.org/downloads.html) instead*
# OpenSCAD w/ 3D

These are build notes on compiling [OpenSCAD-2019.05](http://www.openscad.org) to an [AppImage](http://www.appimage.org) on a [raspberry pi 4](https://www.raspberrypi.org) running 2019-07-10-raspbian-buster-full.
You can download the binary [here](https://github.com/koendv/openscad-raspberrypi/releases/download/v1.0/OpenSCAD-2019.05-armhf.AppImage).
![Reel3D No. 7020 plastic flip-up clip-on](images/anaglyph_glasses.gif)

This is the OpenSCAD CAD editor, with support for showing your designs in 3D when viewed with anaglyph 3D glasses. Anaglyph 3D glasses are glasses with red and cyan colored lenses.

## Sample screen

[![](images/openscad_screenshot_big.png)](images/openscad_screenshot_small.png)

You need red/cyan colored glasses to see the 3D effect.

## Downloads

- [Binary](https://github.com/koendv/openscad-raspberrypi/releases) for raspberry pi 64-bit.
- [Patch](https://raw.githubusercontent.com/koendv/openscad-raspberrypi/master/anaglyph.patch) for compiling openscad with support for 3D glasses

## Usage

- Start OpenSCAD and load your .scad source file.

- Choose the "Ash" color scheme to get monochrome gray output. From the menu, choose *Edit->Preferences->3D View*.
Select color scheme "Ash".

- Click the render icon ![render](images/render-32.png) to render your object.

- Click the 3D glasses icon ![anaglyph](images/Anaglyph-32.png) to toggle stereo mode.

- Press *Ctrl* and rotate the mouse scroll wheel to adjust the eye separation. Too little eye separation and the 3D effect disappears; too much and you get eyestrain. Adjust for your viewing comfort.

## Notes

An anaglyph codes depth information using color. The algorithm used here works fine for objects that are gray or pastel color, but not for saturated colors. But for many simple tasks, grayscale is sufficient.

Algorithms for full-color anaglyphs exist, e.g. [Dubois filtering](http://www.site.uottawa.ca/~edubois/anaglyph/). Dubois filtering maps colors in colors that do not clash with the 3D info. Implementing Dubois filtering in OpenGL requires rendering left and right images to textures, and a fragment shader that uses these textures as input. For the moment being, I'll use graytones.

When viewing, you may wish to set "Show axes" to off, as it's jarring if an axis protrudes from the screen and points straight at you. In general, objects "behind" the screen are easier on the eye than objects that "stick out"
from the screen.

## Build notes

These are build notes on compiling [OpenSCAD-2020.02](http://www.openscad.org) to an [AppImage](http://www.appimage.org) on a [raspberry pi 4](https://www.raspberrypi.org) running 2020-08-20-raspios-buster-arm64.

### Install build dependencies

## Install build dependencies
```
sudo apt-get install cmake gawk bison flex gettext itstool libqt4-opengl-dev libboost-all-dev libxmu-dev libxi-dev libzip-dev libxml2-dev libfontconfig1-dev libharfbuzz-dev uuid-dev libglew-dev libxml2-dev ragel libqscintilla2-qt4-dev libdouble-conversion-dev libcgal-dev libeigen3-dev libopencsg-dev
```
### Build AutomaticComponentToolkit
OpenSCAD uses lib3mf-dev. lib3mf-dev is missing from raspbian. AutomaticComponentToolkit is needed to build lib3mf. Compile AutomaticComponentToolkit.
```
apt-get install golang
git clone https://github.com/Autodesk/AutomaticComponentToolkit
cd AutomaticComponentToolkit/
sh ./Build/build.sh
cd ..
sudo apt-get upgrade
sudo apt-get install cmake gawk bison flex gettext itstool libcgal-dev libeigen3-dev libfontconfig1-dev libharfbuzz-dev libopengl-dev libglew-dev libopencsg-dev libxml2-dev libboost-all-dev libzip-dev libcairo2-dev lib3mf-dev libqscintilla2-qt5-dev qtmultimedia5-dev imagemagick libqt5gamepad5-dev libhidapi-dev libspnav-dev libdouble-conversion-dev qt5-default
```
This produces three binaries: act.darwin, act.exe and act.linux.
### Install lib3MF from source
Compile lib3mf from source, and install in /usr .
### Download sources

```
git clone https://github.com/3MFConsortium/lib3mf.git
cd lib3mf
git submodule init
git clone http://github.com/openscad/openscad
cd openscad
git submodule update --init
```
Replace the x86 binaries in lib3mf/AutomaticComponentToolkit/bin with the arm binaries you just compiled:
```
cp ../AutomaticComponentToolkit/act.linux ./AutomaticComponentToolkit/bin/act.linux
```
Build lib3mf:
### Patch for 3D anaglyph
Download patch and ico

```
cmake -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install
wget https://raw.githubusercontent.com/koendv/openscad-raspberrypi/master/anaglyph.patch
wget https://github.com/koendv/openscad-raspberrypi/raw/master/images/Anaglyph-32.png
patch -p1 < anaglyph.patch
cp Anaglyph-32.png images/
```
## Build openscad
### Build openscad
First check all dependencies are installed:

```
tar xvf openscad-2019.05.src.tar.gz
cd openscad-2019.05
source ./scripts/setenv-unibuild.sh
./scripts/check-dependencies.sh
```
Output of `check-dependencies.sh`:
```
koen@raspberrypi:~/src/openscad-2019.05 $ ./scripts/check-dependencies.sh
depname minimum found OKness
qt 4.4 4.8.7 OK
qscintilla2 2.7 2.10.4 OK
cgal 3.6 4.13 OK
gmp 5.0 6.1.2 OK
mpfr 3.0 4.0.2 OK
boost 1.35 1.67 OK
opencsg 1.3.2 1.4.2 OK
glew 1.5.4 1.7.0 OK
eigen 3.0 3.3.7 OK
glib2 2.0 2.58.3 OK
fontconfig 2.10 2.13. OK
freetype2 2.4 2.9.1 OK
harfbuzz 0.9.19 2.3.1 OK
libzip 0.10.1 1.5.1 OK
bison 2.4 3.3.2 OK
flex 2.5.35 2.6.4 OK
make 3 4.2.1 OK
double-conversion 2.0.1 2.0.1 OK
```
Verify the output of *check-dependencies* is "OK".

Build:
```
qmake-qt4 openscad.pro "PREFIX=/usr"
make
qmake openscad.pro "PREFIX=/usr"
make -j4
```
When using Qt4, before running `make` edit the Makefile: in the line `LIBS =` remove `-lQtMultimedia`. Else `make` fails with the message `/usr/bin/ld: cannot find -lQtMultimedia`.
### Create appimage

## Create AppImage
The AppImage contains the application (here: openscad), all shared libraries and config files needed to run the application.
The AppImage contains the application, and all shared libraries and files needed to run the application.

Copy openSCAD binaries to appimage:
```
export INSTALL_ROOT=/home/koen/src/OpenSCAD-2019.05-armhf.AppDir
export INSTALL_ROOT=$HOME/OpenSCAD-aarch64.AppDir
mkdir $INSTALL_ROOT
make install
```
Copy Qt translations:
```
(cd /; tar cvhf - usr/share/qt4/translations/) | (cd $INSTALL_ROOT; tar xvpf -)
(cd /; tar cvhf - usr/share/qt5/translations/) | (cd $INSTALL_ROOT; tar xvpf -)
```
Copy openSCAD library dependencies to AppImage.
First make a list of all shared libraries used by openscad, then copy these libraries to the AppImage directory.
Expand All @@ -105,16 +110,16 @@ If the app uses any Qt plugins, the plugins would need to be copied too, just li

Copy AppImage files:

From `https://github.com/AppImage/AppImageKit/releases/` download `AppRun-armhf`.
From `https://github.com/AppImage/AppImageKit/releases/` download `AppRun-aarch64`.
```
cp ~/Downloads/AppRun-armhf $INSTALL_ROOT/AppRun
cp ~/Downloads/AppRun-aarch64 $INSTALL_ROOT/AppRun
chmod a+x $INSTALL_ROOT/AppRun
```
Copy desktop shortcut and icon:
```
cd $INSTALL_ROOT
cp usr/share/pixmaps/openscad.png .
cp usr/share/icons/hicolor/256x256/apps/openscad.png .
cp usr/share/applications/openscad.desktop .
```
Edit openscad.desktop and add X-AppImage-Version version info:
Expand All @@ -128,30 +133,22 @@ Exec=openscad %f
MimeType=application/x-openscad;
Categories=Graphics;3DGraphics;Engineering;
Keywords=3d;solid;geometry;csg;model;stl;
X-AppImage-Version=2019.05
X-AppImage-Version=2021.02.09
```
Create AppStream metadata:
```
cd $INSTALL_ROOT/usr/share/metainfo/
cp org.openscad.OpenSCAD.appdata.xml openscad.appdata.xml
```
Create AppImage:
From `https://github.com/AppImage/AppImageKit/releases/` download `appimagetool-aarch64.AppImage`. Create AppImage:
```
cd $INSTALL_ROOT/..
appimagetool-armhf.AppImage $INSTALL_ROOT
appimagetool-aarch64.AppImage $INSTALL_ROOT
```
Test AppImage:
```
./OpenSCAD-armhf.AppImage
./OpenSCAD-aarch64.AppImage
```
Run the AppImage on a clean install of the operating system to check all dependencies have been caught.

# Debugging
In case of shared library problems, try comparing the output of
```
LD_DEBUG=libs ./OpenSCAD-armhf.AppImage
```
with the output of
```
LD_DEBUG=libs ./openscad
```
## Credits
After a patch by Josef Pavlik

0 comments on commit d9ebd34

Please sign in to comment.