link Catia to Matlab
Show older comments
Hi I'm try to connect Matlab to Catia creating a Catia COM server using the command:
C=actxserver('Catia.Application')
C =
COM.Catia_Application
but after this i can't do anything because matlab doesn't know the catia's properties, infact I tried to used the function:
C.get
I obtain the answer:
1x1 struct array with no fields.
And so i can't use any Catia's functions.
What can I do ?
1 Comment
supriya la
on 20 Dec 2018
You can refer some youtube videos.
Accepted Answer
More Answers (8)
Friedrich
on 6 Sep 2011
4 votes
Hi,
The communication with CATIA is tricky. The automation interface is not open so you won’t be able to see it. Even from Visual Basic you can’t see much. So you have to program blind.
The interface which CATIA provide can be found here:
You have to work with the set,get and invoke command from MATLAB to call these functions/ methods (e.g. set(C,'visbile',1))
But not all methods will work, e.g. GetInertia
The input is a passed by reference and MATLAB won’t recognize this and won’t return the values.
I think the best way here is to use VB.net and create a .NET DLL which handles the communication with CATIA. You can use this DLL in MATLAB than. In that way are not limited on the MATLAB side.
3 Comments
Raluca
on 21 Feb 2013
Hi,
I am interested also in linking Matlab and Catia. Since it has been a while since the last posts on this topic, could you tell me please if you managed to resolve the problem without having to use an .NET DLL?
farzad
on 22 Jan 2014
I am really in search of linking Matlab to Catia to pilot the parameters , or it's better to link MATLAB >> EXCEL >> CATIA ?
Jakob Pettersson
on 7 Mar 2018
Hey!
I am also searching for a way to change the parameters in Catia through Matlab. I am also thinking about linking Matlab to Excel to Catia like farzad suggested.
Have you learned anything about this topic farzad?
Alessio
on 10 Sep 2011
Alessio
on 10 Sep 2011
0 votes
1 Comment
Friedrich
on 12 Sep 2011
Hi,
why the VB code when you use ML for communicating with CATIA?
Looking at the interface discription of AddComponentsFromFiles it seems you forget an inputargument:
http://www.catiadesign.org/_doc/catia/catia_vb/generated/interfaces/ProductStructureInterfaces/interface_products.htm#AddComponentsFromFiles
So I would guess it should like this:
cubo=invoke(prods1,'AddComponentsFromFiles','D:\LELE\Università\TESI\PROVE\cubo.CATPart','All');
In addition you will get troubles with the CATSafeArrayVariant datatype on the CATIA side since "CATSafeArrayVariant are one-dimensional arrays of CATVariants.":
http://www.catiadesign.org/_doc/catia/catia_vb/generated/interfaces/System/typedef_catsafearrayvariant.htm
MATLAB passes 2dimensional arrays by default. To get MATLAB passing only one dimensional arrays you have to enable it through:
feature('COM_SafeArraySingleDim', 1)
But all this code I would do in the VB side and not on ML.
Hello,
This topic was very useful!
I got a matlab script which sets parameters into CATIA and then saving it. But CATIA doesn't update the parameters before saving. I tried to update the CAD model in MATLAB thanks to :
invoke(catia,'update')
But that didn't work. Does anyone has an idea? Thanks a lot!
yasmine yas
on 9 May 2016
0 votes
heloo plllz help me How can i import design in catia to matlab simulink i found programme which is called SANEON but i don't how it does work . Thank you
Categories
Find more on Performance and Memory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!