OpenCamLib/fr: Difference between revisions

From FreeCAD Documentation
(Created page with "'''Remarque:''' à partir de FreeCAD version 0.19, OCL devrait être inclus avec tous les packages de distribution Windows.")
(Created page with "Pour installer OCL sur Windows, suivez ces instructions. # Déterminez la version Python d'OpenCamLib (OCL). #* Construisez à partir de [https://github.com/aewallin/opencamli...")
Line 15: Line 15:
'''Remarque:''' à partir de FreeCAD version 0.19, OCL devrait être inclus avec tous les packages de distribution Windows.
'''Remarque:''' à partir de FreeCAD version 0.19, OCL devrait être inclus avec tous les packages de distribution Windows.


To install OCL on Windows, follow these instructions.
Pour installer OCL sur Windows, suivez ces instructions.
# Obtain the Python version of OpenCamLib (OCL).
# Déterminez la version Python d'OpenCamLib (OCL).
#* Build from [https://github.com/aewallin/opencamlib source] using the Python version used by your FreeCAD version. Peter Lama's [https://github.com/peterlama/opencamlib fork of the same] source has project files for a MSVC build.
#* Construisez à partir de [https://github.com/aewallin/opencamlib source] en utilisant la version Python utilisée par votre version de FreeCAD. La source de Peter Lama [https://github.com/peterlama/opencamlib un fork] contient des fichiers de projet pour une construction MSVC.
#* Download the Python 2.7 x86/x64 [https://github.com/sgrogan/opencamlib/releases binary] by sgrogan on GitHub.
#* Téléchargez le Python 2.7 x86 / x64 [https://github.com/sgrogan/opencamlib/releases binary] par sgrogan sur GitHub.
#* Download the Python 3.6 x64 [https://github.com/sgrogan/opencamlib/releases binary] by sgrogan on GitHub.
#* Téléchargez le Python 3.6 x64 [https://github.com/sgrogan/opencamlib/releases binary] par sgrogan sur GitHub.
# Navigate to your OCL build ''or'' binary folder
# Naviguez vers votre build OCL ''ou'' dossier des binaires
# Copy the '''ocl.pyd''' library file
# Copier le fichier de la bibliothèque ''ocl.pyd''.
# Proceed with one of the following four(4) options:
# Choisissez l'une des quatre (4) options suivantes :
#* Navigate to your '''FreeCAD\lib''' folder, and paste the '''ocl.pyd''' file there. {{ColoredText||red|(''This is the preferred option.'')}}
#* Accédez à votre dossier '''FreeCAD\lib''' et collez-y le fichier '''ocl.pyd'''. {{ColoredText||red|(''Option à préférer.'')}}
#* Navigate to your '''FreeCAD\bin''' folder, and paste the '''ocl.pyd''' file there.
#* Accédez à votre dossier '''FreeCAD\bin''' et collez-y le fichier '''ocl.pyd'''.
#* Navigate to your '''FreeCAD\Mod''' folder. Create a new folder, '''OCL'''. Enter the '''OCL''' folder and paste the '''ocl.pyd''' file.
#* Accédez à votre dossier '''FreeCAD\Mod'''. Créez un nouveau dossier '''OCL'''. Entrez dans le dossier '''OCL''' et collez le fichier '''ocl.pyd'''.
#* 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. {{ColoredText||red|(''This is the least preferred option.'')}}
#* Accédez à votre dossier '''%USERPROFILE%\AppData\Roaming\FreeCAD'''. Créez un nouveau dossier, '''Mod'''. Entrez dans le dossier '''Mod'''. Créez un nouveau dossier '''OCL'''. Entrez dans le dossier '''OCL''' et collez le fichier '''ocl.pyd'''. {{ColoredText||red|(''Option la moins préférée.'')}}
# Restart FreeCAD
# Redémarrez FreeCAD
# Verify proper installation
# Vérifier la bonne installation
## Click '''View''' → '''Panels''' → '''Python console'''.
## Cliquez sur '''Affichage''' → '''Panneaux''' → '''Console Python'''.
## Type "'''import ocl'''" into the Python console and press the '''enter''' key.
## Tapez "'''import ocl'''" dans la console Python et appuyez sur la touche '''entrée'''.
## If no error appears, you have correctly installed OCL
## Si aucune erreur n'apparaît, vous avez correctement installé OCL
##* If you receive an error:
##* Si vous avez une erreur:
##** Check the placement and name of the '''ocl.pyd''' file as instructed above
##** Vérifiez l'emplacement et le nom du fichier '''ocl.pyd''' comme indiqué ci-dessus
##** Verify the correct architecture type of the OCL library you installed - x86 or x64
##** Vérifiez le type d'architecture correct de la bibliothèque OCL que vous avez installée - x86 ou 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
##** Vérifiez que la version Python utilisée pour construire la bibliothèque OCL est la même que celle de votre logiciel FreeCAD - 2.7 ou 3.6 actuellement


=== Linux ===
=== Linux ===

Revision as of 12:38, 13 June 2020

Description

OpenCamLib (OCL) est une bibliothèque open source visant à fournir des algorithmes de fabrication assistée par ordinateur (FAO). FreeCAD utilise OCL dans les opérations expérimentales de Path Surface 3D et autres fonctionnalités expérimentales.

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

Site web: http://www.anderswallin.net/CAM/

Installation

Windows

Remarque: à partir de FreeCAD version 0.19, OCL devrait être inclus avec tous les packages de distribution Windows.

Pour installer OCL sur Windows, suivez ces instructions.

  1. Déterminez la version Python d'OpenCamLib (OCL).
    • Construisez à partir de source en utilisant la version Python utilisée par votre version de FreeCAD. La source de Peter Lama un fork contient des fichiers de projet pour une construction MSVC.
    • Téléchargez le Python 2.7 x86 / x64 binary par sgrogan sur GitHub.
    • Téléchargez le Python 3.6 x64 binary par sgrogan sur GitHub.
  2. Naviguez vers votre build OCL ou dossier des binaires
  3. Copier le fichier de la bibliothèque ocl.pyd.
  4. Choisissez l'une des quatre (4) options suivantes :
    • Accédez à votre dossier FreeCAD\lib et collez-y le fichier ocl.pyd. (Option à préférer.)
    • Accédez à votre dossier FreeCAD\bin et collez-y le fichier ocl.pyd.
    • Accédez à votre dossier FreeCAD\Mod. Créez un nouveau dossier OCL. Entrez dans le dossier OCL et collez le fichier ocl.pyd.
    • Accédez à votre dossier %USERPROFILE%\AppData\Roaming\FreeCAD. Créez un nouveau dossier, Mod. Entrez dans le dossier Mod. Créez un nouveau dossier OCL. Entrez dans le dossier OCL et collez le fichier ocl.pyd. (Option la moins préférée.)
  5. Redémarrez FreeCAD
  6. Vérifier la bonne installation
    1. Cliquez sur AffichagePanneauxConsole Python.
    2. Tapez "import ocl" dans la console Python et appuyez sur la touche entrée.
    3. Si aucune erreur n'apparaît, vous avez correctement installé OCL
      • Si vous avez une erreur:
        • Vérifiez l'emplacement et le nom du fichier ocl.pyd comme indiqué ci-dessus
        • Vérifiez le type d'architecture correct de la bibliothèque OCL que vous avez installée - x86 ou x64
        • Vérifiez que la version Python utilisée pour construire la bibliothèque OCL est la même que celle de votre logiciel FreeCAD - 2.7 ou 3.6 actuellement

Linux

The repository is here and contains basic installation instructions.

Before beginning installation, or during the installation process, you will probably find you need to install some additional packages:

For example:

   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

Note: the "libboost-program-options-dev" may be substituted with "libboost-all-dev".

If you are struggling, carefully review any error messages you get during the cmake and make phases as you may need to install additional packages.

Python 3

Identify the version of cmake you have installed with cmake --version

For cmake >= 3.12, add these flags:

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

For cmake < 3.12 (like in Ubuntu 18.04, which has 3.10), first you'll need to edit src/pythonlib/pythonlib.cmake, and apply this patch:

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
   )


Then, in order for python3 to be detected correctly you'll need to add 2 more flags to the cmake line:

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

See the FreeCAD forum at Re: How to activate openCamLib after compiling it, and a few posts following.

Mac

(No entry)


More help

In case you run into difficulties, you may find additional help at these forum posts:

Acknowledgments

Thank you to Dr. Anders Wallin for providing OCL to the public.