def are_same_edges(occedge1, occedge2): edgepyptlist1 = fetch.occptlist2pyptlist(fetch.points_from_edge(occedge1)) edgepyptlist2 = fetch.occptlist2pyptlist(fetch.points_from_edge(occedge2)) if edgepyptlist1 == edgepyptlist2: return True else: edgepyptlist1.reverse() if edgepyptlist1 == edgepyptlist2: return True else: return False
def flatten_edge_z_value(occedge, z=0): occptlist = fetch.points_from_edge(occedge) pyptlist = fetch.occptlist2pyptlist(occptlist) pyptlist_2d = [] for pypt in pyptlist: pypt2d = (pypt[0], pypt[1], z) pyptlist_2d.append(pypt2d) flatten_edge = construct.make_edge(pyptlist_2d[0], pyptlist_2d[1]) return flatten_edge
def edge_common_vertex(occedge1, occedge2): pyptlist_all = [] edgepyptlist1 = fetch.occptlist2pyptlist(fetch.points_from_edge(occedge1)) edgepyptlist2 = fetch.occptlist2pyptlist(fetch.points_from_edge(occedge2)) pyptlist_all.extend(edgepyptlist1) pyptlist_all.extend(edgepyptlist2) seen = set() uniq = [] common = [] for pypt in pyptlist_all: if pypt not in seen: uniq.append(pypt) seen.add(pypt) else: common.append(pypt) if not common: return () else: return common
def edge_common_vertex(occedge1, occedge2): """ This function checks if two OCCedges have common vertices. Parameters ---------- occedge1 : OCCedge The first edge to be analysed. occedge2 : OCCedge The second edge to be analysed. Returns ------- list of common points : pyptlist The list of common points between the two edges. """ pyptlist_all = [] edgepyptlist1 = fetch.points_from_edge(occedge1) edgepyptlist2 = fetch.points_from_edge(occedge2) pyptlist_all.extend(edgepyptlist1) pyptlist_all.extend(edgepyptlist2) seen = set() uniq = [] common = [] for pypt in pyptlist_all: if pypt not in seen: uniq.append(pypt) seen.add(pypt) else: common.append(pypt) if not common: return () else: return common