fixes for 4 axis

pull/258/head
Joe Marshall 2024-02-05 12:30:43 +00:00
rodzic 2f21a3d423
commit a5551e8a44
3 zmienionych plików z 21 dodań i 9 usunięć

Wyświetl plik

@ -67,14 +67,18 @@ class camPathChunkBuilder:
if inpoints is None:
inpoints=[]
self.points=inpoints
self.startpoints=startpoints
self.endpoints=endpoints
self.rotations=rotations
self.startpoints=startpoints or []
self.endpoints=endpoints or []
self.rotations=rotations or []
self.depth = None
def to_chunk(self):
chunk = camPathChunk(self.points,self.startpoints,self.endpoints,self.rotations)
if len(self.points)>2 and np.array_equal(self.points[0],self.points[-1]):
chunk.closed = True
if self.depth is not None:
chunk.depth = self.depth
return chunk
# an actual chunk - stores points as numpy arrays
@ -291,6 +295,9 @@ class camPathChunk:
self.endpoints.pop(index)
self.rotations.pop(index)
def insert(self,at_index,point,startpoint=None, endpoint=None, rotation=None):
self.append(point,startpoint=startpoint,endpoint=endpoint,rotation=rotation,at_index=at_index)
def append(self, point, startpoint=None, endpoint=None, rotation=None,at_index=None):
if at_index is None:
self._points=np.concatenate((self._points,np.array([point])))

Wyświetl plik

@ -501,8 +501,9 @@ def getPathPattern4axis(operation):
rot[a1] = b * anglestep
chunk.rotations.append(rot)
chunk = chunk.to_chunk()
chunk.depth = radiusend - radius
pathchunks.append(chunk.to_chunk())
pathchunks.append(chunk)
if (reverse and o.movement.type == 'MEANDER') or (
o.movement.type == 'CONVENTIONAL' and o.movement.spindle_rotation == 'CW') or (
@ -540,9 +541,10 @@ def getPathPattern4axis(operation):
cutterstart.rotate(e)
cutterend.rotate(e)
chunk=chunk.to_chunk()
chunk.depth = radiusend - radius
pathchunks.append(chunk.to_chunk())
pathchunks.append(chunk)
# print(chunk.startpoints)
# print(pathchunks)
# sprint(len(pathchunks))

Wyświetl plik

@ -689,12 +689,15 @@ async def sampleChunksNAxis(o, pathSamples, layers):
# for t in range(0,threads):
# print(len(patternchunk.startpoints),len( patternchunk.endpoints))
spl = len(patternchunk.startpoints)
last_percent=-1
for si in range(0, spl): # ,startp in enumerate(patternchunk.startpoints):
# #TODO: seems we are writing into the source chunk ,
# and that is why we need to write endpoints everywhere too?
if n / 200.0 == int(n / 200.0):
await progress_async('sampling paths', int(100 * n / totlen))
percent=int(100 * n / totlen)
if percent!=last_percent:
await progress_async('sampling paths', percent)
last_percent=percent
n += 1
sampled = False
# print(si)
@ -841,10 +844,10 @@ async def sampleChunksNAxis(o, pathSamples, layers):
for i, l in enumerate(layers):
ch = layeractivechunks[i]
if len(ch.points) > 0:
if ch.count() > 0:
layerchunks[i].append(ch)
thisrunchunks[i].append(ch)
layeractivechunks[i] = None
layeractivechunks[i] = camPathChunkBuilder([])
if o.strategy == 'PARALLEL' or o.strategy == 'CROSS' or o.strategy == 'OUTLINEFILL':
parentChildDist(thisrunchunks[i], lastrunchunks[i], o)