Fixed inner circle bug
This commit is contained in:
@@ -166,6 +166,7 @@ class ObjectDressup:
|
||||
horizFeed = tc.HorizFeed.Value
|
||||
vertFeed = tc.VertFeed.Value
|
||||
toolnummer = tc.ToolNumber
|
||||
arcs_identical = False
|
||||
|
||||
# Set the correct twist command
|
||||
if self.getDirectionOfPath(obj) == 'left':
|
||||
@@ -183,6 +184,7 @@ class ObjectDressup:
|
||||
p0 = queue[0].Placement.Base
|
||||
p1 = queue[1].Placement.Base
|
||||
v = self.normalize(p1.sub(p0))
|
||||
#arcdir = queue[1].Name
|
||||
# PathLog.debug(" CURRENT_IN ARC : P0 X:{} Y:{} P1 X:{} Y:{} ".format(p0.x,p0.y,p1.x,p1.y))
|
||||
|
||||
# Calculate offset vector (will be overwritten for arcs)
|
||||
@@ -206,32 +208,43 @@ class ObjectDressup:
|
||||
pij.x += queue[1].Parameters['I']
|
||||
pij.y += queue[1].Parameters['J']
|
||||
|
||||
if arcdir == queue[1].Name:
|
||||
arcs_identical = True
|
||||
|
||||
# Calculate vector circle start -> circle middle
|
||||
vec_circ = pij.sub(p0)
|
||||
|
||||
print("Vec:circ: {}".format(vec_circ))
|
||||
# Rotate vector to get direction for lead in
|
||||
if arcdir == "G2":
|
||||
vec_rot = self.rotate(vec_circ, 90)
|
||||
else:
|
||||
vec_rot = self.rotate(vec_circ, -90)
|
||||
|
||||
print("Vec:rot: {}".format(vec_rot))
|
||||
# Normalize and invert vector
|
||||
vec_n = self.normalize(vec_rot)
|
||||
|
||||
v = self.invert(vec_n)
|
||||
#v = vec_n
|
||||
print("Vec:inv: {}".format(v))
|
||||
|
||||
# Calculate offset of lead in
|
||||
if arcdir == "G3":
|
||||
off_v = FreeCAD.Vector(-v.y*R, v.x*R, 0.0)
|
||||
else:
|
||||
off_v = FreeCAD.Vector(v.y*R, -v.x*R, 0.0)
|
||||
|
||||
print("Vec:off: {}".format(off_v))
|
||||
# Multiply offset by LeadIn length
|
||||
vec_off = self.multiply(vec_rot, obj.ExtendLeadIn)
|
||||
vec_off = self.multiply(vec_n, obj.ExtendLeadIn)
|
||||
|
||||
offsetvector = FreeCAD.Vector(v.x*R-vec_off.x, v.y*R-vec_off.y, 0) # IJ
|
||||
print("off: {}".format(offsetvector))
|
||||
if obj.RadiusCenter == 'Radius':
|
||||
leadstart = (p0.add(off_v)).sub(offsetvector) # Rmode
|
||||
if arcs_identical:
|
||||
t = p0.sub(leadstart)
|
||||
t = p0.add(t)
|
||||
leadstart = t
|
||||
offsetvector = self.multiply(offsetvector, -1)
|
||||
else:
|
||||
leadstart = p0.add(off_v) # Dmode
|
||||
|
||||
@@ -286,6 +299,7 @@ class ObjectDressup:
|
||||
results = []
|
||||
horizFeed = PathDressup.toolController(obj.Base).HorizFeed.Value
|
||||
R = obj.Length.Value # Radius of roll or length
|
||||
arcs_identical = False
|
||||
|
||||
# set the correct twist command
|
||||
if self.getDirectionOfPath(obj) == 'right':
|
||||
@@ -322,6 +336,9 @@ class ObjectDressup:
|
||||
pij.y += queue[1].Parameters['J']
|
||||
ve = pij.sub(p1)
|
||||
|
||||
if arcdir == queue[1].Name:
|
||||
arcs_identical = True
|
||||
|
||||
if arcdir == "G2":
|
||||
vec_rot = self.rotate(ve, -90)
|
||||
else:
|
||||
@@ -342,6 +359,11 @@ class ObjectDressup:
|
||||
offsetvector = FreeCAD.Vector(v.x*R-vec_off.x, v.y*R-vec_off.y, 0.0)
|
||||
if obj.RadiusCenter == 'Radius':
|
||||
leadend = (p1.add(off_v)).add(offsetvector) # Rmode
|
||||
if arcs_identical:
|
||||
t = p1.sub(leadend)
|
||||
t = p1.add(t)
|
||||
leadend = t
|
||||
off_v = self.multiply(off_v, -1)
|
||||
else:
|
||||
leadend = p1.add(off_v) # Dmode
|
||||
|
||||
@@ -496,8 +518,8 @@ class ObjectDressup:
|
||||
|
||||
for cmd in layer:
|
||||
#print("CurLoc: {}, NewCmd: {}".format(currLocation, cmd))
|
||||
if currLocation['X'] == cmd.x and currLocation['Y'] == cmd.y and currLocation['Z'] == cmd.z and cmd.Name in ['G1', 'G01']:
|
||||
continue
|
||||
#if currLocation['X'] == cmd.x and currLocation['Y'] == cmd.y and currLocation['Z'] == cmd.z and cmd.Name in ['G1', 'G01']:
|
||||
#continue
|
||||
newpath.append(cmd)
|
||||
|
||||
if obj.LeadOut:
|
||||
|
||||
Reference in New Issue
Block a user