Concrete-Chrono-Development / chrono-preprocessor

A FreeCAD-based Project Chrono Preprocessor for Various Models
BSD 3-Clause "New" or "Revised" License
6 stars 4 forks source link

installation on MacOS #8

Open baharayhan opened 8 months ago

baharayhan commented 8 months ago

đź’» MacOS Installation and Setup

Follow the below instructions to get set up with the Chrono Preprocessor.

Step 1: Install FreeCAD [https://www.freecadweb.org/downloads.php](https://www.freecadweb.org/downloads.php)
Step 2: Find FreeCad User Workbench directory. * Open FreeCAD. * To find FreeCad User Workbench directory, run following command in FreeCad python panel: “App.getUserAppDataDir()”
Step 3: Clone ChronoConcrete Workbench from GitHub to FreeCad user application data directory obtained in Step 2. * Open a terminal. * Clone the repisotory **"git clone https://github.com/Concrete-Chrono-Development/chrono-preprocessor chronoConcrete"** * Check if the Chrono Workbench is available in the list of installed workbenches.
Step 4: Check tetgen Installation Verify that **tetgen** is installed properly in FreeCAD. * Find **tetgen** under FreeCAD folder. You may find it in this folder " ~/Library/Application Support/FreeCAD/Mod/chronoConcrete/freecad/chronoWorkbench/tetgen" * Run on a terminal > **tetgen** * Check if there is a warning such as > **bash: ./tetgen: Permission denied** Run the following command > "chmod -R 777 * " to give all permission. * Add **tetgen** path into the bash script. Open the file **zshrc**. If you don't have **zshrc**, run **nano ~/.zshrc** on a terminal. Put the following line and save. **export PATH="~/Library/Application\ Support/FreeCAD/Mod/chronoConcrete/freecad/chronoConcrete/tetgen:$PATH** Run the command on a terminal > "**source ~/.zshrc**"
Step 5: gmsh Installation * Download **gmsh** from the website. [https://gmsh.info/bin/macOS/] You can select version 4.4.1. Install it in "Applications" folder. * Open a terminal and check by running > **gmsh** If there is a warning message such as > **bash: ./tetgen: Permission denied** Run the following command > "chmod -R 777 * " to give all permission. * Add **gmsh** path in the bash script. Open the file **zshrc** and put the following line and save **export PATH="/Applications/Gmsh.app/Contents/MacOS:$PATH”** Run the command on a terminal > "**source ~/.zshrc**"
Step 6: Error **tetgen** and **gmsh** can work properly on a terminal. However, while running FreeCAD I got following errors that have to be solved; Mesh by surface search method: 0.01687900000000031 Tetgen failed during tetrahedralization. If this issue persists, you may need to use another geometry or particle distribution. Traceback (most recent call last): File "~/Library/Application Support/FreeCAD/Mod/chronoConcrete/freecad/chronoWorkbench/modules/mod_LDPMCSL.py", line 155, in generationDriver driver_LDPMCSL(self,fastGen) File "~/Library/Application Support/FreeCAD/Mod/chronoConcrete/freecad/chronoWorkbench/generation/driver_LDPMCSL.py", line 808, in driver_LDPMCSL tetGen = gen_LDPMCSL_tetrahedralization(internalNodes,surfaceNodes,\ File "/Users/baharayhan/Library/Application Support/FreeCAD/Mod/chronoConcrete/freecad/chronoWorkbench/generation/gen_LDPMCSL_tetrahedralization.py", line 115, in gen_LDPMCSL_tetrahedralization os.rename(Path(tempPath + geoName + '2D.1.ele'),Path(tempPath + geoName \ FileNotFoundError:[Errno 2] No such file or directory: '/var/folders/pr/2y9wr2zj5kl7jv56h0b_q52c0000gn/T/chronoConc10224443/LDPMgeo0002D.1.ele' -> '/var/folders/pr/2y9wr2zj5kl7jv56h0b_q52c0000gn/T/chronoConc10224443/LDPMgeo000.ele'
mtroemner commented 8 months ago

Could you please try running (in the directory where tetgen executable is located) the following command tetgen -p ./tetgen-1.5.1-source/example.poly (you may need to copy the example.poly out of the source folder where it is located if it doesn't want to run directly)?

baharayhan commented 8 months ago

I could run the example from terminal. I got following output :

tetgen % tetgen -p ./tetgen-1.5.1-source/example.poly Opening ./tetgen-1.5.1-source/example.poly. Delaunizing vertices... Delaunay seconds: 0.00107 Creating surface mesh ... Surface mesh seconds: 0.00032 Constrained Delaunay... Constrained Delaunay seconds: 0.00048 Removing exterior tetrahedra ... Exterior tets removal seconds: 0.000186 Optimizing mesh... Optimization seconds: 0.000105

Writing ./tetgen-1.5.1-source/example.1.node. Writing ./tetgen-1.5.1-source/example.1.ele. Writing ./tetgen-1.5.1-source/example.1.face. Writing ./tetgen-1.5.1-source/example.1.edge.

Output seconds: 0.000988 Total running seconds: 0.003262

Statistics:

Input points: 28 Input facets: 23 Input segments: 44 Input holes: 2 Input regions: 2

Mesh points: 28 Mesh tetrahedra: 68 Mesh faces: 160 Mesh faces on exterior boundary: 48 Mesh faces on input facets: 50 Mesh edges on input segments: 44

mtroemner commented 8 months ago

This seems similar to the Issue opened by jzhongap (when the Chrono workbench was installed in the wrong directory on Windows - which ultimately ended up being a permissions issue). You may try Chmod -R 777 for the whole workbench folder or running FreeCAD as an Administer to see if either of those solve it (the latter is not a permeant fix but may help us identify the root cause).

JulienKh commented 8 months ago

Hello, I had a similar issue while working on Mac. What I believe you need to do is the following:

  1. Manually move the ChronoConcrete folder to the desktop
  2. Check TetGen compilation and make sure TetGen is working in chronoConcrete/freecad/chronoWorkbench/tetgen
  3. Move the ChronoConcrete folder again to the MOD folder in FreeCAD
baharayhan commented 8 months ago

Thanks. I tried both recommendations. As long as the path for tetgen is correct in bash (zshrc) file , tetgen works fine from any folder on terminal. However, I have still the same error in FreeCAD.

mtroemner commented 8 months ago

@tianjuxue I know you got FreeCAD working on your Mac, does this sound like anything you encountered? Also, Bahar whether tetgen is listed in your bash/zshrc should be irrelevant as the code for the preprocessor always directly calls to the tetgen executable that is located in ".../freecad/chronoWorkbench/tetgen" (which is also why it must reside in that folder and be executable in that folder - i.e. with chmod to an appropriate permissions value).

tianjuxue commented 8 months ago

@tianjuxue I know you got FreeCAD working on your Mac, does this sound like anything you encountered? Also, Bahar whether tetgen is listed in your bash/zshrc should be irrelevant as the code for the preprocessor always directly calls to the tetgen executable that is located in ".../freecad/chronoWorkbench/tetgen" (which is also why it must reside in that folder and be executable in that folder - i.e. with chmod to an appropriate permissions value).

My experience might be a bit outdated since I installed it last year. I think I only had some issue with tetgen, but I fixed it. I left my experience here.