Importing CAD file into matlab (STEP file)- Aircraft structure

Hello all,
I would like to import a cut out part of the aircraft shell and overlay with some existing/measured point cloud.
I tried to first import the ideal STEP file of the shell using the following code:
figure
Geometry = 'Shell single body'
gm = fegeometry("Shell single body.stp");
pdegplot(gm,FaceLabels="on",FaceAlpha=0.3)
But i was able to import only a very very small part of the shell within the cut out part .Tried to change the export types in CATIA and make fucntion changes but nothing works and i suppose that it runs and breaks as the meory is full (RAM) while reading such large file (2000KB), is there a way i can import such large Step files without loosing the geometry and would be able to overlay the meaured point clouds on it ?

8 Comments

Hey Dhinu,
Do you face any explicit error that you are running out of memory? Also coud you share the file or a dummy one of similar size and complexity to reproduce it
2000KB is only 2 GB. I would not expect that to be a problem except on systems that barely meet the minimums for running MATLAB.
There isn't any error mentioning the running out of memory , but the error looks like this .
I tried to upload the Dummy Step file here but the upload datatypes does not allow.
zip the .step file and attach the .zip
I get,
Imported geometry must be a solid geometric shape.
when I try to read in 20241126_Dhinu_test_part_cut-out.stp
This is an error I commonly encounter when working with stl files - the model geometry is not fully closed. With stl's, I have used online repari tools in the past to fix this issue.

Sign in to comment.

Answers (2)

I was able to load your step file into OnShape. Your file has 3 independent geometries in it. That is why you are getting this error. I exported the 3 parts as STL files and then was able to import each one individually.
unzip('20241126_Dhinu_test_part_cut-out.zip','./')
gm1 = importGeometry('20241126_Dhinu_test_part_cut-out - Bauteil2 (1).stl')
gm1 =
DiscreteGeometry with properties: NumCells: 1 NumFaces: 24 NumEdges: 69 NumVertices: 48 Vertices: [48x3 double]
gm2 = importGeometry('20241126_Dhinu_test_part_cut-out - Bauteil2 (2).stl')
gm2 =
DiscreteGeometry with properties: NumCells: 1 NumFaces: 20 NumEdges: 34 NumVertices: 23 Vertices: [23x3 double]
gm3 = importGeometry('20241126_Dhinu_test_part_cut-out - Bauteil2.stl')
gm3 =
DiscreteGeometry with properties: NumCells: 1 NumFaces: 26 NumEdges: 36 NumVertices: 30 Vertices: [30x3 double]
pdegplot(gm1)
hold on
pdegplot(gm2)
hold on
pdegplot(gm3)
hold off

5 Comments

although this works for the cutout part from the large shell, I would like to keep the Step format and import the large shell .Unfortunately, I am not able to upload the huge zip file due to upload size restrictions.
The file format is not the issue. It is that you have multiple independent parts in a single file. You need to separate each unique part into its own file and import it that way.
What are the other ways i can import the shell and perform operations on the visual model directly , i intend to place some of the measured point cloud on them to see if the real life measured values matches the CAD values ?
The functions for importing a step file are importgeometry and fegeometry. Note that, for importgeometry, you must be using at least R2022b and for fegeometry, you must be using at least R2023a (for step files, at least).
I currently use R2024b , but when i try to make all the indepdent part into one (connected to adjacent block) The file runs and open the figure tab but does not show anything . i tried botht the function and the error is same
(importGeometry, feGeometry)
code :
figure(1)
Geometry = "stringers test2 1"
gm1 = importGeometry("stringers test2 1.stp");
pdegplot(gm1,FaceLabels="on",FaceAlpha=0.3)
error message :
Error using pde.DiscreteGeometry
Unable to create one or more edges due to inconsistent triangulation of adjacent faces.
Error in importGeometry (line 88)
gm = pde.DiscreteGeometry(filename,MaxRelativeDeviationDefault);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in open_files (line 16)
gm1 = importGeometry("stringers test2 1.stp");
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sign in to comment.

i managed to import whole shell skin ,
but it is still not possible with a cutout part even after exporting each structure individually.
i tried the code :
indvidually i get the error:
code:
figure(1)
Geometry1 = "cutout1_skin"
gm1 = fegeometry("cutout1_skin.stp");
pdegplot(gm1,FaceLabels="on",FaceAlpha=0.3)
Error using open_files (line 29)
Unable to create one or more edges due to inconsistent triangulation of adjacent faces.
and together but it gives error message :
figure(1)
Geometry1 = "cutout1_skin"
gm1 = fegeometry("cutout1_skin.stp");
pdegplot(gm1,FaceLabels="on",FaceAlpha=0.3)
figure(2)
Geometry2 = "cutout3_stringers"
gm2 = fegeometry("cutout3_stringers.stp");
pdegplot(gm2,FaceLabels="off",FaceAlpha=0.3)
figure(3)
Geometry3 = "cutout2_frame"
gm3 = fegeometry("cutout2_frame.stp");
pdegplot(gm3,FaceLabels="off",FaceAlpha=0.3)
pdegplot(gm1)
hold on
pdegplot(gm2)
hold on
pdegplot(gm3)
hold off
error:
Error using pde.DiscreteGeometry
Unable to create one or more edges due to inconsistent triangulation of adjacent faces.
Error in importGeometry (line 88)
gm = pde.DiscreteGeometry(filename,MaxRelativeDeviationDefault);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in test_1 (line 4)
gm1 = importGeometry('cutout1_skin.stp')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

3 Comments

Hi Dhinu,
This error points to the model itself having some error. This could be because the 3D modelling software that you are using might not flag dirty geometry but MATLAB does. Do consider manually modifying the model within the modeling software to try and solve the issue
Hi Jacob,
I tried it with a cutout from the middle of the shell and worked for skin, stringer and frames.
Now, when i exported every frame individually and whole shell from Catia. Started importing from the skin and then Frame 1-5. (without importing stringers). The skin and the first frame import was sucessful both together and individually. But, the frame 2-5 would not import individually or on the shell skin , and shows the same error.
code :
figure(3)
Geometry3 = '02_Frame_2'
gm3= fegeometry("02_Frame_2.stp");
pdegplot(gm3,FaceLabels="on",FaceAlpha=0.3)
Error:
Error using open_files (line 9)
Unable to create one or more edges due to inconsistent triangulation of adjacent faces.
I was able to duplicate the issue if I tried to import a file with two unique parts interfacing. As I showed above, I imported your step file into a CAD program and then exported each unique component. I was then able to import each part indificually without error. This suggests there is an error with how the CAD software is creating the file, particularly where two components interface. Error might be too strong of a word, since other CAD systes will load it just fine.
This is an issue I encountered a lot when working with stl files for 3D printing. I was able to use online tools to repair the files. This amounted to orienting the faces correctly, removing interior walls, etc.

Sign in to comment.

Asked:

on 3 Dec 2024

Commented:

on 13 Dec 2024

Community Treasure Hunt

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

Start Hunting!