View Full Version : GetFaceSelection convertion to interger, how?
f97ao 09-20-2004, 04:59 AM I use the polyop.getFaceSelection $ to get a face.
I get a <face list> as an answer say #(10). problem is how on earth do I convert this into an integer?
I need to calculate the area of the face using polyop.getFaceArea $ INTEGER_VALUE
problem is I have to enter an integer value here, it won't accept the face list, and I can't convert the vert list into an integer.
Also the length of the face list is 595 (as many as there are faces), if the length was only 1 i could just get the first element.
A very strange problem :P
/Andreas
|
|
soshiant
09-20-2004, 07:58 AM
You dont get #() (array), you get #{} (bitArray)
May be you can do some better things with bitwise operators.
see maxscript ref for more about bitarrays and bit.
a = polyop.getFaceSelection $
b = a as array
polyop.getFaceArea $ b[i] --i can be any int number and b[i] is int
this works?
see my thread about biped and ctrls any idea?
f97ao
09-20-2004, 10:30 AM
You dont get #() (array), you get #{} (bitArray)
May be you can do some better things with bitwise operators.
see maxscript ref for more about bitarrays and bit.
a = polyop.getFaceSelection $
b = a as array
polyop.getFaceArea $ b[i] --i can be any int number and b[i] is int
this works?
see my thread about biped and ctrls any idea?
Hi there, thanks for the answer, I managed to solve it after quite some while, I did it almost exactly like you said. I wrote
a=polyop.getFaceSelection $
b=a as array
sel=b[1]
and since the selection in this case always was only one size, then it was always at the first number.
/Andreas
Hi there, thanks for the answer, I managed to solve it after quite some while, I did it almost exactly like you said. I wrote
a=polyop.getFaceSelection $
b=a as array
sel=b[1]
and since the selection in this case always was only one size, then it was always at the first number.
/Andreas
Just a quick note that since MAXScript is expression based, you can do shortcuts like
sel = ((polyop.getFaceSelection $) as array)[1]
f97ao
09-20-2004, 07:59 PM
Just a quick note that since MAXScript is expression based, you can do shortcuts like
sel = ((polyop.getFaceSelection $) as array)[1]
Yea, thanks Bobo, I know about this one, but ARG!, readability. :)
/((Andreas as array)[1] as lotsofwork)==true
DentonVanZan
09-24-2004, 09:00 PM
man if I were you I would write this way:
fn getFaceSelectionArea =
(
local totalAr = 0
for i in (polyOp.getFaceSelection selection[1]) do
(
local faceArea = polyOp.getFaceArea selection[1] i
totalAr += faceArea
)
return totalAr
)
see ya
CGTalk Moderation
01-19-2006, 08:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.