Skip main navigation

Hurry, only 2 days left to get one year of Unlimited learning for £249.99 £174.99. New subscribers only. T&Cs apply

Find out more

attractor point

Glenn demonstrates a common way of manipulating geometry in a point list through something called an Attractor Point.

what’s in this video

In this video I demonstrate a common way of manipulating geometry using an attractor point. During the demonstration I introduce a function that we have not used before in the course—the rs.Distance function.

check your knowledge

[Pause the video and take a moment to practice using attractor points]
Use the attractor point system in the Nested Loop: 2D Point Matrix code to manipulate the rotational angle of the transformed geometry.

tutorial code


#ATTRACTOR POINT
import rhinoscriptsyntax as rs

#create an empty list
ptList = []

#input a point to use as an attractor
attrPt = rs.GetObject('select an attractor point',rs.filter.point)

#incremental loop to generate points
for i in range(10):
for j in range(10):
#define x in terms of i
#define y in terms of j
x = i
y = j
z = 0

rs.AddPoint(x,y,z)
#rs.AddTextDot((x,y,z), (x,y,z))

#save point values in a list
ptList.append((x,y,z))

#loop through point list and print out index number and values
for i in range(len(ptList)):
# print i, ':', ptList[i]
# rs.AddTextDot(i, ptList[i])

####CREATE TRANSFORMATION OF GEOMETRY####
#measure distance between attractor point and current point in the list
distance = rs.Distance(ptList[i], attrPt)
print distance/20
#create circle using distance value as radius
rs.AddCircle(ptList[i], distance/20)

This article is from the free online

Design Computing: 3D Modeling in Rhinoceros with Python Rhinoscript

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now