A Ring

This is an assignment of computational design course. A sketchy design of a ring.

Basically I played with surface domain: sub-divide the surface and create circles on each surface domain. Size and thickness of the circle changes according to the divided surface.

code in rhinoscript:

import rhinoscriptsyntax as rs
rs.EnableRedraw(False)
#Creat Rail 1
Crv1Pts=[(-40,0,6),(0,40,3),(40,0,20),(0,-40,3),(-40,0,6)]
Crv1 = rs.AddCurve(Crv1Pts,3)
#Creat Rail 2
Crv2Pts=[(-40,0,-6),(0,40,-3),(40,0,-20),(0,-40,-3),(-40,0,-6)]
Crv2 = rs.AddCurve(Crv2Pts,3)
#Creat Rings
rs.AddPipe(Crv1,[0,1,2,3],[1,3,6,3])
#Creat profile
StartPt1 = rs.CurveStartPoint(Crv1)
StartPt2 = rs.CurveStartPoint(Crv2)
strProfile = rs.AddInterpCurve([StartPt1,(0,29,0),StartPt2])
#Creat Surface
strSrf = rs.AddSweep2([Crv1,Crv2],[strProfile])
rs.RebuildSurface(strSrf,(3,3),(30,8))
#Get Surface Domain
DomainU = rs.SurfaceDomain(strSrf,0)
DomainV = rs.SurfaceDomain(strSrf,1)
#get circles on each unit of surface
arrCir = []
arrPt = []
for i in range(1,int(DomainU[1])+1):
for j in range(1,int(DomainV[1])+1):
pt1 = rs.EvaluateSurface(strSrf,i-1,j-1)
pt2 = rs.EvaluateSurface(strSrf,i-1,j)
pt3 = rs.EvaluateSurface(strSrf,i,j)
pt4 = rs.EvaluateSurface(strSrf,i,j-1)
crv = rs.AddCurve([pt1,pt2,pt3,pt4,pt1],3)
ptcenter = (pt1+pt2+pt3+pt4)/4
crv = rs.ScaleObject(crv,ptcenter,[0.7,0.7,0.7])
pullcrv = rs.PullCurve(strSrf,crv,True)
if len(pullcrv)>1:
joinedcrv = rs.JoinCurves(pullcrv,True)
else:
joinedcrv = pullcrv[0]
arrCir.append(joinedcrv)
arrPt.append(ptcenter)
#get length range of circles
arrLength = [rs.CurveLength(i) for i in arrCir]
SortLength = arrLength[:]
SortLength.sort()
Lenmin = SortLength[0]
Lenmax = SortLength[-1]
#define a mapping tool
def translate(OldValue, OldMin, OldMax, NewMin, NewMax):
OldRange = (OldMax - OldMin)
if (OldRange == 0):
NewValue = NewMin
else:
NewRange = (NewMax - NewMin)
NewValue = (((OldValue - OldMin) * NewRange) / OldRange) + NewMin
return NewValue
for i in range(len(arrCir)):
#move circle through normal
PtUV = rs.SurfaceClosestPoint(strSrf,arrPt[i])
Pt = rs.EvaluateSurface(strSrf,PtUV[0],PtUV[1])
Normal = rs.SurfaceNormal(strSrf,PtUV)
UnitNormal = rs.VectorUnitize(Normal)
Distance = translate(arrLength[i],Lenmin,Lenmax,0.5,3)
Vector = rs.VectorScale(UnitNormal,Distance)
#scale circle accordingly
scale = translate(arrLength[i],Lenmin,Lenmax,1.3,1.6)
cir = rs.ScaleObject(arrCir[i],Pt,[scale,scale,scale],True)
ForwardCircle = rs.CopyObject(cir,Vector)
# vec to back side
Vec = rs.VectorScale(UnitNormal,0.3)
ReversedVec = rs.VectorReverse(Vec)
BackCircle = rs.MoveObject(cir,ReversedVec)
# add loft surface
UnitSrf = rs.AddLoftSrf([
ForwardCircle,
arrCir[i],
BackCircle],
None,
None,0,0,0,True)
rs.DeleteObject(ForwardCircle)
rs.DeleteObject(BackCircle)