File Exchange

image thumbnail

IGES Toolbox

version 1.7 (291 KB) by

Toolbox for working with IGES CAD-models in Matlab



View License

The Matlab function "iges2matlab" extracts parameter data in an IGES file into Matlab. Other functions in the toolbox do plots, transformations, projections etc. All users must first compile the C-source code. This is done in Matlab by running

and the mex-functions are compiled.

Comments and Ratings (64)

Edward L.

??? Undefined function or method 'delaunayTriangulation' for input arguments of type

Amy Gao

Fixed the previous error - this seemed to be specific to Mac OSX 10.12+. With R2016a/b, mex is not configured correctly. To fix I referred to: Once mex is working correctly, the examples run perfectly!

Amy Gao

I tried to run example1, but it throws an error:
Undefined function or variable 'crvPntsSrfNURBS'.
Error in iges2matlab>retPsCrvLength (line 4721) [~,le2,evmethd]=crvPntsSrfNURBS(n,ParameterData{srfind}.nurbs,ParameterData{ParameterData{ind}.de(i)}.nurbs,ParameterData{ParameterData{ind}.de(i)}.v(1),ParameterData{ParameterData{ind}.de(i)}.v(2));
Error in iges2matlab (line 3009)

I tried a few other things that did not work either, so I'm guessing an update is required.


Eyma (view profile)


i tried to run example2, but received such errors.

Undefined function or variable 'nrbSrfRegularEvalIGES'.

Error in iges2matlab (line 3045)
Error in example2 (line 7)

for the first error, does it means that nrbSrfRegularEvalIGES.c cannot compile under win64 platform?

i don't know what is wrong with the second error. gosh!


Eyma (view profile)

hi all

can someone tell me how to input/load the iges file to the m file? for example, i wanted to use iges2matlab file, but i do not know how to load my iges file. i tried couple of times, but still unable to run the function. please help me on this please. thanks.

Chris Hooper

made some edits to include layer information. what is the best way to share them?

Chris Hooper

excellent. using it with nurbs from rhino. is there a way to access layer information as well?

Irwin Gan

any solution for 'nrbevallGES' error? delting -v did not work

I've tried with removing all "-v" but it still has the error message: Undefined function or variable 'nrbevalIGES'

Matteo Bottin

In order to remove all "nrbevalIGES" errors I discovered this workaround:

1) Open "makeIGESmex" file
2) remove all "-v" inside the "try" structures.



Rick (view profile)

The error messsge:
   Undefined function or variable 'nrbevalIGES'
Happens if the MEX files were never built.
The command that builds then 'makeIGESmex' instantly with no output that means it failed silently. The try-catch blocks hide the error messages. CD to the directory where the toolbox files live.

To find the home directory type:
  which makeIGESmex

Once I built the MEX files the MEX files I could load IGS files using 'iges2matlab' but the next problem is that my file contains unsupported entity types:
  190 'Plane Surface'
  502 'Vertex Entity'
  504 'Edge Entity'
  508 'Loop Entity'
  510 'Face Entity'
  514 'Shell Entity'
  186 'Manifold Solid B-Rep Object Entity'
  192 'Right Circular Cylindrical Surface'
At which point I have to give up for now.

I would like to use optometrika toolbox to simulate light tracing. So I need to input a complex 3D drawing. IGES toolbox can support me to input the file?


Mark (view profile)

ignore previous comment -(wrong toolbox).


Mark (view profile)

The subroutine matlab2iges.m does not seem to work for other than uniform weighting (e.g. does not work for surfaces with an edge that is a circular arc). Is there an easy fix for this???


Matfun (view profile)

Saaddin Nur

Firstly, I want to appreciate the author of Iges toolbox since it helps me very much for importing geometry from CAD without reducing its quality especially for curve.

Then, how to access the geometry properties of Iges file like vertices, faces and parameters of curve after importing it in Matlab?
Because, so far I just got the plot of geometry of Iges in Matlab and didn't get its properties.

