I was trying to figure out how to write a script to help draw the first 180 degrees of a sine wave from, 90 through 270 degrees, when I searched YouTube for Rhino Python tutorials. I found a series by Jose Sanchez and worked through them all but have no idea whats causing the Check New Objects dialog box to appear.
Awesome! I did some superficial testing on the code, below. It seems to do what I wanted, although I’ve got the nagging suspicion I’ve got some redundant steps in the math that could be eliminated.
There are two identical ducts mirrored about the X-Y plane (only one is shown in the .3dm file at the link provided).
Adjust points of sine wave vertically by half of duct separator wall thickness
by subtracting half of duct separator wall thickness.
When the points are generated, generate an interpolated curve through the points
then mirror the curve about the X-axis. Surface > Revolve those curves about the vertical axis.
import rhinoscriptsyntax as rs
from math import *
dblStartDeg = 90.0
dblEndDeg = 270.0
dblXStart = rs.GetReal('Enter desired x-position at top of sine wave: ', 6.20)
dblXEnd = rs.GetReal('Enter desired x-position at bottom of sine wave: ', 9.20)
dblXStep = rs.GetReal('Entere desired step value for x-position of sine wave: ', 0.1)
dblAmp = rs.GetReal('Enter desired y-position (amplitude) at top of sine wave: ', 1.387)
dblWallThknss = rs.GetReal('Enter material thickness of Duct Mid-section separator wall: ', 0.03125)
\# y-coordinate of wave at peak of wave, e.g. at beginning of curve
dblYCoordAtPeakOfWave = dblAmp - dblWallThknss / 2
dblDegStep = (dblEndDeg - dblStartDeg) / ((dblXEnd - dblXStart) / dblXStep)
dblDeg = dblStartDeg
dblX = dblXStart
SineCurveList = []
while (dblDeg <= dblEndDeg):
# y-coordinate of wave at distance from datum (vertical axis) minus half of duct separator wall thickness
dblYCoordAtDistFrDatum = sin(radians(dblDeg)) * dblYCoordAtPeakOfWave
dblYCoordTranslatedUp = dblYCoordAtPeakOfWave + dblYCoordAtDistFrDatum
dblYCoordDividedBy2 = dblYCoordTranslatedUp / 2
# move the curve up by half the duct separator wall thickness
dblYCoordUpByHalfWallThickness = dblYCoordDividedBy2 + dblWallThknss / 2
# rs.AddPoint(dblX, 0.0, dblYCoordDividedBy2 )
dblNextPoint = [dblX, 0.0, dblYCoordUpByHalfWallThickness]
SineCurveList.append([dblX,0.0,dblYCoordUpByHalfWallThickness])
dblDeg += dblDegStep
dblX += dblXStep
# per Dale Fugier: "...I'd push the points into the rs.AddInterpCurve
# method..."
rs.AddInterpCurve(SineCurveList)