-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrhinocommontest2.py
More file actions
63 lines (47 loc) · 1.33 KB
/
rhinocommontest2.py
File metadata and controls
63 lines (47 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# -*- coding: utf-8 -*-
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
import Rhino.Geometry
targId = rs.GetObject("Select the first object to replace", rs.filter.surface, preselect=True,)
#obj = sc.doc.Objects.Find(targId)
#if not targId:return
#point = rs.GetPointOnSurface(surface, "Point on surface")
obj = sc.doc.Objects.Find(targId)
srf = rs.coercesurface(targId)
#point = rs.GetPointOnSurface(srf, "Point on surface")
print srf
def intFlipBool(tf):
return abs(tf-1)
def frange(start, count, step=1.0):
''' "range()" like function which accept float type'''
i = start
for c in range(count):
yield i
i += step
def func(srf, dir, count):
domains = []
dom = srf.Domain(dir)
print dom
dist = dom.Length/count
i = dist
while i < dom.Length:
domains.append(i)
i = i+dist
crvs = map(lambda x: srf.IsoCurve(intFlipBool(dir), x), domains)
map(lambda x: sc.doc.Objects.AddCurve(x), crvs)
return crvs
doms = func(srf, 1, 10)
print doms
#rs.AddPoint(point)
#dom1 = srf.Domain(0)
#dom2 = srf.Domain(1)
#print dom1
#print dom2
#print type(dom1)
#print dom1.Length
#b, u_parameter, v_parameter = srf.ClosestPoint(point)
#print b, u_parameter, v_parameter
#iso_curve = srf.IsoCurve(1, u_parameter)
#print iso_curve
#sc.doc.Objects.AddCurve(iso_curve)