###SCRIPT ABOUT TESSELATING
SURFACE TO XGONS###
import rhinoscriptsyntax
as
rs
from math import*
from System.Drawing import Color
def SampleSurface(StrSurf,IntUDivisions,IntVDivisions):
ListUDomain = rs.SurfaceDomain(StrSurf,0)
ListVDomain = rs.SurfaceDomain(StrSurf,1)
FloatUStep = (ListUDomain[1]-ListUDomain[0])/IntUDivisions
FloatVStep = (ListVDomain[1]-ListVDomain[0])/IntVDivisions
PtsList=[]
for i in rs.frange(ListUDomain[0],ListUDomain[1]+FloatUStep,FloatUStep):
TempList = []
for j in rs.frange(ListVDomain[0],ListVDomain[1],FloatVStep):
TempList.append(rs.EvaluateSurface(StrSurf, i , j
))
PtsList.append(TempList)
rs.AddPoint(PtsList[0][0])
#i need to know which element within my
lists i want to get
for i in range (0,len(PtsList)):
for j in range(0,len(PtsList[i])):
Pts = rs.AddPoint(PtsList[i][j])
NewLay01 = rs.AddLayer("Points",Color.HotPink)
Pts02Lay = rs.ObjectLayer(Pts,"Points")
return PtsList
StrSurf = rs.GetObject("get
surface",8)
#AttrPt = rs.GetPoint("get
attractor")
IntUDivisions = 40
IntVDivisions = 20
ListOfPoints = SampleSurface(StrSurf,IntUDivisions,IntVDivisions)
for i in range(0,len(ListOfPoints)-2,2):
for j in range(0,len(ListOfPoints[i])-3,4):
Pt01 = ListOfPoints[i+1][j]
Pt02 = ListOfPoints[i+2][j+1]
Pt03 = ListOfPoints[i+2][j+2]
Pt04 = ListOfPoints[i+1][j+3]
Pt05 = ListOfPoints[i][j+2]
Pt06 = ListOfPoints[i][j+1]
Patch = rs.AddPolyline([Pt01,Pt02,Pt03,Pt04,Pt05,Pt06,Pt01])
NewLay03 = rs.AddLayer("Polylines",Color.DarkTurquoise)
PoLineLay = rs.ObjectLayer(Patch,"Polylines")
for i in range(0,len(ListOfPoints)-3,2):
for j in range(0,len(ListOfPoints[i])-5,4):
Pt01b = ListOfPoints[i+2][j+2]
Pt02b = ListOfPoints[i+3][j+3]
Pt03b = ListOfPoints[i+3][j+4]
Pt04b = ListOfPoints[i+2][j+5]
Pt05b = ListOfPoints[i+1][j+4]
Pt06b = ListOfPoints[i+1][j+3]
Patch02 = rs.AddPolyline([Pt01b,Pt02b,Pt03b,Pt04b,Pt05b,Pt06b,Pt01b])
PoLineLay02 = rs.ObjectLayer(Patch02,"Polylines")
No comments:
Post a Comment