Python - Lead Angle Between Helix and Plane of Rotation

by matt392 in Circuits > Software

48 Views, 1 Favorites, 0 Comments

Python - Lead Angle Between Helix and Plane of Rotation

leadangle.jpg
leadanglegraphic.png
print ("This program will calculate the Lead Angle between the helix and a plane of rotation.")

import math

###  Formula for calculating the the Lead Angle between the helix and a plane of rotation:
#  LeadAngle = arctan((LeadOfHelix)/(math.pi * MeanDiameterOfHelix))
###########################################

# Enter the LeadOfHelix, MeanDiameterOfHelix
# 

def SolveForLeadAngle():
    print ("Solving for the lead angle.")

    # Enter the Lead of Helix 
    LeadOfHelix = float(input("Enter the lead of the helix in cm: ") )
    # Enter the mean diameter of the helix
    MeanDiameterOfHelix = float(input("Enter the mean diameter of the helix in cm: ") )
    print("Pi is: ", math.pi)

    # Calculate the bottom of fraction
    BottomOfFraction = (math.pi * MeanDiameterOfHelix)
    print ("The bottom of fraction is: ", BottomOfFraction)
    # Calculate the fraction
    FractionCalculated = (LeadOfHelix/BottomOfFraction)
    print("The fraction is: ", FractionCalculated)
    # Find the arctan of the right side
    LeadAngle = math.atan(FractionCalculated)
    print("The lead angle is: ", LeadAngle)
        
ContinueCalculations = "y"

# Check to see if the user wants to continue to calculate the Lead Angle
while (ContinueCalculations=="y"):
    SolveForLeadAngle()
    ContinueCalculations = input("Would like to do another calculation for the Lead Angle? (y/n): ")

print("==================================")
print ("Thank you to www.fxsolver.com for assistance with this formula.")