[Closed] messy topology with boolean
Hello to everybody,
I have a question concerning the topology of a body that is created using regular boolean operations.
Consider this code:
fn UnionAB Obj1 Obj2 deleteOriginal:false =
(
undo "UnionAB" on
(
if Obj1 != undefined and Obj2 != undefined then
(
local NewObj, Name1, Name2, unionName
NewObj = copy Obj1
NewObj = NewObj + Obj2
Name1 = Obj1.name; Name2 = Obj2.name
unionName = Obj1.name + "_and_" + Obj2.name + "_Union"
if deleteOriginal == true then (delete Obj1; delete Obj2)
NewObj.name = unionName
NewObj
)else(messagebox "UnionAB has Problem with input geometry" title:"UnionAB")
)
)
for i in 0 to 10 do
(
b = box()
b.name = "MyObject" + i as string
move b [(random -10.0 25.0), (random -10.0 25.0), (random -10.0 25.0)]
b.scale = [(random 2.5 5.5) ,(random 2.5 5.5), (random 2.5 5.5)]
)
MyResult1 = UnionAB $MyObject0 $MyObject1 deleteOriginal:true -- unify the first two objects
MyResult1.name = "MyResult1"
for j in 2 to 10 do --loop to the rest objects and keep as a Previous object the MyResult and as a NextObject the current MyObject j
(
obj_n = "MyObject" + j as string--define the String for the next object
obj_next = getNodeByName obj_n exact:true--acquire the next object
previous = j - 1
obj_p = "MyResult" + previous as string--define the string of the previous object
obj_previous = getNodeByName obj_p exact:true--acquire the previous object
--and finally Union the previous object with the next one
MyResult2 = UnionAB obj_previous obj_next deleteOriginal:true
MyResult2.name = "MyResult" + j as string
)
It produces some boxes and then collapses all of them in a single body. I use a custom boolean function.
Now, here is an image that depicts the result of the above code for 2 boxes, for 4 boxes and 10 boxes.
Uploaded with ImageShack.us
With 2 boxes you get a clean result. Once you start booleans with more boxes you get some weird edges. I had this problem before and in a sense I can imagine that it is the 3ds max “way” to analyze bodies, but still, is there another way to get clean bodies from such geometric operations ?
Thank you
Well, there is. And the answer is pretty simple. Just use the ProBoolean built-in class !