BoolPro: A better mesh boolean


#61

I was thinking of maybe making a MEL-window with some options (would be nice if you quickly could change the operation mode for example) and then make that window dockable so that it can be integrated into other UIs.

It was just a thought though - I haven’t actually started making any UI.


#62

Yes, could you please detail the options. Why would you find an additional window with an operation combobox more convenient than the current combo in the attribute editor?


#63

I’m trying to run this script in Maya 2013 on Max OSX Lion and when I run it nothing happens. No errors. Just the script shows up in the console. :confused: I’ve got the plugin loaded via the plugin manager.


#64

Select two meshes, such as two spheres, then run the script. Else it just prints “Please select at least two meshes”.

The line

res = mc.createNode("mesh")

creates a new mesh, such as polySurface1. Do you have such an object in your scene?

The line

bpro = mc.createNode('boolPro');

creates a new boolPro node, which is later connected to polySurface1. Do you have such a node in your scene?


#65

Simply put, no. I select my two polygon objects (tried with two spheres as well as the actual objects I wanted perform this on), attempt to run the script. The script does not execute, and simply ends up having itself printed in the console. No changes are made to the objects, no new meshes are created. I’ve confirmed that the plugin is loaded in the plugin manager.

EDIT: I got the plugin working. It turns out although it was loaded via plugin manager, the python script wasn’t working because it was looking for boolPro.bundle and the file name of the bundle loaded did not match. I renamed the bundle to match what the script was looking for and it worked.


#66
  1. I wrote two lines of code, and explained what they should do. Please run each of them separately (copy/paste them to the python command), and tell me if they do what they suppose to do.

  2. Check the indentation (spacing before a line of code). For example, if the ‘return’ line has the same indentation as the if, it would be executed anyway, and nothing would happen.

  3. Make sure that you execute the last line “main()”, else only a procedure is defined and nothing would happen. After running the script, please try to run ‘main()’, with nothing selected, and see what happens (this check if the procedure was defined or not).

  4. Concerning the two last steps, let’s verify what you are doing:
    4.1. With your browser, go to
    http://svn.code.sf.net/p/mymayaplugins/code-0/trunk/boolPro/connect_boolPro.py
    4.2. Ctrl+a to select everything, and then ctrl+c to copy
    4.3. Open the script editor, go to the python tab, and ctrl+v to paste.
    4.4. Press the ‘enter’ in the keypad (not the other one), to execute the whole script.

  5. An alternative to step 4, go again to my link, and save the script on your hd with a name connect_boolPro.py. From the script editor, file> load script, select the script you saved, and execute it with the keypad enter.

  6. Start a manual debug, i.e. test each line of the script to see if it is executed, and see where it fails:
    6.1. Clear the selection, and run the script. It should print: “Please select two meshes”. If it works (i.e. prints select two…), select two objects and continue to the next steps.
    6.2. After the ‘return’ line, add a line

print "Hello World"

, BUT with the same indentation as the ‘if…’ line. Run the script, and hello should be printed.
6.3. Move the print hello line after

res = mc.createNode("mesh")

with the same indentation as this line, and see if it’s printed.
6.4. Continue this way, i.e. moving the print hello line down the script (after the next line of code and don’t forget indentation), and check where it fails (doesn’t print hello).
Since no polySurface1 is created, there should definitely be a problem with the first lines or the final main().
BTW, the boolPro1 node can only be seen if you uncheck the display> dag objects only in the outliner.

Ho, and please don’t quote all of this when replying :wink:


#67

Still it doesn’t explain why a polySurface1 wasn’t created, and why creating a boolPro node has failed, but I’m glad you got it working.


#68

I went through the manual setup you described in the OP and was able to get the nodes created. When I ran the full script it just wasn’t running at all (I’m guessing it’s because it wasn’t finding the plugin as it was named)

All in all, it’s working now with a little fiddling, and man is it awesome! Thanks for putting the time in to make such a great plugin.


#69

Hi there.
Excellent stuff here. Thanks for the plugin but:

It is not good in maya 2014, if you select more than two objects things seem strange when you change boolean type and in some cases there is no object.

At some time I had this error in the output window:

