Matlab-Catia-Link with Matlab2024b

9 Ansichten (letzte 30 Tage)
Philipp Jäger
Philipp Jäger am 7 Mär. 2025
Kommentiert: Philipp Jäger am 12 Mär. 2025
I have successfully used the Matlab-CATIA-link with Matlab 2022b and CATIA V5R2021 as described here:
After the update to Matlab 2024b, the handles of various objects that are created in Matlab are not transfered properly anymore.
For example, the following code produces different results with the latest Matlab Version: (given, that there is an
catia = actxserver('catia.application');
Docs=get(catia,'Documents');
In Matlab 2022b, this would produce (when checking the created variable or object in matlab)
Docs = 1x1 Documents, val = Interface.catia_application.Documents
In Matlab 2024b, the following is created:
Docs = 1x1 catia_application_Handle_Unknown, val = Interface.catia_application_Handle_Unknown
That means, i can create a new part in catia with the following matlab code:
Doc = invoke(Docs,'Add','Part');
but since only unknown handles are created in matlab, i cannot go further and create planes or sketches in this .
What was changed between the two matlab versions and how can i proceed with Matlab2024b?
The obvious solution could be, to continue using Matlab2022b, but this cannot be a long term solution....
best regards
Philipp
  1 Kommentar
Philipp Jäger
Philipp Jäger am 12 Mär. 2025
I have had contact with the Matlab support, the issue seems like a bug in Matlab2024b and will be fixed in the next new version. The communication with the COM objects works, but the handle is not produced correctly.
I have also changed a few lines in my code to not rely on Matlab giving back the correct handle name, which is enough for me to get it to work.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jack
Jack am 8 Mär. 2025
MATLAB 2024b introduced changes in how COM objects are wrapped and returned. In earlier versions (like 2022b), MATLAB provided more specific type information for COM objects (e.g., Documents would be recognized as an Interface.catia_application.Documents object), whereas in 2024b the same objects are returned with a generic “Handle_Unknown” type. This means that MATLAB no longer automatically converts the COM handle to a specific type, so methods and properties you’d normally access may not be available directly.
To work around this, you can try the following:
  • Use late binding (e.g., via invoke or get) explicitly to interact with the COM object.
  • Check if casting or accessing the underlying object via a different method (such as using dynamic properties) helps.
  • Review the release notes or contact MathWorks support for any recommended changes when interfacing with CATIA from MATLAB 2024b.
Follow me so you can message me anytime with future MATLAB questions. If this helps, please accept the answer as well.

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Produkte


Version

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by