diff --git a/extra/fillet-radius.py b/extra/fillet-radius.py new file mode 100644 index 0000000..a64ba27 --- /dev/null +++ b/extra/fillet-radius.py @@ -0,0 +1,70 @@ +import matplotlib.pyplot as plt +from math import sqrt +import sys + +if __name__ == "__main__": + + try: + stype = sys.argv[1] + + except IndexError: + print("python fillet-radius.py [simple|bodyCentered|faceCentered]") + + exit(1) + + + if stype == "simple": + r0 = 1.0 + + C1, C2 = 0.8, 0.5 + theta1, theta2 = 0.01, 0.28 + + delta = 0.2 + + elif stype == "bodyCentered": + L = 1.0 + r0 = L * sqrt(3) / 4 + + C1, C2 = 0.3, 0.2 + theta1, theta2 = 0.01, 0.18 + + delta = 0.02 + + elif stype == "faceCentered": + L = 1.0 + r0 = L * sqrt(2) / 4 + + C1, C2 = 0.3, 0.2 + theta1, theta2 = 0.01, 0.13 + + delta = 0.012 + + else: + print("python fillet-radius.py [simple|bodyCentered|faceCentered]") + + exit(1) + + + Cf = lambda theta: C1 + (C2 - C1) / (theta2 - theta1) * (theta - theta1) + fillet = lambda theta: delta - Cf(theta) * (r0 / (1 - theta) - r0) + + tocount = lambda num: int(num * 100) + + theta = [ 0.01 * n for n in range(tocount(theta1), tocount(theta2) + 1) ] + coeffs = [ Cf(n) for n in theta ] + radiuses = [ fillet(n) for n in theta ] + + plt.figure(1) + + plt.subplot(211) + plt.plot(theta, coeffs, "o") + plt.grid(True) + plt.ylabel("Cf") + + plt.subplot(212) + plt.plot(theta, radiuses, "o") + plt.grid(True) + plt.ylabel("Radius") + plt.xlabel("Theta") + + plt.show() diff --git a/samples/bodyCentered.py b/samples/bodyCentered.py index d3dd7a6..0f33c91 100644 --- a/samples/bodyCentered.py +++ b/samples/bodyCentered.py @@ -28,10 +28,11 @@ def bodyCenteredCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): yw = xl zh = height - C1, C2 = 0.8, 0.5 #0.8, 0.05 - theta1, theta2 = 0.01, 0.13 + C1, C2 = 0.3, 0.2 + theta1, theta2 = 0.01, 0.18 Cf = C1 + (C2 - C1) / (theta2 - theta1) * (theta - theta1) - filletradius = 0.05 - Cf * (radius - r0) + delta = 0.02 + filletradius = delta - Cf * (radius - r0) scale = 100 oo = geompy.MakeVertex(0, 0, 0) @@ -178,10 +179,11 @@ def bodyCenteredHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, point.append((0 + xl, L + yw, L + zh)) point.append((L / 3 + xl, L / 3 + yw, 4 * L / 3 + zh)) - C1, C2 = 0.8, 0.05 - theta1, theta2 = 0.01, 0.13 + C1, C2 = 0.3, 0.2 + theta1, theta2 = 0.01, 0.18 Cf = C1 + (C2 - C1) / (theta2 - theta1) * (theta - theta1) - filletradius = Cf * (radius - r0) + delta = 0.02 + filletradius = delta - Cf * (radius - r0) scale = 100 oo = geompy.MakeVertex(0, 0, 0) diff --git a/samples/faceCentered.py b/samples/faceCentered.py index bb32cb4..0a24740 100644 --- a/samples/faceCentered.py +++ b/samples/faceCentered.py @@ -28,10 +28,11 @@ def faceCenteredCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): yw = xl zh = width - C1, C2 = 0.8, 0.05 + C1, C2 = 0.3, 0.2 theta1, theta2 = 0.01, 0.13 Cf = C1 + (C2 - C1) / (theta2 - theta1) * (theta - theta1) - filletradius = Cf * (radius - r0) + delta = 0.012 + filletradius = delta - Cf * (radius - r0) scale = 100 oo = geompy.MakeVertex(0, 0, 0) @@ -176,10 +177,11 @@ def faceCenteredHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, point.append((-width + xl, 0 + yw, 0 + zh)) point.append((-2 * width / 3 + xl, -2 * width / 3 + yw, width / 3 + zh)) - C1, C2 = 0.8, 0.05 + C1, C2 = 0.3, 0.2 theta1, theta2 = 0.01, 0.13 Cf = C1 + (C2 - C1) / (theta2 - theta1) * (theta - theta1) - filletradius = Cf * (radius - r0) + delta = 0.012 + filletradius = delta - Cf * (radius - r0) scale = 100 oo = geompy.MakeVertex(0, 0, 0)