-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsliptSrf.py
More file actions
58 lines (44 loc) · 1.22 KB
/
sliptSrf.py
File metadata and controls
58 lines (44 loc) · 1.22 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
import rhinoscriptsyntax as rs
import rsTools
reload(rsTools)
from rsTools import *
def isVertical(crv,tolerance=0.0001):
start=rs.CurveStartPoint(c)
end=rs.CurveEndPoint(c)
# if abs(start[2]-end[2])<tolerance: hor_crvs.append(c)
if abs(start[1]-end[1])<tolerance and abs(start[0]-end[0])<tolerance:
return True
return False
def isHorizontal(crv,tolerance=0.0001):
start=rs.CurveStartPoint(c)
end=rs.CurveEndPoint(c)
if abs(start[2]-end[2])<tolerance:
return True
return False
objs=rs.ObjectsByLayer('GENMASSING')
srf=objs[0]
print(srf)
boundary=rs.DuplicateSurfaceBorder(srf)
pts=rs.CurveEditPoints(boundary)
# rs.AddPoints(pts)
crvs=rs.ExplodeCurves(boundary,True)
hors=[]
for c in crvs:
if isHorizontal(c): hors.append(c)
up=(0,0,100000000)
cutters=[]
for c in hors:
p=rs.CurveStartPoint(c)
start=rs.VectorSubtract(p,up)
end=rs.VectorAdd(p,up)
l=rs.AddLine(start,end)
rs.ObjectName(l,'cutters')
cutters.append(l)
rs.DeleteGroup('cutters')
group=rs.AddGroup('cutters')
rs.AddObjectsToGroup(cutters,'cutters')
# rs.Command('!_selname_pause_cutters')
guid=rs.Command('! -_SelGroup _cutters')
print(guid)
# rs.SplitBrep(srf,cutters)
# rs.SelectObjects(hors)