My purpose is to import Iges in Matlab and meshing it using DistMesh in Matlab.


amina lk

how to run more nurbs surf to one iges file

WenLuo Lau


i have tried using the toolbox but i encounter an error while running example.m

Undefined function or variable 'nrbevalIGES'.
Error in iges2matlab (line 938)
Error in exampleICP (line 12)

how can i solve the nrbevalIGES as it is a function?


I would like to use this iges toolbox to convert iges files to matlab or stl files to matlab and then using the function "getSurfaceDistributedPoints".
But the outputs of these functions are not compatible with the inputs of "getSurfaceDistributedPoints". Can you help me please ?



nrbSrfRegularEvalIGES.c doesn't compile on windows 64 bit.
It tries to compile a few minutes, but then matlab gives the error 'Error using mex
Matlab builds it with Microsoft Visual C++ 2012 (C).

Any ideas to solve this?


In the function of closestNrbLinePointIGES.c ,


what is the mean of r0??

Great Work,
It might be very simple, But I don't know!!!
I have a curve and I want to extract uniformly distributed points from that curve.( Start with start point and end with the End Point) Lets say dividing the curve to the "n" consequent segments.
I used the following function:
for i=1:length(ParameterData)
However it doesn't give me the end point of the curve.
is there any way to solve this issues?


Great Work and effort. Really useful!


  mex -v nrbSrfRegularEvalIGES.c

  I cannot compile this file.
  How to solve it?

  please, let me know

The toolbox works pretty great. I wanted to know is there a possibility to obtain coordinates on the iges surface. I would like to get the coordinates in regular interval. The basic idea is to estimate the data loss during data points to NURBS conversion.
Thank you!

Im new to matlab. Can someone please let me know how to use this ?


im using matlab on mac and im confused where to put the Precompiled mex-functions for win64 files

Zubair Rafiq

Thank you very much , I really appreciate your effort.

After a LOT of trouble to install the C compiler (mex command) on Windows 8.1 64bit, example.m work but not example2.m. It seem that I got the same problem as TCH and nrbSrfRegularEvalIGES.c refuse to compile under Win 8.1 64bit.


I have tried this solution and it works for me... check this link

rohan vaidya


hello there,
i'm a new user, so please i need to know how to run this tool box in matlab

I'm using the function iges2matlab and it's very useful but I'm wondering if there is an inverse function that already extracted parameter data will transform into an iges file (matlab2iges)? :)


TCH (view profile)

nrbSrfRegularEvalIGES.c cannot compile under win64 platform

Thanks for creating the IGES Toolbox. I'm trying to use it to read a truck IGES model (58729_Cement_Truck_NURBS.iges downloaded from and there's something funny about both ends of the trunk when the model is displayed (see problem here Looks like something wrong with trimming the sphere surfaces. Any ideas/suggestions?? The model displays OK in Rhino.


I have the exact same problem as Daniel.


Daniel (view profile)

how do I run the examples, do I just type in "example2" and thats it ? because I allways get this errors:

Trial>> example2
Undefined function 'nrbSrfRegularEvalIGES' for input arguments of type 'struct'.

Error in retSrfCrvPnt (line 43)
Error in plotIGES (line 221)

Error in example2 (line 11)

I'm new to all this and I couldn't finde a solution jet.

Thank you in advance.



shi (view profile)

thans...i am new in this aspect and donot know how use it now


Brian (view profile)

Is anyone else getting an error when trying to open an iges file?

Undefined function 'nrbevalIGES' for input arguments of type 'struct'.

Error in iges2matlab (line 628)
        p =
Error in igesToolBoxGUI>menuOpenIGES_Callback (line 419)
Error in gui_mainfcn (line 96)

Error in igesToolBoxGUI (line 42)
    gui_mainfcn(gui_State, varargin{:});

Error in

Error while evaluating uipushtool ClickedCallback


Adam (view profile)

Great code! Thanks!


very good


NTUT (view profile)

when i run('C:\Program Files\MATLAB\R2007b\toolbox\IGES\makeIGESmex.m')

  Could not find the compiler "cl" on the DOS path.
  Use mex -setup to configure your environment properly.

how to solve this problem

Luis Acevedo

It is working now. I had a corrupt file in my comp . Good toolbox :-)

