Finding Hard Edges in a open mesh


im working on IFC files that linked in or opened in revit where most of the geometry is mesh geometry. to annotate and work further with this geometry i want to find the hard edges of the mesh.

i have created a script that finds hard edges on watertight meshes. (this script is probably possible to optimize quite a bit, since im fairly new to dynamo).

i need a script that also work on meshes that are not watertight and i have no idea where to start solving this, so if anyone want to point me in the right direction i would be grateful:) script and test file is attached.

edgefinder.dyn (52.3 KB) testCube.rvt (400 KB)