CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[CAD formats] MegaCads Installation on Ubuntu

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By NablaDyn
  • 1 Post By rnburne
  • 1 Post By NablaDyn

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 2, 2016, 07:36
Default MegaCads Installation on Ubuntu
  #1
Senior Member
 
NablaDyn's Avatar
 
Join Date: Oct 2015
Location: Germany
Posts: 100
Rep Power: 11
NablaDyn is on a distinguished road
Dear potential MegaCads users,

several times I have been asked how to install MegaCads on Ubuntu systems. I know MegaCads always seems a bit bitchy when it comes to that.

Therefore, I decided open a thread containing detailed instructions on how to get MegaCads run properly on Ubuntu. I figured these routines out over hours of trial-and-error approaches and now they seem to function quite perfectly and universally. I successfully run MegaCads on Ubuntu 14.04, 15.10 and 16.10 and use it for mesh generation for OpenFOAM (to use it alongside OpenFOAM see http://www.cfd-online.com/Forums/ope...-megacads.html after installation).

Note: There are surely many other/easier ways to install MegaCads and I don't consider my solution flawless, but it works fine for me. Ever since I managed the installation on Ubuntu 16.10, I have never again encountered any setup related problems concerning installation or use of MegaCads.
NablaDyn is offline   Reply With Quote

Old   December 2, 2016, 07:51
Default MegaCads Installation on Ubuntu Step-by-Step
  #2
Senior Member
 
NablaDyn's Avatar
 
Join Date: Oct 2015
Location: Germany
Posts: 100
Rep Power: 11
NablaDyn is on a distinguished road
The following instructions should apply to any recent 64 bit Ubuntu version.
Note: AFAIK the library 'libXp.so.6', which is required by MegaCads, is not natively available for Ubuntu 16. You therefore may need to build it from source (see below)
Of course, you run all below instructions at your own risk and responsibility...
I subdivided the procedure into several parts to make it easier to follow.

Last edited by NablaDyn; December 3, 2016 at 14:13.
NablaDyn is offline   Reply With Quote

Old   December 2, 2016, 07:59
Default Ubuntu System Setup
  #3
Senior Member
 
NablaDyn's Avatar
 
Join Date: Oct 2015
Location: Germany
Posts: 100
Rep Power: 11
NablaDyn is on a distinguished road
  1. Have Ubuntu installed properly and open a terminal.
  2. Set up the system's 'locales', MegaCads might otherwise be unable to read grid or geometry files although it seems to work normally.
    Code:
    $ sudo gedit /etc/defaults/locale
    Change all locales to 'en_US.UTF-8'.
  3. Update your system:
    Code:
    $ sudo apt-get update
    Code:
    $ sudo apt-get upgrade
  4. Check whether C-shell is installed by typing:
    Code:
    $ csh
    If not, install C-Shell (CSH):
    Code:
    $ sudo apt-get install csh
    MegaCads doesn't like BASH, so I use a script (shown below) that switches to CSH during my MegaCads sessions automatically.

Last edited by NablaDyn; December 3, 2016 at 14:16.
NablaDyn is offline   Reply With Quote

Old   December 2, 2016, 08:51
Default Embed MegaCads into Your Ubuntu System
  #4
Senior Member
 
NablaDyn's Avatar
 
Join Date: Oct 2015
Location: Germany
Posts: 100
Rep Power: 11
NablaDyn is on a distinguished road
To embed MegaCads you need to adapt some environment variables in a certain file ('MegaEnvironment') that is shipped with your copy of MegaCads. There is also an installation instruction/client shipped with it, that tries to configure the software more or less automatically but that hasn't worked for me so far ...
Instead, I always use a specific and very strict file structure for storing the executables (feel free to adapt the following locations and names as you please, only be sure to keep consistency):
  1. Set up a folder '~/Software/MegaCads' by:
    Code:
    $ mkdir ~/Software
    Code:
    $ mkdir  ~/Software/MegaCads
    We will refer to that directory as INSTALLDIR from here on.
  2. Extract the MegaCads tarball into the new directory. The new directory should look like figure 1 now.
  3. Make sure the file 'MegaEnvironment' is located in the INSTALLDIR. If this is not already the case, do
    Code:
    $ cp ~/Software/MegaCads/MEGACADS-2.5.2/BINARIES/PC64/MegaEnvironment ~/Software/MegaCads/
    and open it by
    Code:
    $ gedit ~/Software/MegaCads/MegaEnvironment
  4. There's now two environment variables to adapt: '$MEGA_ROOT' and 'MEGA_BIN'. 'MEGA_ROOT' must point to /home/<username>/Software/MegaCads/MEGACADS-2.5.2'. Note, that you must adapt the user name. 'MEGA_BIN' must point to '$MEGA_ROOT/BINARIES/PC64. Accordingly, adapt the 'xrdb -merge' pathes at the end of the file. Everything else is additional stuff or dedicated to other OS and thus, not mandatory. Afterwards, save the file and close it.
  5. You may now give it a first shot by switching into C-shell and trying to launch MegaCads from your INSTALLDIR:
    Code:
    $ csh
    Code:
    % source MegaEnvironment
    What you get probably looks like figure 2 and tell you that some aliases have been set. The 'mcads2' alias is the one to lauch MegaCads.
  6. Lastly, you need to assign sufficient permissions to allow for MegaCads files to be executed, but first, switch back to BASH:
    Code:
    % bash
  7. User level permissions are sufficient:
    Code:
    $ chmod u+x ~/Software/MegaCads/MEGACADS-2.5.2/BINARIES/PC64/MegaCads
    Code:
    $ chmod u+x ~/Software/MegaCads/MEGACADS-2.5.2/BINARIES/PC64/MegaBatch
    Code:
    $ chmod u+x ~/Software/MegaCads/MEGACADS-2.5.2/BINARIES/PC64/MegaEdit
Attached Images
File Type: png figure1.png (30.4 KB, 55 views)
File Type: png figure2.png (23.8 KB, 42 views)

Last edited by NablaDyn; December 3, 2016 at 04:34.
NablaDyn is offline   Reply With Quote

Old   December 2, 2016, 10:16
Default The Missing Shared Libraries
  #5
Senior Member
 
NablaDyn's Avatar
 
Join Date: Oct 2015
Location: Germany
Posts: 100
Rep Power: 11
NablaDyn is on a distinguished road
Now, MegaCads itself is set up. But when you try to run it from shell by
Code:
$ csh
Code:
% source MegaEnvironment
Code:
% mcads2
you will pretty likely be informed that certain shared libraries are missing on your system. It clearly depends on your system, whether they are already available or not. So, I will start with the messages (and the corresponding remedies) I always encounter on a fresh Ubuntu setup.
  1. libnetcdf.so.4: Install libnetcdf.so.7 (or newer) instead:
    Code:
    $ sudo apt-get install libnetcdf7
    Softlink the library:
    Code:
    $ sudo ln -s /usr/lib/x86_64-linux-gnu/libnetcdf.so.7 /usr/lib/libnetcdf.so.4
  2. libXm.so.4: Simply install via APT:
    Code:
    $ sudo apt-get install libxm4
  3. libjpeg.so.62: Again:
    Code:
    $ sudo apt-get install libjpeg62
  4. libXp.so.6: This one might be a bit harder to install. On newer Ubuntus (e.g. 16.x) you may need to build it from source:
  1. Download the three required package files [libxp_1.0.2-1ubuntu1.dsc] [libxp_1.0.2.orig.tar.gz] [libxp_1.0.2-1ubuntu1.diff.gz] from the ubuntu pages.
  2. Place these files in a directory of your choice, enter that directory and run
    Code:
    $ dpkg-source -x libxp_1.0.2-2.dsc
    This creates a new subdirectory 'libxp...'.
  3. Install some utilities necessary for package building:
    Code:
    $ sudo apt-get install dh-autoreconf quilt x11proto-print-dev xutils-dev
  4. Now run
    Code:
    $ dpkg-buildpackage -uc -us -rfakeroot -b
    to build the library and change the directory by
    Code:
    $ cd ..
  5. You can now conveniently install the library:
    Code:
    $ sudo dpkg -i libxp-dev_1.0.2-1ubuntu1_amd64.deb libxp6_1.0.2-1ubuntu1_amd64.deb
Well, that should have done the magic. Now try from your INSTALLDIR:
Code:
$ csh
Code:
% source MegaEnvironment
Code:
% mcads2
You should now - with tears of joy welling in your eyes - see something like figure 3.
Attached Images
File Type: png figure3.png (19.8 KB, 53 views)

Last edited by NablaDyn; December 13, 2016 at 05:08.
NablaDyn is offline   Reply With Quote

Old   December 2, 2016, 12:28
Default
  #6
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 13
Flowkersma is on a distinguished road
Hi,

Thank you for the guide! I can now see the main screen. However, when I click file->import->STL-Ascii... nothing happens. No dialogs, no errors, nothing. Do you have suggestions what to do?

When I run MegaCads, I get three warnings which are probably not related to this:
Quote:
Warning: Cannot convert string "*hel*-m*-r-*-10-*" to type FontStruct
Warning: Cannot convert string "*hel*-b*-r-*-12-*" to type FontStruct
Warning: Cannot convert string "*hel*-m*-r-*-12-*" to type FontStruct
Best,
Mikko
Flowkersma is offline   Reply With Quote

Old   December 2, 2016, 13:00
Default
  #7
Senior Member
 
NablaDyn's Avatar
 
Join Date: Oct 2015
Location: Germany
Posts: 100
Rep Power: 11
NablaDyn is on a distinguished road
Quote:
Originally Posted by Flowkersma View Post
Hi,

Thank you for the guide! I can now see the main screen. However, when I click file->import->STL-Ascii... nothing happens. No dialogs, no errors, nothing. Do you have suggestions what to do?

When I run MegaCads, I get three warnings which are probably not related to this:


Best,
Mikko
Hi Mikko,

no these messages are due to the fonts MegaCads wants to use by default and of no importance.
The graphical menu for import/export is not fully functional (as mentioned in the paper). You need to import data via script commands in the SAVE_PROC_FILE. You can use 'read_data' or 'import_geometry' for that. MegaCads comes with HTML help pages (simply view them in your browser). The help pages describe the functionalities and script commands.

HINT: Try to use GUI and text editor simultaneously during mesh creation. This makes it way easier and faster to debug or develop your mesh.
Flowkersma likes this.
NablaDyn is offline   Reply With Quote

Old   December 3, 2016, 04:55
Default MegaCads Launcher/Desktop Icon
  #8
Senior Member
 
NablaDyn's Avatar
 
Join Date: Oct 2015
Location: Germany
Posts: 100
Rep Power: 11
NablaDyn is on a distinguished road
Forgot the most important part ...
To shortcut the launching process, create a 'launch'-file containing the lines (adapt the path):
Code:
#!/bin/csh
source  <path_to_MegaEnvironment>
mcads2
Save that file in your INSTALLDIR and make it executable
Code:
$ chmod u+x <launch-file>
Additionally, you can now create a desktop-launcher to start MegaCads from the Ubuntu GUI (Unity). Simply put a launcher file (e.g. 'MegaCads.desktop') into /usr/share/applications/.
The launcher needs to look somewhat like this:
Code:
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Name=MegaCads
Comment=StructuredMeshGenerator
Exec=<path_to_launcher_file>
Icon=<path_to_launcher_icon>
Terminal=false
Categories=Applications
I use this one:
Attached Images
File Type: png launcher_icon.png (16.4 KB, 220 views)
NablaDyn is offline   Reply With Quote

Old   December 4, 2016, 14:36
Default Installation difficulty
  #9
Member
 
Ron Burnett
Join Date: Feb 2013
Posts: 42
Rep Power: 13
rnburne is on a distinguished road
The particular package I have was downloaded from DLR in Aug, 2015. Attached is some information that hopefully will help........

pic 1 extracted contents
structure of the main folder
pic 2 contents of "TOOLS"
MegaEnvironment file
error message

Each step of the installation process was successful but I'm left with an
error message. Can anyone help?

Ron
Attached Images
File Type: png pic 1.png (26.6 KB, 16 views)
File Type: png pic 2.png (30.5 KB, 13 views)
Attached Files
File Type: doc structure.doc (21.0 KB, 13 views)
File Type: doc MegaEnvironment.doc (26.5 KB, 11 views)
File Type: doc error message.doc (19.5 KB, 15 views)
rnburne is offline   Reply With Quote

Old   December 4, 2016, 15:20
Default
  #10
Senior Member
 
NablaDyn's Avatar
 
Join Date: Oct 2015
Location: Germany
Posts: 100
Rep Power: 11
NablaDyn is on a distinguished road
Quote:
Originally Posted by rnburne View Post
The particular package I have was downloaded from DLR in Aug, 2015. Attached is some information that hopefully will help........

pic 1 extracted contents
structure of the main folder
pic 2 contents of "TOOLS"
MegaEnvironment file
error message

Each step of the installation process was successful but I'm left with an
error message. Can anyone help?

Ron
Ron,

it seems you simply forgot to adapt the MegaEnvironment file. Your error is due to the splash screen image MegaCads cannot find because of the not yet defined environment variables. I attached a ME file with info about which lines to change (yellow: edit, red: remove). Additionally, your alias is obviously named 'mcads'. Either change the entry in your ME file (mcads->mcads2) or in the launch script (mcads2->mcads) and it should work...

Hope it helps.

Best regards,

Martin
Attached Files
File Type: pdf MegaEnvironment.pdf (60.7 KB, 48 views)

Last edited by NablaDyn; December 5, 2016 at 05:44.
NablaDyn is offline   Reply With Quote

Old   December 5, 2016, 05:10
Default
  #11
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 13
Flowkersma is on a distinguished road
The directory structure was a bit different for me than in the example. Here are the environment variables that I modified:
Code:
setenv MEGA_ROOT /home/mikko/apps/megacads/megacads-2.5.2/MegaCads-2.5.2/
setenv MEGA_BIN $MEGA_ROOT/BINARIES/PC64/
setenv MEGAPIXMAPS   $MEGA_ROOT/MEGACADS/PIXMAP
Flowkersma is offline   Reply With Quote

Old   December 5, 2016, 05:40
Default
  #12
Senior Member
 
NablaDyn's Avatar
 
Join Date: Oct 2015
Location: Germany
Posts: 100
Rep Power: 11
NablaDyn is on a distinguished road
Quote:
Originally Posted by Flowkersma View Post
The directory structure was a bit different for me than in the example. Here are the environment variables that I modified:
Code:
setenv MEGA_ROOT /home/mikko/apps/megacads/megacads-2.5.2/MegaCads-2.5.2/
setenv MEGA_BIN $MEGA_ROOT/BINARIES/PC64/
setenv MEGAPIXMAPS   $MEGA_ROOT/MEGACADS/PIXMAP
I'm sorry, you are probably right. the structure shown above is the one I always start from. But I think I've accidently mixed it all up a bit back then...
However, the instructions I gave should be consistent as long as you are aware of what your installation's root directory is.
NablaDyn is offline   Reply With Quote

Old   December 5, 2016, 11:10
Default
  #13
Member
 
Ron Burnett
Join Date: Feb 2013
Posts: 42
Rep Power: 13
rnburne is on a distinguished road
Quote:
Originally Posted by NablaDyn View Post
Ron,

it seems you simply forgot to adapt the MegaEnvironment file. Your error is due to the splash screen image MegaCads cannot find because of the not yet defined environment variables. I attached a ME file with info about which lines to change (yellow: edit, red: remove). Additionally, your alias is obviously named 'mcads'. Either change the entry in your ME file (mcads->mcads2) or in the launch script (mcads2->mcads) and it should work...

Hope it helps.

Best regards,

Martin

The MegaEnvr file shown is an unedited version. I had made all the correct
entries......with one small exception. It's now up and running. Thanks.
NablaDyn likes this.
rnburne is offline   Reply With Quote

Old   May 29, 2020, 14:17
Default MegaCads on Ubuntu 20.04 LTS
  #14
Senior Member
 
NablaDyn's Avatar
 
Join Date: Oct 2015
Location: Germany
Posts: 100
Rep Power: 11
NablaDyn is on a distinguished road
To make MegaCads run on Ubuntu 20.04 LTS (Focal Fossa), follow the above steps until step "1. libnetcdf.so.4..." in post #5 and make sure to have gdebi installed, for convenience.


Instead of libnetcdf.so.7, you will probably have to install something like libnetcdf.so.15:
Code:
sudo apt-get install libnetcdf15
Link as usual:
Code:
sudo ln -s /usr/lib/x86_64-linux-gnu/libnetcdf.so.15 /usr/lib/libnetcdf.so.4
Proceed with
Code:
sudo apt-get install libxm4
Code:
sudo apt-get install libjpeg62
The remaining libraries are not available via apt, but I unearthed them on the web (attached). Install them, e.g., via GUI in the following order (I might have mixed something up...):
  1. multiarch...
  2. libxp...
  3. gcc-base...
Download and install libgfortran from: https://packages.ubuntu.com/bionic-u...tran3/download

Now, execute the "mcads.sh" script as usual. The MegaCads GUI should now pop up. Important: Make sure you are using en-US locales on your system. Otherwise MegaCads may behave weirdly, crash or be unable to import/export data properly.
Attached Files
File Type: zip multiarch-support_2.19-18+deb8u10_amd64.zip (176.5 KB, 7 views)
File Type: zip libxp6_1.0.2-2_amd64.zip (21.9 KB, 1 views)
File Type: zip gcc-6-base_6.5.0-2ubuntu1~18.04_amd64.zip (16.5 KB, 1 views)
yoooodarulez likes this.
NablaDyn is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i fix installation error of ansys 19.0 on ubuntu 18.04 rid_taki ANSYS 15 June 7, 2021 07:32
[OpenFOAM.org] Can't find installation instruction for Openfoam 2.4.x , on Ubuntu 16.04 titanium OpenFOAM Installation 14 February 20, 2020 12:46
openFOAM installation in ubuntu 11.10 kirubhakaran OpenFOAM Installation 5 February 17, 2012 03:16
Installation of OpenFOAM-1.6 on Ubuntu 9.10 marval OpenFOAM Installation 2 March 17, 2010 09:33
Adventure of fisrst openfoam installation on Ubuntu 710 jussi OpenFOAM Installation 0 April 24, 2008 15:25


All times are GMT -4. The time now is 19:12.