mwickerson
(Mwickerson)
September 22, 2020, 7:48pm
#1
I can’t get this to run correctly, line 24 should work but I can only get the next line to work without rotation done correctly.

Anyone?..

```
import rhinoscriptsyntax as rs
import math
pts = []
for i in range(n):
x = math.sin(i)*scaleX
y = math.cos(i)*scaleY
z = i * scaleZ
pt = rs.AddPoint(x,y,z)
pts.append(pt)
curve = rs.AddInterpCurve(pts)
curveDomain = rs.CurveDomain(curve)
lineList = []
for i in range(n**2):
i = ((curveDomain[1]-curveDomain[0])/n**2)*i
t = rs.EvaluateCurve(curve,i)
pt2 = rs.AddPoint(t)
curveFrame = rs.CurvePerpFrame(curve,i)
vector = rs.VectorRotate(curveFrame[1],720*i,curveFrame[3])
#vector = rs.VectorRotate([1,0,0], 720*i, [0,0,1])
pt3 = rs.CopyObject(pt2,vector*math.sin(i)*scale)
line = rs.AddLine(pt2,pt3)
lineList.append(line)
spiralSurface = rs.AddLoftSrf(lineList)
curve_out = curve
spiralSurface_out = spiralSurface
```

Willem
(Willem Derks)
September 22, 2020, 9:20pm
#2
Hi,

Can you provide some more context It seems to be a python script for GH but the inputs are missing.
In any case the values for n, the scalesXYZ and scale are missing

The issue I could find was that pt3 and pt2 might be equal

-Willem

mwickerson
(Mwickerson)
September 22, 2020, 9:40pm
#3
sorry about that, I am new to all this,

I do have a ghpython node with n, scalesXYZ and scales

I will share the screenshot and check the pt3 and pt2

Thank you, M

mwickerson
(Mwickerson)
September 22, 2020, 9:55pm
#5
I sort of solved it with hard coding the vectors, but I still can’t get the commented line to work, oh well…

```
import rhinoscriptsyntax as rs
import math
pts = []
for i in range(n):
x = math.sin(i)*scaleX
y = math.cos(i)*scaleY
z = i * scaleZ
pt = rs.AddPoint(x,y,z)
pts.append(pt)
curve = rs.AddInterpCurve(pts)
curveDomain = rs.CurveDomain(curve)
lineList = []
for i in range(n**2):
i = ((curveDomain[1]-curveDomain[0])/n**2)*i
t = rs.EvaluateCurve(curve,i)
pt2 = rs.AddPoint(t)
curveFrame = rs.CurvePerpFrame(curve,i)
#vector = rs.VectorRotate(curveFrame[1],720*i,curveFrame[3])
vector = rs.VectorRotate([1,1,0], 720*i, [0,1,1])
pt3 = rs.CopyObject(pt2,vector*math.sin(i)*scale)
line = rs.AddLine(pt2,pt3)
lineList.append(line)
spiralSurface = rs.AddLoftSrf(lineList)
curve_out = curve
spiralSurface_out = spiralSurface
```

Willem
(Willem Derks)
September 23, 2020, 6:00am
#6
Ah yes I see now.
The CurvePerpFrame returns a Plane object. To get the axis and origin you access the properties like so
curveFrame.XAxis see docs here:

Does that help?

Also rotating 720 degrees amounts to no change in orientation (2x360deg)