[RhinoCommon] Brep.DuplicateEdgeCurves(false): Hides AccessViolationException


In order to create an outline image of a ship our plugin duplicates the edgecurves of the breps, including the non-naked edges if the brep was splitted on a kink.
This usually works fine, but one of our testcases has a surface with one singular edge that causes the command to abort silently. While debugging I found that brep.DuplicateEdgeCurves(false) has an AccessViolationException which I cannot catch in the calling code to handle this properly. Which makes sense from a programmer’s point of view.

The surface seems sound to me and also to Rhino 5SR12 (it’s valid, not bad).

I’ve attached the failing surface and a testcommand and screenshots of the exception. RH5SR12 - Brep.DuplicateEdgeCurves.zip (103.2 KB)

Kind regards,

Hi Gerco,

This is a flaw in our Brep.DuplicateEdgeCurves function, which wasn’t taking into account that edges might not have any associated trims. I’ve fixed this for V6. In the mean time, you might just loop thru the Brep.Edges list and duplicate each edge on your own.

Also, you surface has a tiny curve. After duplicating edges, run “SelShortCrv” and you’ll find it.

– Dale

Hi Dale,

Thank you for quickly looking into it. I can work around it but nevertheless I’m looking forward to V6 :slight_smile:

Kind regards,