Get 12 unique intersecting lines from 6 intersecting surfaces

Hey everyone!

As the title says, I have 6 intersecting surfaces and I’m trying to extract the 12 unique intersecting lines.

I’ve tried using the node Geometry.Intersect but it also returns a surface and afterwards I haven’t been able to list the unique lines from this list.

This is the script I have so far:

WIP_Solid from intersecting surfaces.dyn (23.4 KB)

The end goal is to build a solid from these lines, so basically a solid from the intersecting surfaces.

Any help or suggestions are appreciated/weclome!

try cross product in lacing and use remove if not node for filter out…maybe :wink:

@sovitek Thanks for the suggestion, but I’m getting 24 lines instead of 12, they are double but can’t seem to remove the duplicates…

yeah not sure…hahaha…then i need see the whole graphs but for duplicate items lines with unique items…then maybe string from object will work…not sure :wink: and maybe with a math round node as well

if you have a small sample rvt you could share with only that situation, we can probably help

I think Geometry.Intersect will be giving you double because when you use cross lacing it looks at each of the 6 surfaces in order, and tells you which other surfaces they intersect with. So if there is an intersection with surface 0 and surface 1, the line will be created in both instances.

Unique items may not be removing the duplicates because it doesn’t work well with geometry as it can be too sensitive to floating point maths errors.

You could make a bounding box of the lines if your resulting shape would be a cuboid?

yeah or try prune duplicates…datashapes should have one there works for geometry…or a point by parameter, and use ootb point prune duplicates, with maybe some tolerance.but depends.

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *


unique = []
uniqueStr = []

def toList(input):
	if isinstance(input,list):
		return input
	else:
		return [input]

def surfsol_ToSortedVertices(surfsol):
	return  ",".join(sorted([i.ToString() for i in surfsol.Vertices]))
	
def curve_ToSortedVertices(cv):
	nbs = cv.ToNurbsCurve()
	return ",".join(sorted([p.ToString() for p in nbs.ControlPoints()]))
	
def pt_ToSortedVertices(pt):
	return pt.ToString()


g = toList(IN[0])

for geom in g:
	try:
		#solids and surfaces
		if not (surfsol_ToSortedVertices(geom) in uniqueStr) :
			uniqueStr.append(surfsol_ToSortedVertices(geom))
			unique.append(geom)
	except:
		try:
			#Curves and lines
			if not (curve_ToSortedVertices(geom) in uniqueStr) :
				uniqueStr.append(curve_ToSortedVertices(geom))
				unique.append(geom)	
		except:
			#Points
			if not (pt_ToSortedVertices(geom) in uniqueStr) :
				uniqueStr.append(pt_ToSortedVertices(geom))
				unique.append(geom)							
		
		
OUT = unique