Author Topic: MassBoolean  (Read 1534 times)

MagWeb

  • Administrator
  • Hero Member
  • *****
  • Posts: 1192
    • View Profile
MassBoolean
« on: March 24, 2016, 07:30:26 AM »
I'm working on a Tkinter GUI applet doing some scripted workflows with a single click.

One thing should be a mass BooleanUnion operation where multiple objects are joined.
I'm that far (and it works fine as long as there are no problems in the single Boolean steps. Just simplified):

Code: [Select]
def union(): #operation to get Union from multiple objects
    cur_objects = mm.list_selected_objects(remote)
    if len(cur_objects) <2:
        print "this script requires more than one active object"
        raw_input("Press Enter to exit...")
        os._exit(1)
    else:
        i = len(cur_objects)
        while (i > 1):       
            mm.select_objects(remote, [cur_objects[0], cur_objects[1]])
            mm.begin_tool(remote, "union")       
            mm.accept_tool(remote)           
            cur_objects.pop(1) # removes objB from the list           
            i -= 1

Now it may happen that a "boolean pair" does NOT intersect. Therefor MM falls into the Error(Aborting Tool) dialog  which interrupts the automated process.

I couldn't find some API way to confirm such a dialog - Any idea?

The simplest solution in case of not intersecting objects would be to Combine not intersecting objects instead of a failing BooleanUnion (besides the API advantages - think this would make sense for standard usage too).
Is there some query to get MM's state (meaning is it possible to check if there's some MM error doing something via API)?
Sorry if I missed something...
I'm just a user as you are. Being no Autodesk employee: I do not know where this road will lead to, nor do I claim to've all stuff got right.

MagWeb

  • Administrator
  • Hero Member
  • *****
  • Posts: 1192
    • View Profile
Re: MassBoolean
« Reply #1 on: March 25, 2016, 10:40:31 AM »
Ok, found QueryCommand_TestIntersection.
So, if true I run Union else Combine.

 :)
I'm just a user as you are. Being no Autodesk employee: I do not know where this road will lead to, nor do I claim to've all stuff got right.

RMS

  • meshmixer founder
  • Administrator
  • Hero Member
  • *****
  • Posts: 1238
    • View Profile
    • gradientspace
Re: MassBoolean
« Reply #2 on: April 12, 2016, 12:04:52 PM »
sorry, the booleans currently do not handle these cases but obviously they should! it's on the long list =)
created meshmixer - now starting gradientspace - meshmixer consulting available http://www.gradientspace.com/consulting