Thread milling is just the same as interpolation with a Z movement included; helical interpolation.
The code you show is for doing an internal thread.
The first line sets the tool on center 10mm above the work. The work zero has to be at the center of the part.
G90 G0 G54 G43 G17 H1X0 Y0 Z10 S1320
This line moves the tool down 25mm for the start of the thread. It will be cutting a righthand thread using G03 (climb milling) so the tool has to 'screw' itself out of the hole.
This line changes to incremental and starts tool compensation with a move that only takes the tool halfway to the thread diameter.
G01 G91 G41 D1X 4.75 Y-4.75 Z0 F41
This line does an incremental arc to bring the tool into the cutting position. Notice Z moves up slightly because now the tool is starting the thread. The reason the tool arcs into the cut is to make the entry gradual.
G03 X4.75 Y4.75 R4.75 Z0.25
This line does a full circle to complete the thread. The Z movement is the pitch of the thread.
G03 X0 Y0 I-9.5 J0 Z2.0
This line does another arc to move away from the thread.
G03 X-4.75 Y4.75 R4.75 Z0.25
This line cancels tool compensation.
G01 G40 X-4.75 Y-4.75 Z0
This line takes the tool back to center and lifts it to Z0 in absolute coordinates.
G90 G0 X0 Y0 Z0
For different diameters the X and Y moves would be larger or smaller and the R in the arc would change to match them. Also the I value would change to match.
For different pitches the Z moves would change.