Luis Acevedo

Which type of compiler do i need?
C what? send me link

I have got the same problem than LuisCarlos, Liu and so on with a 64bits machine. fatal error LNK1104: 'nrbevalIGES.mexw64

Would be nice an update soon!

:) I can use it, it works great!!

thank you

Hi everybody! Please somebody can help me? when execute makeIGESmex i read this
LINK : fatal error LNK1104: no se puede abrir el archivo 'nrbevalIGES.mexw64'
I run it on 64bits corei7 and I cant use IGEStoolbox.

Hi everybody! Please somebody can help me? when execute makeIGESmex i read this
LINK : fatal error LNK1104: no se puede abrir el archivo 'nrbevalIGES.mexw64'
I run it on 64bits corei7 and I cant use IGEStoolbox.


liu (view profile)

I am using these code. It is very good.

Now, We are waiting for Mr. Per to Add a new function "getpointfromIGES".
Hope we can get update soon.



Trying to import some IGES files but i get the following warning: Warning: There are unknown entity types for iges2matlab file.
Use "I-DEAS 3D IGES Translator" with NURBS as surface representation instead.
If you dont have that posibility you can add IGES entities into iges2matlab().
The IGES manual is found at

IGES files are not shown properly. How to add IGES entities into iges2matlab()


Oscar (view profile)

Can somebody told me, how to do the opposite. I have a 3D figure generated in Matlab, but I need the figure in IGES or another CAD extension.


kunal (view profile)

Hi, all

I am using NURBS Toolbox and IGES reader for MATLAB. The IGES reader is supposed to read IGES files from CAD softwares and extract geometric info from it. When i try to extract entities 126 and 128 (which correspond to NURBS Curves and surface). I am getting inconsistent results.

for example.

when extracting NURBS from a Cylinder IGS file from solidworks, I am getting no surface at all. When i use Rhino 3D i get a nurbs surface which looks like a cylinder but it's not Circular in shape like the IGES file.

I need to extract a proper NURBS surface that looks exactly like the IGS file


Is it 2D plot only??

Ernest West

I have the same question above. I just want to be able to obtain the data points of a simple rectangle from IGES to matlab

Can you provide a little more infomation on the application of retSrfCrvPnt. I am trying to extract an array of data for a surface i have imported. Many thanks

By ?

By ? (view profile)

Thank you,this is a great job

ricky martin

Jose M.

fantastic job!!! thank you very much

alloucherie franck


Kava Crosson

Needs better documentation about projection parameters. Otherwise very impressive.

bruce bi

This is what I need. Thank You!

Petr Volegov

Need bspeval.dll for Windows x64. Could you please submit the source files too?

Paolo Bertolo

Fantastic job!
I've just opened a CATIA CAD file, converted into IGES using Hypermesh and then loaded it into Matlab. That's great!



Some functions have been improved.


The toolbox are now compatible with more IGES-entities


More entities are added, a GUI is developed, more examples are attached.


2 old m-files are replaced by:


One more example is added, plotIGES draws surfaces faster using patch().


Mesh2d is used for meshing the surfaces.

The projection is better documented by adding an example.

Have added some entities.

Have done some small improvements.

Have added the source code to bspeval.

Have done some small improvements.

Makes the previous update complete.

Have done a small improvement.

Have added a function.

Have added a function.

MATLAB Release
MATLAB 8.5 (R2015a)

Inspired by: Nurbs2IGES

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

» Watch video