浏览代码

mxg:add join_object to join_elements

mengxiangge 5 年之前
父节点
当前提交
590d624c30

+ 1 - 1
src/system_relation/graph_model.py

@@ -203,7 +203,7 @@ class FloorGraph:
 		:return:
 		"""
 		cons = list(c for c in self.connector_data if c.id == connector_id)
-		return cons[0]
+		return cons[0] if len(cons)>0 else None
 
 	def get_element(self, element_id):
 		"""

+ 1 - 0
src/system_relation/revit_const.py

@@ -4,6 +4,7 @@
 EQUIPMENT='Equipment'
 COMPONENT='EquipPart'
 FACILITY=[EQUIPMENT,COMPONENT]
+JoinObject='JoinObject'
 OTHER='Other'
 CONNECTOR='Connector'
 DUCT='Duct'

+ 21 - 2
src/system_relation/systemdatautils.py

@@ -28,9 +28,12 @@ def get_project_models(project_id,building_id):
 		"id,name,local_id,local_name,sequence_id,model_id,building_id,project_id " \
 		"from floor " \
 		"where project_id='%s' " \
-		"and ('%s' is null or building_id='%s') " \
 		"order by sequence_id desc"\
-		%(project_id,building_id,building_id)
+		%(project_id)
+
+		#"and ('%s' is null or building_id='%s') " \
+		# "order by sequence_id desc"\
+		# %(project_id,building_id,building_id)
 	COMPONENT_KEYS = [
 		'id',
 		'name',
@@ -111,6 +114,22 @@ def get_element_data(model_id):
 	]
 	element_data.extend(get_dicdata(other_sql,OTHER_KEYS))
 
+	other_sql = "select * from revit.join_object where model_id='%s'" % (model_id)
+	OTHER_KEYS = [
+		'id',
+		'model_id',
+		'connected_ids',
+		'source_id',
+		'name',
+		'revit_id',
+		'type',
+		'create_time',
+		'last_update',
+		'location',
+		'outline'
+	]
+	element_data.extend(get_dicdata(other_sql, OTHER_KEYS))
+
 	pipe_sql = "select * from revit.pipe where model_id='%s'" % (model_id)
 	PIPE_KEYS = [
 		'id',

+ 1 - 1
src/system_relation/systemutils.py

@@ -29,7 +29,7 @@ def graph_arrange(graph):
 
 def connector_sort(connector1, connector2):
 	"""Use Define Sort rule"""
-	dic = {revit_const.EQUIPMENT: 0, revit_const.COMPONENT: 1, revit_const.OTHER: 2, revit_const.PIPE: 3,
+	dic = {revit_const.EQUIPMENT: 0, revit_const.COMPONENT: 1,revit_const.JoinObject:2, revit_const.OTHER: 2, revit_const.PIPE: 3,
 		   revit_const.DUCT: 4}
 	x = dic[connector1.belong_type]
 	y = dic[connector2.belong_type]

+ 1 - 1
src/system_relation/test_systemblock.py

@@ -2,7 +2,7 @@ import sys
 sys.path.append("../../..")
 from relations.src.system_relation import systemutils, graph_model, systemdatautils,systemgraph_display
 
-
+from cffi import FFI
 if '__main__'==__name__:
 	project_id="Pj1101010015"
 	system_name="冷冻水供水管"