Fixed angle calculation for none-square angles.
This commit is contained in:
parent
bc696aa84a
commit
92eaeabc4c
|
@ -168,10 +168,12 @@ class ObjectDressup:
|
||||||
circle.update({"X": inChord.End.x, "Y": inChord.End.y})
|
circle.update({"X": inChord.End.x, "Y": inChord.End.y})
|
||||||
return [ Path.Command("G3", circle) ]
|
return [ Path.Command("G3", circle) ]
|
||||||
|
|
||||||
def dogbone(self, inChord, outChord):
|
def dogbone(self, obj, inChord, outChord):
|
||||||
baseAngle = inChord.getAngleXY()
|
baseAngle = inChord.getAngleXY()
|
||||||
turnAngle = outChord.getAngle(inChord)
|
turnAngle = outChord.getAngle(inChord)
|
||||||
boneAngle = baseAngle - turnAngle/2
|
boneAngle = baseAngle + (turnAngle - math.pi)/2
|
||||||
|
if obj.Side == 'Left':
|
||||||
|
boneAngle = boneAngle + math.pi
|
||||||
#print("base=%+3.2f turn=%+3.2f bond=%+3.2f" % (baseAngle/math.pi, turnAngle/math.pi, boneAngle/math.pi))
|
#print("base=%+3.2f turn=%+3.2f bond=%+3.2f" % (baseAngle/math.pi, turnAngle/math.pi, boneAngle/math.pi))
|
||||||
x = self.toolRadius * math.cos(boneAngle) * 0.2929 # 0.2929 = 1 - 1/sqrt(2) + (a tiny bit)
|
x = self.toolRadius * math.cos(boneAngle) * 0.2929 # 0.2929 = 1 - 1/sqrt(2) + (a tiny bit)
|
||||||
y = self.toolRadius * math.sin(boneAngle) * 0.2929 # 0.2929 = 1 - 1/sqrt(2) + (a tiny bit)
|
y = self.toolRadius * math.sin(boneAngle) * 0.2929 # 0.2929 = 1 - 1/sqrt(2) + (a tiny bit)
|
||||||
|
@ -180,8 +182,8 @@ class ObjectDressup:
|
||||||
return [ boneChordIn.g1Command(), boneChordOut.g1Command() ]
|
return [ boneChordIn.g1Command(), boneChordOut.g1Command() ]
|
||||||
|
|
||||||
# Generate commands necessary to execute the dogbone
|
# Generate commands necessary to execute the dogbone
|
||||||
def dogboneCommands(self, inChord, outChord):
|
def dogboneCommands(self, obj, inChord, outChord):
|
||||||
return self.dogbone(inChord, outChord)
|
return self.dogbone(obj, inChord, outChord)
|
||||||
|
|
||||||
def execute(self, obj):
|
def execute(self, obj):
|
||||||
if not obj.Base:
|
if not obj.Base:
|
||||||
|
@ -206,13 +208,13 @@ class ObjectDressup:
|
||||||
thisIsACandidate = self.canAttachDogbone(thisCmd, thisChord)
|
thisIsACandidate = self.canAttachDogbone(thisCmd, thisChord)
|
||||||
|
|
||||||
if thisIsACandidate and lastCommand and self.shouldInsertDogbone(obj, lastChord, thisChord):
|
if thisIsACandidate and lastCommand and self.shouldInsertDogbone(obj, lastChord, thisChord):
|
||||||
dogbone = self.dogboneCommands(lastChord, thisChord)
|
dogbone = self.dogboneCommands(obj, lastChord, thisChord)
|
||||||
commands.extend(dogbone)
|
commands.extend(dogbone)
|
||||||
|
|
||||||
if lastCommand and thisChord.isAPlungeMove():
|
if lastCommand and thisChord.isAPlungeMove():
|
||||||
for chord in (chord for chord in oddsAndEnds if lastChord.connectsTo(chord)):
|
for chord in (chord for chord in oddsAndEnds if lastChord.connectsTo(chord)):
|
||||||
if self.shouldInsertDogbone(obj, lastChord, chord):
|
if self.shouldInsertDogbone(obj, lastChord, chord):
|
||||||
commands.extend(self.dogboneCommands(lastChord, chord))
|
commands.extend(self.dogboneCommands(obj, lastChord, chord))
|
||||||
|
|
||||||
if lastChord.isAPlungeMove() and thisIsACandidate:
|
if lastChord.isAPlungeMove() and thisIsACandidate:
|
||||||
oddsAndEnds.append(thisChord)
|
oddsAndEnds.append(thisChord)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user