[MaxScript] Test if ProBoolean.CreateBooleanObject() fails

[MaxScript] Test if ProBoolean.CreateBooleanObject() fails

JasonCampbell
Contributor Contributor
1,580 Views
5 Replies
Message 1 of 6

[MaxScript] Test if ProBoolean.CreateBooleanObject() fails

JasonCampbell
Contributor
Contributor

Hi Guys,

 

Is there a way to test if a ProBoolean.CreateBooleanObject() call fails?

 

If I try something like this;

 

[code]

result = result=ProBoolean.CreateBooleanObject source target 3 0 0;

[/code]

 

It always returns 'OK' even if the merge fails.

 

Thanks in advance.

0 Likes
Accepted solutions (1)
1,581 Views
5 Replies
Replies (5)
Message 2 of 6

attilaszabo
Alumni
Alumni
Accepted solution

Jason, the CreateBooleanObject() function returns void hence you always get OK as a result.

I agree that it would be much more helpful if it returned the new object it created if successful, and undefined it it werent.

 

 

Attila Szabo
Product Owner, 3ds Max
Autodesk
Message 3 of 6

larryminton
Autodesk
Autodesk

Bit of a hack, but you can check the objects.count value before and after the call. If successful, the target node is deleted, so the count will go down by one.

 


Larry Minton
Principal Engineer, M&E-Design Animation
0 Likes
Message 4 of 6

JasonCampbell
Contributor
Contributor

The problem with counting the objects is that when the boolean fails the target object is being deleted anyway, resulting in dissapearing meshes. So the object count is going down either way.

0 Likes
Message 5 of 6

larryminton
Autodesk
Autodesk

I don't know what your definition of failure is here.

 

Is the operation succeeded in terms of creating the boolean object?  That is, what class is the source node after you make the call and it 'fails'?

 

If you select the source object and go to Operands SO mode, are the 2 original objects shown in the Parameters rollout?

 


Larry Minton
Principal Engineer, M&E-Design Animation
0 Likes
Message 6 of 6

JasonCampbell
Contributor
Contributor

My definintion of failure is

 

3dsmax_fault.png

 

The objects don't have any self intersecting geometry (unless ProBoolean is creating it after multiple merges).

 

In the occurance of the above error the 'source' geometry is deleted and the 'target' geometry becomes the result of the operation. So, you end up with one less item of geometry, breaking the 'count' workaround.

0 Likes