# How to know surface coordinate of the cylinder?

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]

#build matrix of point
def buildMatrix(surfacepoint):
points = []
points.append(surfacepoint,surfacepoint)
rs.EnableRedraw(True)
``````

Can you post an image or some sample geometry, that demonstrates what you are trying to accomplish?

– Dale 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.)

So, some psueudocode might be:

``````#set up parameters
ctr=center point (say, 0,0,0)
ht=height of "cylinder"
z_inc=incremental height to move in Z for each point
point_array=[]
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
``````

HTH, --Mitch

1 Like

import rhinoscriptsyntax as rs
import math

ctr = (0,0,0,)
height = 50
z_axis = 50

#first point on cylinder
point_array = []

#for rest of the points
for last_pt in range(last_point)
new_pt = rotate(last_pt, 137.5, copy = yes)
move(new_pt, z_axis)
point_array.append(new_pt)
last_pt = new_pt

@Helvetosaur, I tried to make a python code from yout psedocode but I failed. Could you please save me from error?

@dale Here I am sharing the code but not getting result:

import rhinoscriptsyntax as rs
import math

ctr = (0,0,0,)
height = 50
z_axis = 50

#first point on cylinder
point_array = []

#for rest of the points
for last_pt in range(last_point)
new_pt = rotate(last_pt, 137.5, copy = yes)
move(new_pt, z_axis)
point_array.append(new_pt)
last_pt = new_pt

Here is one method, using just rhinoscriptsyntax:

``````import rhinoscriptsyntax as rs

# base point of cylinder
base = [0,0,0]
#height of cylinder
height = 100

# create cylinder

# 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

# move the plane up by the step amount
zaxis = rs.VectorScale(normal, step)
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
``````

Let me know if you have any questions.

– Dale

1 Like