File Exchange

image thumbnail


version 1.0 (321 KB) by

MATLAB class for reading, viewing 3D dxf and 3ds files.

16 Ratings



View License

This is a MATLAB class that allows the user to read in Autocad (.dxf) and 3D Studio Max (.3ds) files.

The class can be plotted and functions are included for simple model manipulation (translation, rotation, magnification, superposition)

Comments and Ratings (31)

The function model3d is empty

Imran Anees

The model3d function is not present in this code.


Paul (view profile)


Alireza (view profile)


Alireza (view profile)

Guys, find newer version here:


Nick (view profile)


carlos (view profile)


I'm working on MATLAB 2013a 64-bit on windows and I cannot get to use the library, I tried to recompile but I get all sorts of error. I fianlly managed to mex the code but loading the library doesn't work.
The error I get is like this
Type 'intclassModel3D{public:' was not found. Defaulting to type error.

ANy help?


John (view profile)

I downloaded the Model3d matlab functions, but had trouble getting it to work. It seems as if the model3d.m file is all comments without any coding in its contents.

I understand this may be a bad question, but I do not have much programming experience, so I was wondering if anyone could help me with a step my step procedure of what needs to be done to get this program working.


Bruno (view profile)

in Matlab r2011b I try to excecute the command but I receive this error:
"Error using class
The CLASS function must be called from a class constructor." I guess I have to recompile it... Isn't it? How can I do it? Thank you very much!


Jonas (view profile)

Grant Lohsen

I can't get this to run on windows. I get the error "??? Undefined function or method 'model3d' for input arguments of type 'char'". I noticed that this includes .mexglx files, and i believe this is linux files. Does anyone have the mexw64 files so I can run this? alternatively, is there a free compiler I can put on my system to compile this?

Matlab R2008b

"Also, "int dims[3];" should be changed to "mwSize dims[3];" to make it compile."

- In the mexfunction.cpp, row 211, that is

Here is what I changed in the makefile to get the compilation working on Linux64; The first rows in the makefile now looks as follows:
TARGET = ../model3d.mexa64
TARGET2 = ../serialize.mexa64
SOURCES = dxf.cpp mexfunction.cpp model3d.cpp c3ds.cpp
MATDIR = /opt/matlab
#CXX = icpc
#CXXFLAGS = -gcc-version=320 -cxxlib-gcc=/usr/local/gcc-3.2.3 -O3 -xN -w1
#CXX = /usr/local/gcc-3.2.3/bin/g++
CXX = g++
CXXFLAGS = -O3 -Wall -fPIC
LIBDIR = -L$(MATDIR)/bin/glnxa64

Note that you probably should adjust the matlab path.

Also, "int dims[3];" should be changed to "mwSize dims[3];" to make it compile.

Best Regards,
Jonatan Olofsson


Markus (view profile)

It is working nicely. But I have problems to run the rotation by using qrot(m,pi/2,pi/2). Or even if I load the qrot3d function from the file exchange it didn't work out. Does anybody have experience with this functions or can give me a hint how to use. Thanks a lot.

John D'Errico

John D'Errico (view profile)

greg is wrong here. The old style OOP methods still work nicely in current matlab releases.


Greg (view profile)

This code uses old-style (pre-2008a, I believe) object-oriented programming. As far as I can tell, that makes it pretty much non-functional in any newer version of Matlab.


Thanks for the great model3d script .

However, it behaves strangely for certain 3ds files.

For example, the following maxda3 3ds model purchased from,

was rendered as shown in

(Note: the wheels and fenders are in the wrong place)

It renders correctly in 3D MAX.

Am I missing something?

Thanks in advance


Upgraded to 2008b and it stopped working. Couldn't fix it myself. Please update and I will change my rating.

Nikhil K

Very nice. Worked right away with just two lines of code and a 3DS model. Is there existing/planned support for animation, i.e. frames?


Bhavik (view profile)

I am beginner in MATLAB please tell me how to run this file..

Jon Beich

Model.m file is only remarks... can't use anything else without the model


The code produced a model3d object, but was not able to plot it as it gave an error saying that the alpha value must be within 0 and 1.
A sample 3ds file that worked for the author could have been better to evaluate the functioning of this code.
A better readme would have been nice.

Paul Foxgrover

Very helpful. Works Great!

Scott B.

Sorry but for me this code was unreliable for dxf files produced by any version of autocad. I like the fancy class wrapper but you might want to reconsider your claims for dxf files. I'll revisit this and upgrade my review if you can sort out the dxf problems.

Lijun Yan

thank you for your share, but there is nothing in model3d.m

Nory chemii

My friend introduced me to MATLAB when i search software for make 3D graphics with 3 values of X, Y and Z. I hope i can use MATLAB

Justin Barnes

Worked great for me on 3ds but had dxf trouble

olivier PROT

Very Nice ! Have some problems with .3ds files but it works well with .dxf.

Christian none

Sorry, the last entry was a mistake. But this one is what I meant!

MATLAB Release
MATLAB 7.0.4 (R14SP2)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today