I would like to reversing a Boolean operation if an error happens.
I have two solids that when I try to perform a Subtract Boolean Operation gives me an error. When the error happens I lose both solids. I would like to be able to reverse the subtraction in an event of an error so that I still have both solids.
Thank you in advance.
Dim Solid_1 as Solid3d = CreateSoldFromPl(plinePoints1) Dim Solid_2 as Solid3d = CreateSoldFromPl(plinePoints1) Try Solid_1.BooleanOperation(BooleanOperationType.BoolSubtract, Solid_2) End Try
Solved! Go to Solution.
Solved by Hallex. Go to Solution.
Hi Fieldguy,
Yes I have tried the Try Catch , but it just catches the error. The solids are consumed after the unsuccessful subtraction.
Gilles,
Sorry, i just had a typo. The CreateSoldFromPL is just a function that creates a solid from polyline.
Updated Code
Dim Solid_1 as Solid3d = CreateSoldFromPl(plinePoints1) Dim Solid_2 as Solid3d = CreateSoldFromPl(plinePoints2) Try Solid_1.BooleanOperation(BooleanOperationType.BoolSubtract, Solid_2) End Try
Sorry, I should have posted the error that i get:
The Boolean operation on solids failed.
Modeling Operation Error:
System inconsistency processing edge coincidence.
Citation
You should delete a smaller solid right after this line of code,
otherwise you leave a solid with degenerate geometry
(i.e. zero geometry) in the database and that could cause issues:
solid1.BooleanOperation(BooleanOperationType.BoolSubtract, solid2)
Add this line:
solid2.Erase()
tr.Commit() etc
Found this explanation in my code collection
Thank you Fieldguy, Gilles and Hallex.
I must have had a brain freeze. I was able to reverse it by using a nested transaction. This was my first time using a nested transaction . . .
Thank you again.
-J
Can't find what you're looking for? Ask the community or share your knowledge.