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

<p>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):</p>

<pre><code>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
</code></pre>

<p>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.</p>

<p>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.</p>

CC BY-SA 4.0
2018-06-24T14:20:04.740Z
Thanks for the help. But I struggled with the last paragraph in your answer, how can one create such a tool chain that converts the G-code into sketch and then in-turn a 3D model in CAD? Are there specific tools one can use, I only know Autodesk Inventor. I apologize if the answer is trivial to a heavy user, I'm relatively new to this.
Kv07
CC BY-SA 4.0
2018-06-24T14:31:08.100Z
@Kv07 Sadly, that is extremely complicated and well outside the scope of a stackexchange answer. It would take an experienced programmer many days to create such a tool. There's nothing ready-made that does this. A good starting point would be reading up on the [Inventor API](http://help.autodesk.com/cloudhelp/2018/ENU/Inventor-API/files/GettingStarted.htm).
Tom van der Zanden
CC BY-SA 4.0
2018-06-28T06:07:43.970Z
@TomvanderZanden ( This is a random brainstorming comment ) So wouldn't it be easier if they run a slicing algorithm on the 3D File , like create a .CLI and then convert it back into a mesh with an approximation of the distance between the layers taken into account , by maybe using a random value function with limits in place  . After that if they run an FEA analysis they should be able to head in the right direction . Got any thoughts on this ?
Axel Fernandes
CC BY-SA 4.0
2018-06-28T11:21:51.880Z
@AxelFernandes They already run a slicing algorithm like you suggest. That's how they get the G-code from the 3D model.
Tom van der Zanden
CC BY-SA 4.0
2018-06-24T12:15:04.903Z
2018-06-24T12:15:04.903Z
Tom van der Zanden
<p>I was reading this research paper titled <em><a href="https://sci-hub.tw/https://ieeexplore.ieee.org/document/7103095/" rel="nofollow noreferrer">Sub-modeling Finite Element Analysis of 3D Printed Structures</a></em>. 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.</p>

<p>It says,</p>

<blockquote>
  <p>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. </p>
  
  <p>...</p>
  
  <p><em>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.</em></p>
</blockquote>

<p>Paper is attached here: <a href="https://sci-hub.tw/https://ieeexplore.ieee.org/document/7103095/" rel="nofollow noreferrer">Research Paper in subject</a></p>

<p>Can anyone help me out with how this can be done?</p>

CC BY-SA 4.0
2018-06-28T06:03:46.020Z
This is very interesting to me . Are you planing on developing a software for this ? . Currently there isn't any adequate tool for FEA on 3D printed parts that actually takes into account all the nitty gritty stuff of 3D printers and successfully prepare a simulation  for analysis .
Axel Fernandes
CC BY-SA 4.0
2018-06-29T07:59:25.673Z
Indeed very interesting and carries great practical utility too. Considering the complexities involved in merging the geometry of 3D printing to a CAD model, I have put this project to hold, at least for the time being. Do you have any domain specific knowledge on this? We can get together to make this happen!
Kv07
CC BY-SA 4.0
2018-06-29T08:38:29.963Z
this is all i do mate . I make solutions for the 3D printing industry and this problem is one i have been contemplating to tackle for ages . I though about using Autodesk Forge platform to make it but gosh there is a lot of work , mostly programming to be done . I don't mind starting a project and see if we can get developers on , but the solution should be on a mainstream platform  to actually make any financial sense .
Axel Fernandes
CC BY-SA 4.0
2018-06-29T09:19:30.013Z
The developing work is only the Herculean task here, once the model is developed rest is piece of cake. What kind of solutions do you provide to the industry?
Kv07
CC BY-SA 4.0
2018-09-18T10:25:48.603Z
Have you found and fixed the problem? If so, has the answer below led you to the solution? Please vote to accept the answer so this question is not bumped up once in a while and can be removed from the unanswered question list. You may even add your own solution and accept that after 48 hours! If you have not been able to address the problem please update your question.
0scar
<3d-models><3d-design><g-code><fdm>
Linking the 3D printing path coordinates to CAD for modelling
Kv07
# Linking the 3D printing path coordinates to CAD for modelling

(Asked by: username_0 on 2018-06-24)

I was reading this research paper titled *[Sub-modeling Finite Element Analysis of 3D Printed Structures](https://sci-hub.tw/https://ieeexplore.ieee.org/document/7103095/)*. 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](https://sci-hub.tw/https://ieeexplore.ieee.org/document/7103095/)

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

**Tags:** 3d-models, 3d-design, g-code, fdm
> **Comments:**
> **username_1**: This is very interesting to me . Are you planing on developing a software for this ? . Currently there isn't any adequate tool for FEA on 3D printed parts that actually takes into account all the nitty gritty stuff of 3D printers and successfully prepare a simulation  for analysis .  
> **username_0**: Indeed very interesting and carries great practical utility too. Considering the complexities involved in merging the geometry of 3D printing to a CAD model, I have put this project to hold, at least for the time being. Do you have any domain specific knowledge on this? We can get together to make this happen!  
> **username_1**: this is all i do mate . I make solutions for the 3D printing industry and this problem is one i have been contemplating to tackle for ages . I though about using Autodesk Forge platform to make it but gosh there is a lot of work , mostly programming to be done . I don't mind starting a project and see if we can get developers on , but the solution should be on a mainstream platform  to actually make any financial sense .  
> **username_0**: The developing work is only the Herculean task here, once the model is developed rest is piece of cake. What kind of solutions do you provide to the industry?  
> **username_2**: Have you found and fixed the problem? If so, has the answer below led you to the solution? Please vote to accept the answer so this question is not bumped up once in a while and can be removed from the unanswered question list. You may even add your own solution and accept that after 48 hours! If you have not been able to address the problem please update your question.  

---

## 1 answers

### Answer by username_3 on 2018-06-24. Score: 4 | Accepted 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.

> **Comments:**
> **username_0**: Thanks for the help. But I struggled with the last paragraph in your answer, how can one create such a tool chain that converts the G-code into sketch and then in-turn a 3D model in CAD? Are there specific tools one can use, I only know Autodesk Inventor. I apologize if the answer is trivial to a heavy user, I'm relatively new to this.  
> **username_3**: @Kv07 Sadly, that is extremely complicated and well outside the scope of a stackexchange answer. It would take an experienced programmer many days to create such a tool. There's nothing ready-made that does this. A good starting point would be reading up on the [Inventor API](http://help.autodesk.com/cloudhelp/2018/ENU/Inventor-API/files/GettingStarted.htm).  
> **username_1**: @TomvanderZanden ( This is a random brainstorming comment ) So wouldn't it be easier if they run a slicing algorithm on the 3D File , like create a .CLI and then convert it back into a mesh with an approximation of the distance between the layers taken into account , by maybe using a random value function with limits in place  . After that if they run an FEA analysis they should be able to head in the right direction . Got any thoughts on this ?  
> **username_3**: @AxelFernandes They already run a slicing algorithm like you suggest. That's how they get the G-code from the 3D model.  

---

