Hello,
I am using the pythonscript tool in rhino to create a command, so not rhinocommon. I am trying to create a line that rotates in azimuth and then rotates in elevation. The issue I am finding is if you keep to one elevation axis, it begins to swirl. For example, if I did the [1,0,0] axis, then it will swirl around -45-45 degrees and 135- -135 degrees. Is there a way to rotate so that the elevation is consistent? I have been looking all over the place for an example, but have yet to come across it. Some of my code is below.

i = -180
while i <= 180:
line = rs.AddLine(startpoint,endpoint)
p = rs.RotateObject(line,startpoint,i,[0,0,1])
startp = rs.CurveStartPoint(p)
endp = rs.CurveEndPoint(p)
j = -45
while j <= 90:
t = rs.AddLine(startp, endp)
rs.RotateObject(t,startp,j,[1,0,0])
j = j+1
i = i+1

Just realized I didn’t reply to your thread. I am trying to rotate on the azimuth plane, then rotate in elevation. In grasshopper, to do the same thing, you have to rotate the axis plane for elevation along with the azimuth angle. I have tried using sin for x and cos for y, but have yet to get it to work like I want it to. Any help would be much appreciated. I think I did what you asked with the 3 backticks, please let me know if I did it wrong.

import rhinoscriptsyntax as rs
import math
__commandname__ = "Test1"
def RunCommand( is_interactive ):
x = 0
y = 0
z = 0
point = rs.AddPoint(x,y,z)
point2 = rs.AddPoint(x+100,y,z)
for i in range(-180, 180, 1):
p = rs.AddLine(point,point2)
q = rs.RotateObject(p,point,i,[0,0,1])
startp = rs.CurveStartPoint(q)
endp = rs.CurveEndPoint(q)
for j in range(-45,90,1):
t = rs.AddLine(startp,endp)
r = rs.RotateObject(t,startp,j,[1,0,0])

import rhinoscriptsyntax as rs
import math
import System.Drawing.Color as clr
x = 0
y = 0
z = 0
point = rs.AddPoint(x,y,z)
point2 = rs.AddPoint(x,y+100,z)
for i in range(-45, 90, 5):
color = clr.FromArgb(i*2+90,0,0)
p = rs.AddLine(point,point2)
q = rs.RotateObject(p,point,i,[1,0,0])
startp = rs.CurveStartPoint(q)
endp = rs.CurveEndPoint(q)
for j in range(-180,180,5):
t = rs.AddLine(startp,endp)
r = rs.RotateObject(t,startp,j,[0,0,1])
rs.ObjectColor(t, color)