Tracking the movement of a 3-d printing nozzle and move laser along with it usin

I want to know how the g-code from the 3d printer can be used to track its path and analyse the same movement for a laser using arduino

Do you KNOW what a G code is? Google "M and G codes".

A G code, by itself, will not tell you where the print head is. It will tell you where it was told to go, relative to it's current position. Whether it gets there, or not, is not relevant. Where it starts from is up to you to keep track of, assuming that all previous moves succeeded.

I don't understand what role the Arduino will play.

AMOGH_KS:
I want to know how the g-code from the 3d printer can be used to track its path and analyse the same movement for a laser using arduino

It is not clear to me whether you just want to make a laser machine that can trace out a path using G Code

OR
If you have a 3D printer and you want the laser always to shine at the same location where the nozzle is extruding.

The first should be straightforward and I suspect the latter would not.

...R

The first should be straightforward and I suspect the latter would not.

I would think that attaching the laser to the print head (carrier) would make pointing the laser at the nozzle end trivial.

PaulS:
I would think that attaching the laser to the print head (carrier) would make pointing the laser at the nozzle end trivial.

I agree.

But I had assumed from the OP's question that there was a good reason he was not adopting that simple approach.

...R