OpenCamLib/de

Beschreibung

OpenCamLib (OCL) ist eine Open-Source-Bibliothek, die Algorithmen für die computergestützte Fertigung (CAM) bereitstellt. FreeCAD verwendet OCL in den experimentellen CAM Oberfläche-Pfadoperationen und anderen experimentellen Funktionen.

GitHub: https://github.com/aewallin/opencamlib

Homepage: http://www.anderswallin.net/CAM/

Installieren

Windows

Hinweis: Ab FreeCAD Version 0.19 sollte OCL in allen Windows-Distributionspaketen enthalten sein.

To install OCL on Windows, follow these instructions.

  1. Obtain the Python version of OpenCamLib (OCL).
    • Build from source using the Python version used by your FreeCAD version. Peter Lama's fork of the same source has project files for a MSVC build.
    • Download the Python 2.7 x86/x64 binary by sgrogan on GitHub.
    • Download the Python 3.6 x64 binary by sgrogan on GitHub.
  2. Navigate to your OCL build or binary folder
  3. Copy the ocl.pyd library file
  4. Proceed with one of the following four(4) options:
    • Navigate to your FreeCAD\lib folder, and paste the ocl.pyd file there. (This is the preferred option.)
    • Navigate to your FreeCAD\bin folder, and paste the ocl.pyd file there.
    • Navigate to your FreeCAD\Mod folder. Create a new folder, OCL. Enter the OCL folder and paste the ocl.pyd file.
    • Navigate to your %USERPROFILE%\AppData\Roaming\FreeCAD folder. Create a new folder, Mod. Enter the Mod folder. Create a new OCL folder. Enter the OCL folder and paste the ocl.pyd file. (This is the least preferred option.)
  5. Restart FreeCAD
  6. Verify proper installation
    1. Click ViewPanelsPython console.
    2. Type "import ocl" into the Python console and press the enter key.
    3. If no error appears, you have correctly installed OCL
      • If you receive an error:
        • Check the placement and name of the ocl.pyd file as instructed above
        • Verify the correct architecture type of the OCL library you installed - x86 or x64
        • Verify the Python version used to build the OCL library is the same as that of your FreeCAD software - 2.7 or 3.6 currently

Linux

Das Repository befindet sich hier und enthält grundlegende Installationsanweisungen.

Vor Beginn der Installation oder während des Installationsvorgangs wird man wahrscheinlich feststellen, dass man einige zusätzliche Pakete installieren muss:

Ubuntu/Debian

Zum Beispiel:

sudo apt install cmake
sudo apt install libboost-program-options-dev
# Optional, for documentation:
sudo apt-get install doxygen
sudo apt-get install texlive-full

Hinweis: "libboost-program-options-dev" kann durch "libboost-all-dev" ersetzt werden.

Wenn man Probleme hat, überprüft man sorgfältig alle Fehlermeldungen, die man während der cmake- und make-Phasen erhält, da man möglicherweise zusätzliche Pakete installieren muss.

Archlinux

  1. Man installiert OpenCamLib aus dem AUR-Paket.
  2. Dann führt man den folgenden Codeausschnitt in der Python-Konsole von FreeCAD aus.
import sys
sys.path.append('/usr/opencamlib/')
import ocl

Python 3

Die Version von cmake mit cmake --version identifizieren, die man installiert hat.

Für cmake >= 3.12 fügt man diese Markierungen (flags) hinzu:

cmake -DBUILD_PY_LIB=ON -DUSE_PY_3=ON -DCMAKE_BUILD_TYPE=Release ../src -Wno-dev

Für cmake < 3.12 (wie in Ubuntu 18.04, das 3.10 hat) muss man zunächst src/pythonlib/pythonlib.cmake bearbeiten und diesen Patch anwenden:

