# Linking the 3D printing path coordinates to CAD for modelling

I was reading this research paper titled Sub-modeling Finite Element Analysis of 3D Printed Structures. In this, firstly, the author is trying to create a sketch for Engineering analysis using the 3D printing path coordinates and integrating it to a CAD software like Autodesk Inventor.

It says,

By analyzing the corresponding G-code for the desired structure, important information can be extracted, such as the coordinated of the 3D printing path, key points, paths of printing and non-printing paths.

...

The coordinate of the 3D printing path can then be imported into CAD software to obtain the corresponding sketch and consequently a solid body for each layer. Most of commercial CAD software packages are capable of this task. For this Purpose we have chosen Autodesk Inventor.

Paper is attached here: Research Paper in subject

Can anyone help me out with how this can be done?

## 1 Answer

The wording in the paper is quite verbose and somewhat unclear. All it says is they read the G-code file and somehow turn it into a 3D model.

A g-code file is just a list of linear moves. Here is an example snippet I took from a random file (keep in mind a typical file would consist of thousands of such lines):

``G1 X140.621 Y114.840 E0.0065 G1 X140.804 Y114.765 E0.0129 G1 X141.016 Y114.737 E0.0199 G1 X158.984 Y114.737 E0.6070 G1 X159.196 Y114.765 E0.6140 ``

Each move is relative to the previous, so the second line of the code (for example) tells the printer to move to X=140.804 and Y=114.765 from the previous position (X=140.621, Y=114.840) while extruding an amount of material equal to 0.0129-0.0065=0.0064 mm of filament.

It appears that the authors have developed a toolchain to turn a G-code file into a 3D model, translating every extrusion segment into a part of a solid body (from the pictures, it appears that for a given move segment, they create an ellipsoidal extrusion and merge all of these together into a single solid body) - see Figure 9 in the paper.