Code covered by the BSD License  

Highlights from


3.2 | 13 ratings Rate this file 62 Downloads (last 30 days) File Size: 321 KB File ID: #7940
image thumbnail




28 Jun 2005 (Updated )

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

| Watch this File

File Information

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)

MATLAB release MATLAB 7.0.4 (R14SP2)
Other requirements the file includes compiled MEX functions for Linux and Windows. The source is included so that it can be compiled on other platforms. A version will be uploaded soon that works on MAC platform.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (26)
12 Feb 2014 Nick  
11 Nov 2013 carlos  
23 Jun 2013 Mohamed

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?

13 Mar 2012 John

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.

17 Nov 2011 Bruno

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!

29 Sep 2011 Jonas  
22 Apr 2011 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

26 Mar 2011 Jonatan Olofsson

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

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

26 Mar 2011 Jonatan Olofsson

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

04 Oct 2010 Markus

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.

23 Jun 2010 John D'Errico

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

23 Jun 2010 Greg

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.

23 Mar 2010 Srimal Jayawardena

This is the link to the screenshot.



23 Mar 2010 Srimal Jayawardena


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


21 Jan 2010 Paul Foxgrover

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

19 Jan 2010 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?

18 Oct 2009 Bhavik

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

06 Aug 2009 Jon Beich

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

10 Jun 2009 Gayathri

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.

28 Jul 2008 Paul Foxgrover

Very helpful. Works Great!

09 Mar 2008 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.

20 Dec 2007 Lijun Yan

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

19 Nov 2007 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

27 Sep 2006 Justin Barnes

Worked great for me on 3ds but had dxf trouble

26 Apr 2006 olivier PROT

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

23 Sep 2005 Christian none

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

Contact us