Index: opencamlib-2019.07/src/pythonlib/pythonlib.cmake
===================================================================
--- opencamlib-2019.07.orig/src/pythonlib/pythonlib.cmake
+++ opencamlib-2019.07/src/pythonlib/pythonlib.cmake
@@ -48,13 +48,13 @@ if(${CMAKE_VERSION} VERSION_LESS "3.12.0
     message("Python not found")
   endif()
   execute_process(
-    COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(0,0,\"/usr/local\")"
+    COMMAND ${PYTHON_EXECUTABLE} -c "import site; print(site.getsitepackages()[-1])"
     OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
     OUTPUT_STRIP_TRAILING_WHITESPACE
   ) # on Ubuntu 11.10 this outputs: /usr/local/lib/python2.7/dist-packages
 
   execute_process(
-    COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(plat_specific=1,standard_lib=0,prefix=\"/usr/local\")"
+    COMMAND ${PYTHON_EXECUTABLE} -c "import site; print(site.getsitepackages()[-1])"
     OUTPUT_VARIABLE PYTHON_ARCH_PACKAGES
     OUTPUT_STRIP_TRAILING_WHITESPACE
   )

Damit Python 3 korrekt erkannt wird, muss man der cmake-Zeile zwei weitere Markierungen (flags) hinzufügen:

cmake -DBUILD_PY_LIB=ON -DUSE_PY_3=ON -DPYTHON_EXECUTABLE="$(which python3)" -DPYTHON_VERSION_SUFFIX=3 -DCMAKE_BUILD_TYPE=Release ../src -Wno-dev

Siehe das FreeCAD-Forum unter Re: How to activate openCamLib after compiling it, und einige nachfolgende Beiträge.

Mac

git clone https://github.com/aewallin/opencamlib
cd opencamlib
mkdir build
cd build
cmake -DBUILD_PY_LIB=ON -DUSE_PY_3=ON -DCMAKE_BUILD_TYPE=Release .. -Wno-dev
make -j4
make install

Um den Build zu testen, gibt man Folgendes in die Python-Konsole ein:

import area
import ocl
dir(ocl)

Der Rückgabewert sollte lauten:

['AdaptivePathDropCutter', 'AdaptivePathDropCutter_base', 'AdaptiveWaterline', 'AdaptiveWaterline_base', 'Arc', 'ArcSpanType', 'BallConeCutter', 'BallCutter', 'BatchDropCutter', 'BatchDropCutter_base', 'BatchPushCutter', 'BatchPushCutter_base', 'Bbox', 'BullConeCutter', 'BullCutter', 'CCPoint', 'CCType', 'CLPoint', 'CompBallCutter', 'CompCylCutter', 'ConeConeCutter', 'ConeCutter', 'CutterLocationSurface', 'CylConeCutter', 'CylCutter', 'Ellipse', 'EllipsePosition', 'Fiber', 'Fiber_base', 'Interval', 'Line', 'LineCLFilter', 'LineCLFilter_base', 'LineSpanType', 'MillingCutter', 'Path', 'PathDropCutter', 'PathDropCutter_base', 'Path_base', 'Point', 'STLReader', 'STLSurf', 'STLSurf_base', 'SpanType', 'Triangle', 'Triangle_base', 'Waterline', 'Waterline_base', 'WeaveVertexType', 'ZigZag', 'ZigZag_base', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'eps', 'epsD', 'epsF', 'version']

Im Falle eines Fehlers lautet der Rückgabewert:

['__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']

Für cmake ist die Option Release sehr wichtig, da es bei Verwendung des Debug-Bereichs zu Konflikten mit ocl kommt und eine der beiden Bibliotheken nicht geladen wird (je nachdem, welche zuerst geladen wurde).

Weitere Hilfe

Falls man auf Schwierigkeiten stößt, findet man zusätzliche Hilfe in diesen Forenbeiträgen:

Danksagungen

Dank an Dr. Anders Wallin für die Bereitstellung von OCL für die Öffentlichkeit.