From 2010 to 2019,
Draftsight
was a top choice for “free” Linux / Mac / Windows AutoCAD 2D-compatible CAD users.
DraftSight 2019 brought a chill by requiring paid licenses for Windows, while introducing substantial 3-D functionality to DraftSight.
It’s important to note that DraftSight must peroidically reregister and the DraftSight “free” license can in effect be remotely terminated.

This article focuses on drop-in replacements for 2-D AutoCAD.
Numerous even more powerful
free CAD programs
exist, but they generally require retraining for users coming from AutoCAD.

Libre 2-D AutoCAD-like choices include:

QCAD

LibreCAD with native DXF.

DWG from QCAD and LibreCAD is via the free Teigha DWG ↔ DXF converter.

I didn’t include FreeCAD here as it’s for 3D / Solidworks (and also cannot open DWG at this time).

Draftsight
is free (but non-libre) and typically “just works” with DWG / DXF files from AutoCAD and other software.
DraftSight “free” license can be remotely terminated, so be mindful if doing large deployments where “free” is counted on.
Windows is no longer “free”.

DWG write: save as DXF then use free Teigha converter to convert LibreCAD DXF to DWG.

DWG ↔ DXF

Free, non-libre
Teigha File Converter
supports through
R2017 DWG/DXF. Teigha File Converter may be used to convert from DXF to DWG en masse as a first/last step.
The OpenDesignAlliance is the same organization where QCad gets its non-free non-libre converter from.

3DS DraftSight 2019 has 2-D and new for 2019 3-D functionality.
DraftSight 2019 requires a paid license for Windows.
DraftSight 2019 is available in yearly no-charge license for MacOS and Linux.
DraftSight 2018 and earlier
cease functioning on 31 DEC 2019.

DraftSight 2019 works on:

Linux (Ubuntu, Fedora) [no-charge beta]

Mac [no-charge beta]

Windows [paid license].

DraftSight:

is natively compatible with AutoCAD DWG/DXF
formats
through R2018 (used by AutoCAD 2019).

Complete registration with an email address–they only ask for verification once per install.

Hi-DPI

If you have a high resolution screen and the GUI icons look too small, try
Tools → Options → System Options → Display → Screen Options → Use Large Icons.

Notes

Usually DraftSight “just works” on native Ubuntu Linux.

It doesn’t seem like one can use WSL to workaround the Windows license limitation.
Installing DraftSight into WSL took half an hour, and would just hang WSL until reboot.
Perhaps someone will figure that one out….

GNU Octave understands that ~ tilde is the user’s home directory on any operating system, even Windows.
Matlab, even though R2019a is not that smart.
Matlab does not consistently understand ~, and I have been complaining to the Mathworks about this for over a decade, and still the Mathworks is saying WONTFIX.

For our work, we create a homepath.m that works for GNU Octave and Matlab on Linux, Mac and Windows.
It returns the absolute path of the user home directory, for example:

Linux: /home/username

MacOS: /Users/username

Windows: C:\Users\Username

file “homepath.m” contains:

function hdir = homepath()
persistent h;
if isempty(h)
if ispc % windows
h = [getenv('HOMEDRIVE'),getenv('HOMEPATH')];
else %linux,mac
h = getenv('HOME');
end
end
hdir = h; % for Matlab
end

This page shows how to setup Matlab with user Python install (e.g. Anaconda Python) on Linux, Mac or Windows.

Install Python for Matlab

Matlab is designed to work with specific Python versions for each Matlab version.
Matlab will not specifically tell you when you’re using an incompatible Python version, but you may get unstable operation or errors.

In general, we recommend for Python ↔ Matlab interfacing:

the exact location of the Python executable to put in Matlab pyversion() command is determined by:

python -c "import sys; print(sys.executable)"

This examples assumes a Python 3.7 executable is at ~/miniconda3/envs/py37/bin/python.
Setup Matlab to use Python 3.7 by adding to ~/Documents/MATLAB/startup.m

pyversion('~/miniconda3/envs/py37/bin/python')

verify Matlab → Python config by typing pyversion from within Matlab:

This example is for the “FindSSH” Python program, which concurrently searches out SSH servers on an IPv4 subnet.
It’s useful to find IoT or Raspberry Pi etc. IP addresses quickly.

setup Python user module, from Terminal or Command Prompt:

Error using pyversion Path argument does not specify a valid executable.

Ensure the Python executable path in file matlab.settings matches the desired Python executable.
On Linux, this file is at ~/.matlab/R2018b/matlab.settings.

To use
OpenCV from Matlab
as integrated by the Mathworks, you will need to write your OpenCV calls in C++ and/or CUDA, using MEX.
This works on Linux, Mac and Windows.

Install

type in Matlab:

visionSupportPackages

select “Computer Vision System Toolbox OpenCV Interface by MathWorks Computer Vision System Toolbox Team” and install.

Note: the examples require particular compilers depending on Matlab version and operating system.

Examples

This directory contains Computer Vision Toolbox examples from the Mathworks.
Find the Matlab OpenCV example directory, in Matlab:

fileparts(which('mexOpenCV'))

on Windows, Matlab OpenCV examples are under something like:

The examples below assume you’re starting from this directory.
See the README.txt in each directory for compilation details.
Some examples require a CUDA GPU.

Foreground Detector

Compile example

cd ForegroundDetector
mexOpenCV backgroundSubtractorOCV.cpp

If the example fails to compile due to compiler mismatch, follow the instructions given in the error message.
For example, on Windows with Matlab R2019a, Visual Studio C++ 2015 compiler is required.
This can be obtained by downloading the Visual Studio compiler,
and adding under the Visual Studio installer options “Individual Components” → VC++2015 toolset for desktop.
This consumes an additional 3 GB of hard drive space!

Run the OpenCV Matlab demo:

testBackgroundSubtractor

You will see a Video Player window pop up with cars driving by, with the
cars detected outlined in white rectangles.

mexopencv

The
mexopencv package
is user-friendly.
Use it much like any other Matlab toolbox, with regular Matlab code.
No need to code in C++ as with the Mathworks Matlab OpenCV support built-in from the factory.
It also adds OpenCV to GNU Octave.

For Windows, even through R2019a, MinGW Gfortran is not supported.
The solution for Matlab and Fortran on Windows is to use Intel Fortran compiler, which is not free.

Consider using GNU Octave and Gfortran on Windows and Mac.
Gfortran and Matlab MEX are fine on Linux.

Matlab requires C / C++ / Fortran compilers for numerous operations such as mex, loadlibrary and more.
Matlab ≥ R2015b can use MinGW GNU compilers for Windows.

If Matlab doesn’t detect your MinGW compiler location, you may get an error like

Error in loadlibrary>getLoadLibraryCompilerConfiguration

or

Error using mex
No supported compiler was found.

Fix

This fix is for Windows using MinGW compilers.
Tell Matlab the MinGW compiler path via Windows environment variable MW_MINGW_LOC.

Find the MinGW compiler location:

where gcc

in Matlab, assuming MinGW is under C:\mingw64\bin (don’t include “bin” below)

setenv('MW_MINGW64_LOC', 'c:\mingw64')

Setup MEX permanently

mex -setup -v
mex -setup -v C++

Note: Sadly, even through Matlab R2019a, Matlab cannot using MinGW Gfortran.
Intel Fortran must be used on Windows and Mac with Matlab.
On Linux, Gfortran is fine with MEX Matlab via

mex -setup -v Fortran

or consider using GNU Octave and Gfortran on Windows and Mac.

Verify

Matlab MEX parameters can be discovered from in Matlab by: