I’m writing a Python script and need to check to see if a set of input lines is coincident with the edge of a wall. The input lines may be different lengths than the wall edges (larger or shorter) or may only overlap slightly. Any idea of a concise way to check for this?
have you tried evaluating the two lines’ intersection ? If the result’s a line, then the two are coincident:
Another possible approach…
This workflow would also include any line that might begin at the start or end point and extend in the opposite direction.
Dimitar’s suggestion is the way to go if such lines need to be filtered out.
Any tips on making this a relatively compact Python script?
import clr clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import * l1 = IN l2 = IN def co_check(a,b): try : x = a.Intersect(b) except : x = None return x is not None and \ 'Line' in str(type(x) ) OUT = co_check(l1,l2)
Thanks Dimitar. Super helpful.