Notifications
Clear all
[Closed] Detach All Sub Elements
May 10, 2007 12:16 am
Quick little script I whipped up for a co-worker. The getelements fn I believe was done by some guys at Brazil.
fn getelements obj=
(
try
(
f=obj.numfaces
eles=#()
done=#()
for i=1 to f do
(
if (finditem done i)==0 then
(
case (classof obj) of
(
editable_mesh:(faces=(meshop.getElementsUsingFace obj #(i)) as array)
editable_poly:(faces=(polyop.getElementsUsingFace obj #(i)) as array)
)
append eles faces
join done faces
)
)
)
catch(eles=undefined)
return eles
)
try
(
array_poly = getelements $
for k = 1 to array_poly.count do
(
array_poly = getelements $
for j = 1 to array_poly.count do
(
array_poly[j] = array_poly[j] as BitArray
)
polyOp.detachFaces $ array_poly[1] asnode:true name:("Shatter_object_"+(k as string))
cur_element = getnodebyname ("Shatter_object_"+(k as string))
cur_element.pivot = cur_element.center
)
)
catch ()
2 Replies
May 10, 2007 12:16 am
hehe just did a quick search on the forums and found MUCH better scripts. So you can pretty much ignore this one. Still I suppose it’s one more way to skin a cat. A really slow and painful way.
May 10, 2007 12:16 am
Sometimes when your angry at your models you want to do that :P, still thanks for posting. It helps to look and see how someone went about doing solving a problem through code.
-Baker