.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reversing a Boolean operation.

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
junoj
736 Views, 7 Replies

Reversing a Boolean operation.

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

 

7 REPLIES 7
Message 2 of 8
fieldguy
in reply to: junoj

Have you tried "Catch"?  It looks as if you are not using a catch statement which is what it was designed for.

Message 3 of 8
_gile
in reply to: junoj

I do not konw anything about the 'CreateSoldFromPl' method, but it looks like you're substracting a solid to an indentical one (the same 'plinePoints1' argument for both 'Solid_1' and 'Solid_2').



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 4 of 8
junoj
in reply to: fieldguy

Hi Fieldguy,

 

Yes I have tried the Try Catch , but it just catches the error. The solids are consumed after the unsuccessful subtraction.

Message 5 of 8
junoj
in reply to: _gile

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

 

Message 6 of 8
junoj
in reply to: junoj

Sorry, I should have posted the error that i get:

 

The Boolean operation on solids failed.

Modeling Operation Error:

System inconsistency processing edge coincidence.

Message 7 of 8
Hallex
in reply to: junoj

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

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 8 of 8
junoj
in reply to: Hallex

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.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost