forked from CADacombs/rhinopython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxBrep_EdgeContinuity_Interior_All.py
More file actions
76 lines (54 loc) · 2.29 KB
/
xBrep_EdgeContinuity_Interior_All.py
File metadata and controls
76 lines (54 loc) · 2.29 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
"""
210320: Created.
"""
import Rhino
import Rhino.DocObjects as rd
import Rhino.Geometry as rg
import rhinoscriptsyntax as rs
import scriptcontext as sc
def main():
gBs = rs.GetObjects("Select polysurfaces", filter=16,
preselect=True, select=True)
if not gBs: return
sc.doc.Views.RedrawEnabled = False
sc.doc.Objects.UnselectAll() # For first call to _EdgeContinuity.
Rhino.RhinoApp.SetCommandPrompt("")
for iB in xrange(len(gBs)):
gB = gBs[iB]
rdB = rs.coercerhinoobject(gB)
rgB = rdB.Geometry
compIdxs = [None, None]
for idxE in xrange(rgB.Edges.Count):
edge = rgB.Edges[idxE]
sPrompt = "Processing edge {} of {}".format(
idxE+1, rgB.Edges.Count)
if len(gBs) > 1:
sPrompt += " in polysurface {} of {}".format(
iB+1, len(gBs))
sPrompt += " ..."
Rhino.RhinoApp.CommandPrompt = sPrompt
if sc.escape_test(throw_exception=False):
print "Script interrupted by user."
return
if edge.TrimCount == 2:
iTs = edge.TrimIndices()
for i in 0,1:
compIdxs[i] = rg.ComponentIndex(
type=rg.ComponentIndexType.BrepTrim,
index=iTs[i])
for compIdx in compIdxs:
rdB.SelectSubObject(
componentIndex=compIdx,
select=True,
syncHighlight=True,
persistentSelect=True)
rc = Rhino.RhinoApp.RunScript("_EdgeContinuity _Enter", echo=False)
Rhino.RhinoApp.CommandPrompt = sPrompt
for compIdx in compIdxs:
rdB.SelectSubObject(
componentIndex=compIdx,
select=False,
syncHighlight=True,
persistentSelect=True)
sc.doc.Views.RedrawEnabled = False
if __name__ == '__main__': main()