kopia lustrzana https://github.com/vilemduha/blendercam
image scaling now works different - negatively and also positively scaled images get first under zero plane, then offset in the depth.
-image milling will now go to the very border of image, it's up to user to limit it with ambient settings. -hopefully some little optimization in sampling process.pull/4/head
rodzic
7957676c8e
commit
49897ba755
|
|
@ -373,6 +373,11 @@ def optimizeChunk(chunk,operation):
|
|||
chunk.points[-1]=v1c
|
||||
elif v2c!=v2:
|
||||
chunk.points[-2]=v2c
|
||||
#add last point
|
||||
if spoints:
|
||||
chunk.append(points[-1],startpoints[-1],endpoints[-1])
|
||||
else:
|
||||
chunk.points.append(points[-1])
|
||||
#=True
|
||||
'''
|
||||
if:#protect vertical surfaces so far only for 3 axes..doesn't have now much logic for n axes, right?
|
||||
|
|
|
|||
|
|
@ -1311,18 +1311,27 @@ def renderSampleImage(o):
|
|||
mina=numpy.min(rawimage)
|
||||
a=numpy.array((1.0,1.0))
|
||||
a.resize(2*o.borderwidth+i.size[0],2*o.borderwidth+i.size[1])
|
||||
neg=o.source_image_scale_z<0
|
||||
if o.strategy=='CUTOUT':#cutout strategy doesn't want to cut image border
|
||||
a.fill(0)
|
||||
else:#other operations want to avoid cutting anything outside image borders.
|
||||
a.fill(o.min.z)
|
||||
a.fill(1-neg)
|
||||
else:#other operations want to avoid cutting anything outside image borders
|
||||
a.fill(neg)#
|
||||
#2*o.borderwidth
|
||||
a[o.borderwidth:-o.borderwidth,o.borderwidth:-o.borderwidth]=rawimage
|
||||
a=a[sx:ex+o.borderwidth*2,sy:ey+o.borderwidth*2]
|
||||
|
||||
a=(a-mina)#TODO: fix this!!!!!
|
||||
if o.source_image_scale_z<0:#negative images place themselves under the 0 plane by inverting through scale multiplication
|
||||
a=(a-mina)#first, put the image down, se we know the image minimum is on 0
|
||||
a*=o.source_image_scale_z
|
||||
a+=o.source_image_offset.z
|
||||
o.minz=numpy.min(a)
|
||||
|
||||
else:#place positive images under 0 plane, this is logical
|
||||
a=(a-mina)#first, put the image down, se we know the image minimum is on 0
|
||||
a*o.source_image_scale_z
|
||||
a-=maxa
|
||||
|
||||
a+=o.source_image_offset.z#after that, image gets offset.
|
||||
|
||||
o.minz=numpy.min(a)#TODO: I really don't know why this is here...
|
||||
o.min.z=numpy.min(a)
|
||||
print('min z ', o.min.z)
|
||||
print('max z ', o.max.z)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ def getPathPatternParallel(o,angle):
|
|||
v+=vm#shifting for the rotation, so pattern rotates around middle...
|
||||
for b in range(int(-dim/pathstep),int(dim/pathstep)):
|
||||
v+=dirvect
|
||||
|
||||
if v.x>o.min.x and v.x<o.max.x and v.y>o.min.y and v.y<o.max.y:
|
||||
chunk.points.append((v.x,v.y,zlevel))
|
||||
if (reverse and o.movement_type=='MEANDER') or (o.movement_type=='CONVENTIONAL' and o.spindle_rotation_direction=='CW') or (o.movement_type=='CLIMB' and o.spindle_rotation_direction=='CCW') :
|
||||
|
|
|
|||
|
|
@ -263,6 +263,7 @@ def sampleChunks(o,pathSamples,layers):
|
|||
n+=1
|
||||
x=s[0]
|
||||
y=s[1]
|
||||
if o.ambient.isInside(x,y):
|
||||
z=minz# we'll store results into this
|
||||
|
||||
sampled=False
|
||||
|
|
@ -290,13 +291,14 @@ def sampleChunks(o,pathSamples,layers):
|
|||
#if o.inverse:
|
||||
# z=layerstart
|
||||
z=getSampleImage((xs,ys),o.offset_image,minz)+o.skin
|
||||
if minz>z and o.ambient.isInside(x,y):
|
||||
z=minz;
|
||||
#if minz>z and o.ambient.isInside(x,y):
|
||||
# z=minz;
|
||||
################################
|
||||
#handling samples
|
||||
############################################
|
||||
if (z>=minz and (o.ambient.isInside(x,y))):
|
||||
|
||||
if minz>z:
|
||||
z=minz
|
||||
newsample=(x,y,z)
|
||||
#z=max(minz,z)
|
||||
|
||||
|
|
@ -974,8 +976,9 @@ def exportGcodePath(filename,vertslist,operations):
|
|||
downvector= Vector((0,0,-1))
|
||||
print('2')
|
||||
for vi in range(0,len(verts)):
|
||||
v=verts[vi].co.copy()
|
||||
v=verts[vi].co
|
||||
if o.axes!='3':
|
||||
v=v.copy()#we rotate it so we copy the vector
|
||||
r=Euler((rx[vi],ry[vi],rz[vi]))
|
||||
#conversion to N-axis coordinates
|
||||
# this seems to work correctly
|
||||
|
|
@ -999,7 +1002,7 @@ def exportGcodePath(filename,vertslist,operations):
|
|||
|
||||
#v=(v.x*unitcorr,v.y*unitcorr,v.z*unitcorr)
|
||||
vect=v-last
|
||||
plungeratio=1
|
||||
|
||||
if vi>0 and vect.length>0 and downvector.angle(vect)<(pi/2-o.plunge_angle):
|
||||
#print('plunge')
|
||||
#print(vect)
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue