File Exchange

image thumbnail


version (5.58 KB) by Daniel Claxton
Convert surfaces, curves and lines to IGES file


Updated 08 Mar 2009

No License

IGESOUT converts nurbs surfaces, curves and polylines to a single compact IGES format file.

Vectorizing was implemented wherever possible, so the code should run quickly.

It was verified by ProE and MasterCam.

Cite As

Daniel Claxton (2020). igesout (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (39)

It is working fine with Inventor, however, when I try to import it to Abaqus it says the file is corrupted (also using THC's fix).


G-section order, something wrong, you need to reorder the G.reveiveid after G.significant2 according iges specification version 6.0

Boya Deng

Can anyone give me an example of exporting curves from data to iges file?
Thank you very much.

Daniel Turk

The code works using nurbs and abaqus using the test example.
It doesn't work for solidworks, even using the bugfix proposed by THC.
It doesn't work not using nurbs with abaqus using the test example.

Also the bugfix proposed by THC gives an error of invalid '=' operator. Wondering if it works by removing the '+' of the code line.

337 G = setfield(G,lower(p{i,1}),p{i,2});

instead of
337 G = setfield(lower(G,p{i,1}),p{i,2});

so you cannot set any parameter because of syntax error
now you can for exampleset units to mm with:
igesout({pline lin pt},'TestIGES',{'units','MM'})

Why I cannot use the command( IGESOUT(srf,'test','units','MM') to modify the default unit to MM,I want to change the default unit to MM,Could you help me please...

Why I cannot use the command( IGESOUT(srf,'test','units','MM') to modify the default unit to MM,I want to change the default unit to MM,Could you help me please...

In inventor, be sure to select the "composite" option when importing TSTRuled.igs or the likes Otherwise the surfaces will be patched in an inaccurate way. Otherwise the functions works great! Thanks!

Now I just have to figure out how to make nurbs surfaces, but the examples are great.

importing into inventor works but the shape (composite) does not maintain certain continuity boundaries and so the imported .iges nurbs doesn't match the evaluated nurbs exported as an stl (consistent with nrbplot).

I'm not sure if this is an inconsistency with Autodesk inventor or just the example.

Di Zhu

Di Zhu

Xiaoxiao Du

Di Zhu,
ABAQUS could also read iges files, please use commands 'File->Import->Sketch/Part'.

Di Zhu

Rhino could read the igs file, but Abaqus couldn't...

I found an error in the code: The coefficients are multiplied with the weights in the nurbs toolbox, which is not accounted for in igesout. Possible fix: Change line 171

Coefs = [X(:) Y(:) Z(:)]';


Coefs = [X(:)./W(:) Y(:)./W(:) Z(:)./W(:)]';

Furthermore, the (R) sign after 'Matlab' in line 118 seems to cause problems with some readers, I replaced the line by

G.sendid = 'MatlabR'; % Product ID from Sender


I had this problem, check the G section.
There is something wrong.



I tried running an example. The IGS file is created but Autocad says it is invalid/cannot be read.
Any solution?


Am I the only one having problem with circular shapes ?
When I use democirc.m then nrbplot.m I have a good result but if I try to export it int the iges format it does not look the same.

Thank you !


!!!!!!!!!!!---------BUG REPORT--------!!!!!!!!!!!!!!!

for anyone who would download this code please revise the code in function wrapmat:
@code revision start:
387 nsrt = nchar-size(str,2);
388 if nsrt
389 % str(:,end+nsrt) = ' '; // comment this phrase
389 +str(:,end+1:end+nsrt)=' ';
390 end
@code revision end
the original code directly assign a space to the end+nsrt position of current line, the jumped spaces will be left to the null characters which is a fatal error according to the IGES file standard.
Hope you a nice use!


I need to get lots of cylinders into Iges format for Ansys meshing. Unfortunately this does not work for me.

Lee byan

seemed to run fine, but the output iges file seemed to be wrong and can not be read in ug,
i just used the example in the code as following,
pline = [0,0,1.1112;0,1.3333,2.1082;0,2.6667,1.6397;0,4,1.3346;];
lin = pline(1,:)*3;
pt = pline(1,:);
igesout({pline lin pt},'TestIGES')

the TestIGES.igs is as following:

Matlab to IGES converter. Written by Daniel Claxton S0000001
1H,,1H;,7HMatlab ,11HReceiver ID,12HTestIGES.igs,5HPCWIN, G0000001
14HMatlab -> IGES,16,6,15,13,15,1,3,2HIN,8,0.016000, G0000002
20H24-Apr-2012 19:54:21,0.000100,4, G0000003
27HD. Claxton,21HUniversity of Florida,11,3, G0000004
20H24-Apr-2012 19:54:21; G0000005
106 1 0 1 0 0 0 1D0000001
106 1 0 3 12 0D0000002
116 4 0 1 0 0 0 3D0000003
116 1 0 1 0 0D0000004
116 5 0 1 0 0 0 5D0000005
116 1 0 1 0 0D0000006
0.000000,2.666700,1.639700,0.000000,4.000000,1.334600,0., 1.,
0., 1.;
116,0.000000,0.000000,3.333600,0., 1., 0., 1.;
116,0.000000,0.000000,1.111200,0., 1., 0., 1.;
S0000001G0000005D0000006P0000005 T0000001


Seemed to run just fine, but ANSYS can't read it. NrbsSrf2IGES produces IGES that can be read.


Mark Gordon

I'm trying to convert point cloud data (from a Kinect) to iges to import into Rhino (and then to Solidworks).

I put my data in to X, Y, and Z columns and the function appears to run successfully. However, when I try to import this file into Rhino it says: "Rhino found nothing to import from this IGES file.
This happens when an IGES file has no valid independent geometry."

Any thoughts on what is going wrong?


Could you add a simple example of surf (or mesh) to iges conversion?

Thank you for this excelent job!
Is it possible to create two curve separately?
Because by default it will connect the 2nd curve to end of the 1st one.



Hey, thanks a LOT for posting this, you saved me days of work.

I was wondering: I have a binary tube structure geometry (so just a series of connected cylinders), and I was wondering if this can be used with your tool to export it into a IGES format. Would you expect there to be any conflicts?

Probably I'm just not good enough with the "igesout" code but I'm wondering how a bit more complex structure, e.g. surface with holes, could be exported? For example, I tried to export the 2D geometry from the demos of the nurbs toolbox "demogeom.m". This one consist out of multiple nurb curves... I just can't get it running :( Any suggestions? Thanks!


I had trouble with changing the units from 'IN' to 'MM'. I had to remove {:} after vargin in the call to setParams. Also, inside of setParams, I moved G to be outside of the 'lower' function. I'm using V7.7, so maybe it used to work this way in a previous version.


It is really an excellent code. However, when I try to create a large geometry, it is still time consuming. The function 'swap' excutes too many string copy in the 'while' loop and it cost much time when there are a mount of data points. I rewrote the function as follow and the it only needs 1/3 time.

function s = wrap(str,delim,n)
tmp = blanks(n);
strlength = length(str);
i = 1;
while (strlength-index+1>n)
tmp = str(index:index+n-1);
d = strfind(tmp,delim);
d = d(end);
index = index + d;
s(i,:) = [tmp(1:d) blanks(n-d)];
i = i+1;
if (strlength-index+1>0)
s(i,:) = [str(index:strlength) blanks(n-(strlength-index+1))];

Daniel Claxton

I have received several questions asking about the reverse process iges conversion ie read an iges file into Matlab. Someone has already submitted a handy toolbox that does just that. You can find it here:

Kian Chai

Are you able to do vice versa? I am sure you understand the IGES code before you create this program. I am trying to understand the IGES structure. Can your code write out the boundary points to represent a surface? It would be great to import this point into Excel to show the figure. Generally I would like to import IGES data as the data points in the array then I can plot it into Matlab figure.

Michael Fassbind

A very good and useful improvement to my initial offering. I use your code now.

Johannes Korsawe

This is perfect! Thank you a lot for doing the ugly work of going through the syntax of IGES.

Wenbin Chen

thanks,it works well in UG!

johnny chen


Daniel Lopes

Works brilliantly! Thanks a lot!
CUBIT ( is also capable to import the *.igs file created by igesout(.).

Just one remark:
At line 136,
" = datestr(today); ",
I had to change 'today' -> 'date', since MATLAB apparently doesn't recognize 'today'.

c m

Really fast.
I used it to get a surface model from a coordinate measuring machine.
Now if only I could get it into Solidworks properly!


- Major improvements in write speed for large files
- Minor enhancements to version number

MATLAB Release Compatibility
Created with R2006b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Nurbs2IGES