SolidUtils.IntersectSolidWithCurve cutGCurveWithGeometry Exception

SolidUtils.IntersectSolidWithCurve cutGCurveWithGeometry Exception

MattKincaid
Advocate Advocate
1,362 Views
5 Replies
Message 1 of 6

SolidUtils.IntersectSolidWithCurve cutGCurveWithGeometry Exception

MattKincaid
Advocate
Advocate

Sometimes when calling IntersectSolidWithCurve we'll see an error like the one below.

 

Autodesk.Revit.Exceptions.InternalException
HResult=0x80131500
Message=Error from cutGCurveWithGeometry
Source=RevitAPI
StackTrace:
at Autodesk.Revit.DB.SolidUtils.IntersectSolidWithCurve(Solid solid, Curve curve, SolidCurveIntersectionOptions options)

 

Does anyone know why this happens? Any workarounds?   I can't find it in the documentation.  It seems to happen most commonly when the curve is nearly coincident with the solid's exterior.

 

Thanks!

 

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

jeremytammik
Autodesk
Autodesk

If you can submit a minimal reproducible case, I'll share that with the development team for analysis:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

Afaik, internal exceptions should not leak out into the public API.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 6

MattKincaid
Advocate
Advocate
Accepted solution

Thanks @jeremytammik .  I think I actually discovered the problem.  The solids I was generating to pass into IntersectSolidWithCurve were just degenerate in certain cases.  The solid is created by unioning multiple solids using the BooleanOperationUtils class, but in some cases I was unioning solids when it didn't make sense geometrically.

 

I refactored my code to make better solids and no more error. Do you think the development team would still want to take a look?  I don't have a good way to provide source code, but I could provide an installer and a sample model.  You could easily decompile.  Let me know if that'd be helpful.

 

Thanks

 

 

0 Likes
Message 4 of 6

jeremytammik
Autodesk
Autodesk

Dear Matt,

 

Congratulations on solving the issue and thank you for your appreciation and letting us know.

 

I think they have more than enough other stuff to keep them well occupied, thank you  🙂

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 6

DanielNgai
Explorer
Explorer

Hi,

 

Why i cannot find your class (SolidUtils.IntersectSolidWithCurve()) in Revit API?

 

Thanks

0 Likes
Message 6 of 6

MattKincaid
Advocate
Advocate

@DanielNgai I don't believe the SolidUtils.IntersectSolidWithCurve() method is in the public API. If memory serves, this InternalException was generated by calling the public API method, Solid.IntersectWithCurve() , and passing a solid with degenerate geometry.

 

My guess is the public API method calls an internal method, which then generated the exception.  But that's only a guess.  One way to work around the issue is to add a Try Catch, and simply catch the InternalException when it occurs (seems to be rare).

 

Cheers!

0 Likes