-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodifierMeasure.ms
More file actions
140 lines (126 loc) · 3.35 KB
/
modifierMeasure.ms
File metadata and controls
140 lines (126 loc) · 3.35 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
-------------------------------------------------------------------------------
-- modifierMeasure.ms
-- By Ilya Floussov (ilya@conceptfarm.ca)
-- June 6th 2020
-- Measures the distance between two points and inserts that measurement into
-- a modifer
-- Supported modifiers: Extrude, Shell, Clone
-------------------------------------------------------------------------------
macroScript ModMeasure
category:"ilya_s Scripts"
internalcategory:"ilya_s Scripts"
tooltip:"Modifier Measure"
buttontext:"ModMeasure"
(
fn checkPosNeg n =
(
result = 1
if n < 0 then result = -1
result
)
fn pick2points =
(
local result = undefined
try
(
pp1= pickPoint prompt:"pick point 1" snap:#3D
pp2= pickPoint prompt:"\npick point 2" snap:#3D rubberBand:pp1
result = #()
result[1] = pp1
result[2] = pp2
)
catch()
result
)
currentMod = modPanel.getCurrentObject()
case (classof currentMod) of
(
Extrude:
(
rcmenu ComboRC
(
menuitem extAmount "Extrude Amount (Pick 2 Points)"
on extAmount picked do
(
pp = pick2points()
if pp != undefined then currentMod.amount = (checkPosNeg currentMod.amount)*(distance pp[1] pp[2])
)
)
popupmenu ComboRC
)
Shell:
(
rcmenu ComboRC
(
menuitem inner "Inner Amount (Pick 2 Points)"
menuitem outer "Outer Amount (Pick 2 Points)"
on inner picked do
(
pp = pick2points()
if pp != undefined then currentMod.innerAmount = (distance pp[1] pp[2])
)
on outer picked do
(
pp = pick2points()
if pp != undefined then currentMod.outerAmount = (distance pp[1] pp[2])
)
)
popupmenu ComboRC
)
clone:
(
rcmenu ComboRC
(
menuitem xDisp "X Displacment (Pick 2 Points)"
menuitem yDisp "Y Displacment (Pick 2 Points)"
menuitem zDisp "Z Displacment (Pick 2 Points)"
menuitem xEvenDisp "X Even Distribution (Pick 2 Points)"
menuitem yEvenDisp "Y Even Distribution (Pick 2 Points)"
menuitem zEvenDisp "Z Even Distribution (Pick 2 Points)"
on xDisp picked do
(
pp = pick2points()
if pp != undefined then currentMod.movex = (checkPosNeg currentMod.movex)*(distance pp[1] pp[2])
)
on yDisp picked do
(
pp = pick2points()
if pp != undefined then currentMod.movey = (checkPosNeg currentMod.movey)*(distance pp[1] pp[2])
)
on zDisp picked do
(
pp = pick2points()
if pp != undefined then currentMod.movez = (checkPosNeg currentMod.movez)*(distance pp[1] pp[2])
)
on xEvenDisp picked do
(
pp = pick2points()
if pp != undefined then
(
d = (distance pp[1] pp[2])/currentMod.clones
currentMod.movex = (checkPosNeg currentMod.movex) * d
)
)
on yEvenDisp picked do
(
pp = pick2points()
if pp != undefined then
(
d = (distance pp[1] pp[2])/currentMod.clones
currentMod.movey = (checkPosNeg currentMod.movey) * d
)
)
on zEvenDisp picked do
(
pp = pick2points()
if pp != undefined then
(
d = (distance pp[1] pp[2])/currentMod.clones
currentMod.movez = (checkPosNeg currentMod.movez) * d
)
)
)
popupmenu ComboRC
)--end clone
)--end case
)