Hello everyone
I have begun to learn dynamo, as a first exercise, I am trying to make a sine wave whose amplitude and phase can be varied, also the length.
I made a short video describing the issue but since I am a new user I can only upload images, as I am not allowed to upload attachments yet. Also, it’s limited to one image I have merged all images into one. Hope it’s clear when you zoom in.
Kindly take a look at the attached images for a better understanding.
The first image shows the custom code for generating the spline. The code box takes several inputs.
xStart = Starting number for a range
xEnd = Ending number for a range
xStep = Step value for the range list
xVal = x-axis coordinate values
phaseVal = Phase value to shift the sine wave’s phase
ampVal = Value to increase/decrease the wave’s amplitude
yVal = y-axis coordinate values
degree = value to change nurbscurve degree
The code within code box:
xVal = xStart…xEnd…xStep;
zVal = Math.Sin(xVal+phaseVal)*ampVal;
points = Point.ByCoordinates(xVal,yVal,zVal);
curves = NurbsCurve.ByControlPoints(points,degree);
As seen in the first image the yVal is linked to a number slider, hence by sliding the whole wave moves along the y-axis as intended (see the second figure)
The problem arises when I try to input a range of values to yVal instead of the number slider. (see figure 3). The sine wave completely goes away and I get random points along the y-axis. But I intend to get multiple sine waves along the y-axis (see figure 4 (i was able to do this by copying the main code block and linking a separate slider for the yVal) ).
Instead of using multiple code blocks and separate yVal sliders for each, I want to give a range of values to the yVal, by doing so I can get multiple sine waves spaced along the y-axis whose spacing or amount can be varied. But as seen in figure 3 when I try to input a range it is not working.
Kindly help me with the issue
Thank you
Suganesh