FACE LOOP ERROR: 000000000D0CF1E0-000000000D0CF320 : 1 
FACE LOOP ERROR: 000000000D0CF0A0-000000000D0CF258 : -1 
FACE LOOP ERROR: 000000000D0CEFD8-000000000D0CF0C8 : -1 
FACE LOOP ERROR: 000000000D0CF0F0-000000000D0CF1E0 : 1 
FACE LOOP ERROR: 000000000D0CF050-000000000D0CF280 : -1 
FACE LOOP ERROR: 000000000D0CF140-000000000D0CF208 : 1 
FACE LOOP ERROR: 000000000CE46F58-000000000CE47048 : 1 
FACE LOOP ERROR: 000000000CE46EE0-000000000CE46F58 : 1 
FACE LOOP ERROR: 000000000D0CEFB0-000000000D0CF0F0 : 1 
FACE LOOP ERROR: 000000000D0CF0C8-000000000D0CF208 : -1 
FACE LOOP ERROR: 000000000D0CF000-000000000D0CF190 : -1 
FACE LOOP ERROR: 000000000D0CF028-000000000D0CF2D0 : 1 
FACE LOOP ERROR: 000000000CE47020-000000000CE47110 : -1 
FACE LOOP ERROR: 000000000D0CF258-000000000D0CF348 : -1 
FACE LOOP ERROR: 000000000D0CF2F8-000000000D0CF348 : 1 
FACE LOOP ERROR: 000000000CE47020-000000000CE47070 : 1 
FACE LOOP ERROR: 000000000D0CF2A8-000000000D0CF2D0 : -1 
FACE LOOP ERROR: 000000000D0CEFD8-000000000D0CF140 : 1 
FACE LOOP ERROR: 000000000CE46F08-000000000CE46FD0 : -1 
FACE LOOP ERROR: 000000000CE46EE0-000000000CE46F08 : -1 
FACE LOOP ERROR: 000000000D0CEFB0-000000000D0CF320 : -1 
FACE LOOP ERROR: 000000000D0CF0A0-000000000D0CF2F8 : 1 
FACE LOOP ERROR: 000000000D0CF000-000000000D0CF280 : 1 
FACE LOOP ERROR: 000000000D0CF028-000000000D0CF230 : -1 
FACE LOOP ERROR: 000000000D0CF050-000000000D0CF190 : 1 
FACE LOOP ERROR: 000000000D0CF230-000000000D0CF2A8 : -1 
FACE LOOP ERROR: 000000000CE47048-000000000CE47110 : 1 
FACE LOOP ERROR: 000000000CE46FD0-000000000CE47070 : -1

it does not do this error all the times.

Can you please check this out?


#70

As mentioned before, boolPro cannot eat anything, and ideally it prefers watertight clean manifolds (try cleanup). Please post the meshes.


#71

I am only using primitives and a bolean from primitives.

Everything is fine.

Confused because B - A does an interception between even objects and also a difference with the odd objects counting from the last 4 selected objects added to the last object space.

Maya crashes when I try to move objects in B - A.

Maybe this can be useful or there is something wrong here?


#72

I’ll need an example.


#73

here is the example in the attachment. It is in maya 2014 mb.

The selection started from top object to the bottom object in the outliner.


#74

Is there a chance that you give me a full description of the problem and how to reproduce it?

I’m selecting all the objects from pSphere1 to pCube1. I’m running the boolPro setup script, and I change the operation to B-A. I’m translating some of the objects, and everything is fine. Now what?


#75

The crash didn’t happen anymore. So I think you should forget it. Maybe something from my setup.

Sorry to bother.

Keep up with it.
Thanks.


#76

the face loop error appeared again with simple objects from primitives.
See this mb file select from first object and try to make A - B or interception, it makes face loop error.

EDIT: I must triangulate the cubes before making A - B and things seem to be fine.

2ndEDIT: The first object in the file was a boolean that did nor work well, try seeing it shaded.
It seems that booleans with cubes do not work.


#77

I selected all the objects, ran boolPro (on default union mode), and got the face loop error. The problem is with the first object. I mentioned this before, and now I added it as a note to the initial post on this thread:

  • Boolean operations are defined for solids. Thus, any input object should be watertight and with planar faces (preferably triangles). Whatever booPro does with other objects is magic, which might fail.

Also, the first object fails the cleanup test, as the note before that warns:

  • If the operation fails, first check the validity of the input meshes. Each input mesh should pass the Mesh> Cleanup with all the parameters on. If the problem persists please post here a link to your two meshes (.obj or .fbx).

So, please post an example with watertight objects, which passed the cleanup test.


#78

As I said in the previous post edit, the object that is not water tight was created with boolpro from 3 primitives.

Here is a scene with the objects that made the problem.
Select from top and do A - B.


#79

Good job, you found a bug (or at least I can’t remember it).

In the following example I created two cubes. One is scaled along x,z axes and one is scaled along y-axis. Then I did boolean union.

[img]http://i743.photobucket.com/albums/xx77/zoharl/maya/2cubes_boolpro_bug_zps19fb85ac.png[/img]

BUG: In a boolean operation (e.g. union) between two objects A and B, if A is fully contained inside a face in B, then the face would disappear. Temporary solution: refine the face (Mesh> smooth).


#80

I hope you got a clue on how to fix it. :wink: