-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquadrify.ms
67 lines (57 loc) · 1.2 KB
/
quadrify.ms
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
function getEdgeLength theEditablePoly iEdge =
(
local aiEdgeVerts = polyOp.getEdgeVerts theEditablePoly iEdge
local ap3VertPosition = for iVert in aiEdgeVerts collect
polyOp.getVert theEditablePoly iVert
return (distance ap3VertPosition[1] ap3VertPosition[2])
)
fn quad =
(
try with undo on
(
v1 = #()
v2 = 0
v3 = #()
v4 = #()
v5 = #()
print "start quad"
obj = $
convertTo obj PolyMeshObject
--elenco di tutti gli edge
for i = 1 to (polyop.getNumEdges obj) do
(
append v1 i
)
for i in v1 do
(
--tutte le faccie che toccano un edge
v2 = polyop.getEdgeFaces obj i
if v2.count == 2 then
(
--tutte gli edge di quella faccia
v3 = polyop.getFaceEdges obj v2[1]
v4 = polyop.getFaceEdges obj v2[2]
if (v3.count == 3) and (v4.count == 3) then
(
success = true
for k in v3 do
(
if ( getEdgeLength obj k )>(getEdgeLength obj i) then
success=false
)
for k in v4 do
(
if ( getEdgeLength obj k )>(getEdgeLength obj i) then
success=false
)
if(success) then
appendIfUnique v5 i
)
)
)
obj.EditablePoly.SetSelection #Edge (v5 as bitArray)
obj.EditablePoly.Remove selLevel:#Edge
)catch()
print "done"
)
quad()