File Exchange

image thumbnail


version 1.0 (3.83 MB) by

This code allows one to convert a NURBS Surface to an IGES surface file for import into a CAD progra



View License

This code allows one to convert a NURBS Surface to an IGES surface file for import into a CAD program. Entity 128 is used and is the only entity type output. NURBS curves could be output with some modification. This code is rough but works for what I am doing.

Attached IGES format guidelines to help understand it. All the lines (in the *.igs file) on the right MUST line up or the file will not open up.

Comments and Ratings (9)


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???


I am very new to nurbs2IGES.I have just generated a 3d image in matlab,i want to convert it into iges so that i can model it in CAD softwares.Any one please help me how to start with it

Michael Weise

I found the problem with circular arcs. The coefficients are multiplied with the weights in the nurbs toolbox, which is not accounted for in nurbs2iges. Fix: Replace line 203 NrbSurf.coefs(1,V,U), NrbSurf.coefs(2,V,U), NrbSurf.coefs(3,V,U));


NrbSurf.coefs(1,V,U)./NrbSurf.coefs(4,V,U), NrbSurf.coefs(2,V,U)./NrbSurf.coefs(4,V,U), NrbSurf.coefs(3,V,U)./NrbSurf.coefs(4,V,U));

I am wondering Fa if you got somewhere with your problem. I am having a trouble also with a circular shapes.

I was also wondering if someone could inform me if I could increase the accuracy of the imported part. Since in matlab the NURBS surfaces follow the geometry I want to export quite well but in my cad software the accuracy is not that good. I have tried the G{19,1} block but it does not seem to have the required effect.

Thank you


Fa (view profile)

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 !

Lee byan

i found the same question with Roland, it seems that the length of output file name should be equal to 11.

i just simply rewrite the code instead the original code line numbered 152~155 using the following code:

tstr = sprintf('%1.0fH%s,', G{1,2}, G{1,1});
tstr = [tstr,sprintf('%1.0fH%s,', G{2,2}, G{2,1})];
tstr = [tstr,sprintf('%2.0fH%s,', G{3,2}, G{3,1})];
tstr = [tstr,sprintf('%2.0fH%s,', G{4,2}, G{4,1})];
fprintf(fid, '%s',tstr);
len_tstr = length(tstr);
for kk = 1:(72-len_tstr)
fprintf(fid, ' ');
fprintf(fid, 'G%07.f\n', Gln); Gln=Gln+1;


Roland (view profile)

it happens that the end line delimiter (?) "G0000001" of the second line does not align with the other delimiters, than some CAD programs (like freeCAD) can not read the iges file. In this case, I just edit the iges file manually, but it would be good to make the output more robust.


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

Nice Work!
A few question:
-Do you know how to create triangular NURBS patches?
-How to export multiple surfaces in the same file?


MATLAB Release
MATLAB 7 (R14)

Inspired: igesout, IGES Toolbox

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