def getParentEnt(self, entity): """ get the parent entity TODO: To be tested """ _sqlSelect = """SELECT pycad_entity_id, pycad_object_type, pycad_object_definition, pycad_object_style, pycad_entity_state, pycad_index, pycad_visible FROM pycadent WHERE pycad_entity_id IN ( SELECT pycad_parent_id FROM pycadrel WHERE pycad_child_id =%s ) AND pycad_entity_state NOT LIKE "DELETE" AND pycad_object_type LIKE '%s' AND pycad_undo_visible=1 """ % (str(entity.getId()), str(entity.eType)) _dbEntRow = self.makeSelect(_sqlSelect) for _row in _dbEntRow: _style = _row[3] _dumpObj = pickle.loads(str(_row[2])) _objEnt = Entity(_row[1], _dumpObj, _style, _row[0]) _objEnt.state = _row[4] _objEnt.index = _row[5] _objEnt.visible = _row[6] _objEnt.updateBBox() return _objEnt return None
def getParentEnt(self,entity): """ get the parent entity TODO: To be tested """ _sqlSelect="""SELECT pycad_entity_id, pycad_object_type, pycad_object_definition, pycad_object_style, pycad_entity_state, pycad_index, pycad_visible FROM pycadent WHERE pycad_entity_id IN ( SELECT pycad_parent_id FROM pycadrel WHERE pycad_child_id =%s ) AND pycad_entity_state NOT LIKE "DELETE" AND pycad_object_type LIKE '%s' AND pycad_undo_visible=1 """%(str(entity.getId()), str(entity.eType)) _dbEntRow=self.makeSelect(_sqlSelect) for _row in _dbEntRow: _style=pickle.loads(_row[3]) _dumpObj=pickle.loads(_row[2]) _objEnt=Entity(_row[1],_dumpObj,_style,_row[0]) _objEnt.state=_row[4] _objEnt.index=_row[5] _objEnt.visible=_row[6] _objEnt.updateBBox() return _objEnt return None
def getAllChildrenType(self, parent, childrenType=None): """ get all the children entity of type childrenType """ _outObj=[] if not childrenType: childrenType='%' if childrenType=='ALL': childrenType='%' # TODO : controllare questa select pycad_id, _sqlSelect="""SELECT pycad_entity_id, pycad_object_type, pycad_object_definition, pycad_object_style, pycad_entity_state, pycad_index, pycad_visible, pycad_id FROM pycadent WHERE pycad_entity_id IN ( SELECT pycad_child_id FROM pycadrel WHERE pycad_parent_id =%s ) AND pycad_id IN ( SELECT max(pycad_id) FROM pycadent WHERE pycad_undo_visible=1 GROUP BY pycad_entity_id ORDER BY pycad_id) AND pycad_entity_state NOT LIKE "DELETE" AND pycad_object_type LIKE '%s' AND pycad_undo_visible=1 """%(str(parent.getId()), str(childrenType)) _dbEntRow=self.makeSelect(_sqlSelect) for _row in _dbEntRow: _style=pickle.loads(_row[3]) _dumpObj=pickle.loads(_row[2]) _objEnt=Entity(_row[1],_dumpObj,_style,_row[0]) _objEnt.state=_row[4] _objEnt.index=_row[5] _objEnt.visible=_row[6] _objEnt.updateBBox() _outObj.append(_objEnt) return _outObj