It's a simple enough project - take some rectangular solids that have had some machining done to them, recreate the original, rectangular solid in the same place, and do a boolean subtract, the result of which gives me the machining only .. a "negative" of the machined solid, in a way.
The code loops thru an entire assembly of these solids, in effect showing an entire product in this fashion. It works perfectly - 95% of the time. When it works perfectly, every single solid in the assembly comes back with only the machining showing. But ocasionally, it fails, and every single solid in the assembly comes back as a rectangular slab - the boolean subtract operation is failing on every single solid in the product.
When it fails, it fails always on the same product, and on every part in that same product. When it works, it always works on every single part in the product. The products it works on, it always seems to work on. The products it doesnt work on, it always doesnt work on. Except, occasionally, every few days, one that failed previously, would now work.
Ive checked the origins of each solid, the original vs the new clone. relative to each other. They seem to be exact, or at least to 6 decimal places. I would think that even being slightly off would give me a subtract result showing .001 of an entire face, etc... but it doesnt. After the routine fails, I can manually go back and do the subtract operation successfully.
I spent the last 2 days trimming down something to post here - I trimmed down the drawing to 2 assemblies, one of which works, and one of which didnt - and then started removing modules in the code, etc, to get something easier for you guys to follow. And I made sure that, while I was doing this, that one assembly still failed, and one still worked - until this morning. Now both assemblies work - in both the trimmed down code, and the original code. In the original drawing, the original code still fails on the same assmbly of solids. (I cant run the trimmed down code on the original drawing, but I dont think thats the issue.)
WTF? This is driving me nuts! Is there something in the process of boolean subtraction that can generate a failure? There is no return code for the subtraction operation? For whats its worth, here is the process I use:
1) Loop thru the assembly of solids and add each one to a collection. (works successfully)
2) Take the collection and do a copyobjects. ( I dont want to modify the original solids) (works successfully)
3) Loop the copied objects and store the handles. (works successfully)
4) Then, for each individual copied object, do the following:
4a) create another solid in the same place (works successfully)
4b) do a subtraction operation on the new, rectangular solid, and the copy of the machined solid. (sometimes fails)
4c) drop the copied solid into a blockref (works, even with the failed rectangular slab)
4d) start a new document, and do a copyobject from the source, to the destination, document (always works)
4e) delete the original blockref from the source document (always works)
Any ideas on where i can even *start* to look, to find this bug?
thanks, guys ...