I want to put points on the surface of this cylinder at specific angle of 137.5 degree. But Is it possible to know how the cylinder is built on which co-ordinates?
import rhinoscriptsyntax as rs
#Center = [0,0,-60]
#Radius = 10
rs.AddCylinder([0,0,0],100,20)
#build matrix of point
def buildMatrix(surfacepoint):
points = []
points.append(surfacepoint[0][1][1],surfacepoint[2][4][5])
rs.EnableRedraw(True)
Hello @dale gier, I would like to make cylinder like shown in this image. BUt I am not able to make it.
The Instructable file says something like this:
First a set of points are place, one-at-a-time, in a cylindrical arrangement. Each point is placed 137.5º around the cylinder’s axis from the previous point and also raised a bit. (The solid cylinder is only for illustrative purposes to help make it easier to see the points’ placements.)
#set up parameters
ctr=center point (say, 0,0,0)
rad=radius of "cylinder"
ht=height of "cylinder"
z_inc=incremental height to move in Z for each point
#add first point
point_array=[]
last_pt=add_point (rad,0,0)
point_array.append(last_pt)
#loop for all the rest of the points until desired Z height is reached
while last_pt.Z<=ht:
new_pt=rotate(last_pt,137.5,copy=yes)
move(new_pt,inc_Z)
point_array.append(new_pt)
last_pt=new_pt
import rhinoscriptsyntax as rs
# base point of cylinder
base = [0,0,0]
# radius of cylinder
radius = 20
#height of cylinder
height = 100
# create cylinder
rs.AddCylinder(base, height, radius, False)
# normal direction of plane (world z-axis)
normal = [0,0,1]
# step increment
step = 0.5
# initial z location
z = 0
# rotation angle in degrees
angle = 137.5
# create a plane
plane = rs.PlaneFromNormal(base, normal)
# while z location is <= height
while z <= height:
# add a point on the x-axis
xaxis = rs.VectorScale(plane.XAxis, radius)
pt = rs.PointAdd(base, xaxis)
rs.AddPoint(pt)
# move the plane up by the step amount
zaxis = rs.VectorScale(normal, step)
base = rs.PointAdd(base, zaxis)
plane = rs.MovePlane(plane, base)
# rotate the plane by the angle
xf = rs.XformRotation2(angle, normal, base)
plane = rs.PlaneTransform(plane, xf)
# Increment step
z = z + step