- Joined
- Oct 25, 2016
- Messages
- 271
- Reaction score
- 159
Since I'm laid up recovering from foot surgery, I'm using the time to start on my L3 documentation and planning. As part of my planning, I wanted to draw the rocket in CAD, particularly, in Rhino 5. Since I was looking for a fair level of accuracy in the drawing, I spent some time looking for tools to create an "exact" nose cone curve. I was surprised to find it wasn't straight forward. So I wrote a small python script to produce a list of of points that define a Haack series nose cone profile. This list of points can be copied into a rhino iron python script to create the curve. If anyone is interested in the script, it is copied below.
How have you accomplished this? Did I miss a simpler solution?
This was written under the influence of heavy pain meds, so use with caution....
*********************************************************************************************************************
Rhino Script:
How have you accomplished this? Did I miss a simpler solution?
This was written under the influence of heavy pain meds, so use with caution....
Code:
#########################################################
# Haack Series Nose Cone Designer
#########################################################
# This simple script will design and plot the a Haack
# series nose cone based on the Equations found at
# https://en.wikipedia.org/wiki/Nose_cone_design
#
# The author was only interested in a Von Karman nose
# cone with C=0, and therefore it is the only value tested.
#
# This code uses numpy for calculation and matplotlib for
# display. If you set plot to False, matplotlib is
# ignored
#
import numpy
plot =True # Set to False if you don't want to display the result
createTuples=True # If true will create point tuples for import into Rhino
noseLength = 33 # Total nosecone length in the units of your choosing
baseDia = 6.25 # Diameter at the base of the nose cone in the same units as noseLength
xResolution = .1 # Determines how often the equation is evaluated
c = 0 # C=0 for LD-Haack (Von Kaarman)
x = numpy.arange(0, noseLength+xResolution, xResolution) # X values evaluated
th = numpy.arccos(1-(2*x/noseLength))
sc = 0.5*baseDia/numpy.sqrt(numpy.pi) # sclaing coefficent
y = sc *numpy.sqrt(th-(numpy.sin(2*th)/2)+(c*numpy.sin(th)**3)) # Half nose cone profile
if createTuples:
z=numpy.zeros_like(x)
tList = (numpy.array([numpy.flipud(y),z, x]).T).tolist() #y,z,x will transpose y/X so that the nosecone points up
if plot:
from matplotlib import pyplot as plt
plt.plot(x,y, color='b')
plt.plot(x,-1*y, color='b')
plt.axes().set_aspect('equal', 'datalim')
plt.show()
*********************************************************************************************************************
Rhino Script:
Code:
import rhinoscriptsyntax as rs
tList = [[3.125, 0.0, 0.0]... [3.1245578867946904, 0.0, 0.1]] # Copy from resulting tList from top script here
rs.AddInterpCurve(tList)