|
@@ -32,7 +32,13 @@ class SystemVertex:
|
|
|
if( self.connector.belong_type in revit_const.MEPCURVE):
|
|
|
return True
|
|
|
return False
|
|
|
-
|
|
|
+ def get_parent_floor(self):
|
|
|
+ '''
|
|
|
+ Get relation floorgraph.
|
|
|
+ :return:
|
|
|
+ '''
|
|
|
+ model = systemutils.get_specify_type_parent(self, graph_model.FloorGraph).model
|
|
|
+ return model
|
|
|
class SystemEdge:
|
|
|
"""Graph Edge."""
|
|
|
# edge data.contain all edge element
|
|
@@ -274,3 +280,41 @@ class SystemVertexType(Enum):
|
|
|
real_point = 0
|
|
|
imaginary_point = 1
|
|
|
hollow_dot = 2
|
|
|
+
|
|
|
+
|
|
|
+def combine_systemgraph(floorgraphs):
|
|
|
+ """
|
|
|
+ Consider the riser merger
|
|
|
+ :param floorgraphs:
|
|
|
+ :return:projectgraph
|
|
|
+ """
|
|
|
+ # get all open vertical pipe
|
|
|
+ open_vertical_pipes = []
|
|
|
+ for floorgraph in floorgraphs:
|
|
|
+ for systemgraph in floorgraph.system_graphs:
|
|
|
+ open_vertical_pipes.extend(systemgraph.get_open_vertical_pipes())
|
|
|
+ # group systemvertex
|
|
|
+ projectgraph = graph_model.ProjectGraph()
|
|
|
+ for i in range(len(open_vertical_pipes)):
|
|
|
+ v1 = open_vertical_pipes[i]
|
|
|
+ group_pipes = [v1]
|
|
|
+ for j in range(i + 1, len(open_vertical_pipes)):
|
|
|
+ v2 = open_vertical_pipes[j]
|
|
|
+ if systemutils.is_xyz_equal(v1.connector.origin, v2.connector.origin):
|
|
|
+ group_pipes.append(v2)
|
|
|
+ # combine systemgraph
|
|
|
+ for k in range(len(group_pipes)):
|
|
|
+ vertex = group_pipes[k]
|
|
|
+ systemgraph = systemutils.get_specify_type_parent(vertex, graph_model.SystemGraph)
|
|
|
+ if not systemgraph:
|
|
|
+ continue
|
|
|
+ projectgraph.remove_groupedsystemgraphs(systemgraph)
|
|
|
+ if (k == 0):
|
|
|
+ temp_groupedsystemgraphs = graph_model.GroupedSystemGraph(systemgraph)
|
|
|
+ else:
|
|
|
+ prev_vertex = group_pipes[k - 1]
|
|
|
+ temp_groupedsystemgraphs.add_system(systemgraph)
|
|
|
+ temp_groupedsystemgraphs.add_edge(prev_vertex, vertex)
|
|
|
+ if temp_groupedsystemgraphs:
|
|
|
+ projectgraph.groupedsystemgraphs.append(temp_groupedsystemgraphs)
|
|
|
+ return projectgraph
|