~neomilium/heekscnc/heeks

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from nc.nc import *
import sys
sys.path.insert(0,'../../libactp/PythonLib')
import actp

def cut(stl_file):
    actp.makerough(stl_file)

    npaths = actp.getnumpaths()
    for path in range(0, npaths):
        npoints = actp.getnumpoints(path)
        nbreaks = actp.getnumbreaks(path)
        nlinkpaths = actp.getnumlinkpths(path)
        z = actp.getz(path)
        start_pos = 0
        FirstZDone = False
        for brk in range(0, nbreaks):
            brkpos = actp.getbreak(path, brk)
            for point in range(start_pos, brkpos):
                x, y = actp.getpoint(path, point)
                if FirstZDone == False:
                    feed(x, y, z)
                    FirstZDone = True
                else:
                    feed(x, y)
            start_pos = brkpos
            nlinkpoints = actp.getnumlinkpoints(path, brk)
            for linkpoint in range(0, nlinkpoints):
                x, y, z = actp.getlinkpoint(path, brk, linkpoint)
                rapid(x, y, z)