-
Notifications
You must be signed in to change notification settings - Fork 1
/
find_small_rigid_blocks.py
67 lines (57 loc) · 1.58 KB
/
find_small_rigid_blocks.py
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
63
64
65
66
67
import rhinoscriptsyntax as rs
def test():
print 'hellow'
def zero_vol_rigid_blocks():
tolerance = 1e-4
rs.Command("-_show Enter")
#rs.Command("-_SelMesh Hide ")
rs.Command("-_SelAll ")
object_id = rs.GetObjects(message="Bla", preselect=True)
count = 0
for object_i in object_id:
#deselect any objects
rs.Command("-_selnone")
#get block id
object_i = str(object_i)
block = rs.Command("-_SelID " + object_i)
#getvolume
i = rs.coercebrep(object_i)
blockVolume = i.GetVolume()
#delete where appropriate
if blockVolume < tolerance:
rs.Command("-_Delete")
print "Deleting block"
count += 1
rs.Command("-_SelNone ")
count = str(count) + " zero volume blocks were deleted"
print count
#tolerance = 1e-4
#rs.Command("-_show Enter")
##rs.Command("-_SelMesh Hide ")
#rs.Command("-_SelAll ")
#object_id = rs.GetObjects(message="Bla", preselect=True)
#count = 0
#
#for object_i in object_id:
# #deselect any objects
# rs.Command("-_selnone")
#
# #get block id
# object_i = str(object_i)
# block = rs.Command("-_SelID " + object_i)
#
# #getvolume
# i = rs.coercebrep(object_i)
#
# blockVolume = i.GetVolume()
#
#
# #delete where appropriate
# if blockVolume < tolerance:
# rs.Command("-_Delete")
# print "Deleting block"
# count += 1
#
#rs.Command("-_SelNone ")
#count = str(count) + " zero volume blocks were deleted"
#print count