View License

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

» Watch video

Highlights from

3.1 | 16 ratings Rate this file 38 Downloads (last 30 days) File Size: 321 KB File ID: #7940 Version: 1.0
image thumbnail



Steven Michael (view profile)


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 (31)
11 Oct 2016 Luca Roncarati

The function model3d is empty

11 Jul 2016 Imran Anees

The model3d function is not present in this code.

Comment only
16 Oct 2015 Paul

Paul (view profile)

03 Aug 2015 Alireza

Alireza (view profile)

17 Apr 2015 Alireza

Alireza (view profile)

Guys, find newer version here:

Comment only
12 Feb 2014 Nick

Nick (view profile)

11 Nov 2013 carlos

carlos (view profile)

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?

Comment only
13 Mar 2012 John

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.

Comment only
17 Nov 2011 Bruno

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!

Comment only
29 Sep 2011 Jonas

Jonas (view profile)

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

Comment only
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

Comment only
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

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.

Comment only
23 Jun 2010 John D'Errico

John D'Errico (view profile)

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

Comment only
23 Jun 2010 Greg

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.

Comment only
23 Mar 2010 Srimal Jayawardena

This is the link to the screenshot.



Comment only
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


Comment only
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

Bhavik (view profile)

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

Comment only
06 Aug 2009 Jon Beich

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

Comment only
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

Comment only
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