File Exchange

image thumbnail

IGES Toolbox

version 1.7 (291 KB) by

Toolbox for working with IGES CAD-models in Matlab

4.33333
33 Ratings

87 Downloads

Updated

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
makeIGESmex

and the mex-functions are compiled.

Comments and Ratings (68)

Faez Alkadi

Great work!!!

I just have 2 QUESTIONS:
1- in projpartIGES.m, is there anyway I can make dp (the distance between the projected points) for primary direction different than pd for secondary direction ?
2- In offsetIGES.m, how can we determine (dir) to be positive ?

Thank you so much

I am not sure why, but none of the examples work for me. I get the following error for exampleall.m:
Undefined function or variable 'nrbevalIGES'.

Error in iges2matlab>endPoints (line 4597)

Error in iges2matlab>makeContinous (line 4536)

Error in iges2matlab>unDoSupMkC (line 4521)

Error in iges2matlab (line 2660)

Error in exampleAll (line 12)
[ParameterData,EntityType,numEntityType,unknownEntityType,numunknownEntityType]=iges2matlab('IGESfiles/example.igs');

Error in run (line 86)
evalin('caller', [script ';']);

Running the first example, I get the following error...

Error using nrbSrfRegularEvalIGES
Requested 12884901926x80 (3840.0GB) array exceeds maximum array size preference. Creation of
arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See
array size limit or preference panel for more information.

Error in retSrfCrvPnt (line 257)

Error in plotIGES (line 253)

yuan gao

Is there any explanation on the cell array "ParameterData" and its elements?

Edward L.

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

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: https://www.mathworks.com/matlabcentral/answers/303369-mex-cannot-find-a-supported-compiler-in-matlab-r2015b-after-i-upgraded-to-xcode-8-0. 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)
ParameterData=retPsCrvLength(ParameterData{i}.sptr,ParameterData,i,75);

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

Eyma

Eyma (view profile)

hi.

i tried to run example2, but received such errors.

Undefined function or variable 'nrbSrfRegularEvalIGES'.

Error in iges2matlab (line 3045)
P=nrbSrfRegularEvalIGES(ParameterData{i}.nurbs,ParameterData{i}.u(1),ParameterData{i}.u(2),nu,ParameterData{i}.v(1),ParameterData{i}.v(2),nv);

Error in example2 (line 7)
[ParameterData,EntityType,numEntityType,unknownEntityType,numunknownEntityType]=iges2matlab('example2.igs');

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

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.

Enjoy

Rick

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

Mark (view profile)

ignore previous comment -(wrong toolbox).

Mark

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

Matfun (view profile)

Saaddin Nur

Hello,
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.

Thanks,
Saaddin

amina lk

how to run more nurbs surf to one iges file

WenLuo Lau

hello,

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)
[ParameterData,EntityType,numEntityType,unknownEntityType,numunknownEntityType]=iges2matlab('piece.igs');

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

Hi,

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 ?

Thanks

knutsel

Hey,
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
nrbSrfRegularEvalIGES.c'.
Matlab builds it with Microsoft Visual C++ 2012 (C).

Any ideas to solve this?
Thanks

IL HYUK AHN

In the function of closestNrbLinePointIGES.c ,

[P,UV]=closestNrbLinePointIGES(nurbs,dnurbs,d2nurbs,UV0,r0)

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:
DataMatrix=[]
for i=1:length(ParameterData)
[P,isSCP,isSup]=retSrfCrvPnt(2,ParameterData,0,i,n,3);
DataMatrix=[DataMatrix;P'];
end
However it doesn't give me the end point of the curve.
is there any way to solve this issues?

haitham

Great Work and effort. Really useful!

IL HYUK AHN

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 ?

Wenzhen

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.

mostafa

I have tried this solution and it works for me... check this link
http://www.mathworks.com/matlabcentral/answers/101105-how-do-i-install-microsoft-windows-sdk-7-1

rohan vaidya

mostafa

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

Hello,
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)? :)
Thanks

TCH

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 http://www.3dcadbrowser.com/download.aspx?3dmodel=58729) and there's something funny about both ends of the trunk when the model is displayed (see problem here https://dl.dropboxusercontent.com/u/78384338/truck.png). Looks like something wrong with trimming the sphere surfaces. Any ideas/suggestions?? The model displays OK in Rhino.

Sabrina

I have the exact same problem as Daniel.

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
example2.igs
Undefined function 'nrbSrfRegularEvalIGES' for input arguments of type 'struct'.

Error in retSrfCrvPnt (line 43)
[P,UV,TRI]=nrbSrfRegularEvalIGES(ParameterData{ind}.nurbs,ParameterData{ind}.u(1),ParameterData{ind}.u(2),n,ParameterData{ind}.v(1),ParameterData{ind}.v(2),n);

Error in plotIGES (line 221)
[P,isSCP,isSup,TRI]=retSrfCrvPnt(1,ParameterData,1,i,subd);

Error in example2 (line 11)
plotIGES(ParameterData,2,1,30);

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

Thank you in advance.

Danny

shi

shi (view profile)

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

Brian

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 =
nrbevalIGES(ParameterData{entiall}.nurbs,linspace(ParameterData{entiall}.v(1),ParameterData{entiall}.v(2),nup));

Error in igesToolBoxGUI>menuOpenIGES_Callback (line 419)
[ParameterData,EntityType,numEntityType,unknownEntityType,numunknownEntityType]=iges2matlab([path,file]);

Error in gui_mainfcn (line 96)
feval(varargin{:});

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

Error in
@(hObject,eventdata)igesToolBoxGUI('menuOpenIGES_Callback',hObject,eventdata,guidata(hObject))


Error while evaluating uipushtool ClickedCallback

Adam

Adam (view profile)

Great code! Thanks!

Yongxing

very good

NTUT

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

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.

Thanks!

Razmara

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

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

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

Snahungshu

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

good

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!

Updates

1.7

Some functions have been improved.

1.6

The toolbox are now compatible with more IGES-entities

1.5

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

1.3

2 old m-files are replaced by:
nrbevalIGES.c
closestNrbLinePointIGES.c

1.2

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

1.1

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)
Acknowledgements

Inspired by: Nurbs2IGES

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

» Watch video