def mesh_b_click(self): # sg.getObjectBrowser().selectionChanged.connect(self.select) self.mesh = None objId = salome.sg.getSelected(0) if objId: mm = study.FindObjectID(objId).GetObject() mesh = None try: mm.Load() mesh = mm except BaseException: mesh = None self.mesh_l.setText('Select a valid mesh') pass if mesh: name = smeshBuilder.GetName(mm) self.mesh_l.setText(name) self.mesh = mm nodes_id = list(self.mesh.GetElementsByType(SMESH.NODE)) self.coord = array( [self.mesh.GetNodeXYZ(i) for i in nodes_id], float) volume_id = list(self.mesh.GetElementsByType(SMESH.VOLUME)) self.connec_volume = array( [self.mesh.GetElemNodes(i) for i in volume_id], int) - 1
def select(self): sg.getObjectBrowser().selectionChanged.disconnect(self.select) self.ui.minvalue.setText("") self.ui.maxvalue.setText("") objId = salome.sg.getSelected(0) if objId: mm = study.FindObjectID(objId).GetObject() mesh = None try: mm.Load() mesh = mm except: self.clearLineEdit() mesh = None pass if mesh: name = smeshBuilder.GetName(mm) self.ui.mesh.setStyleSheet("") self.ui.mesh.setText(name) self.mm = mm e = self.mm.NbEdges() f = self.mm.NbFaces() v = self.mm.NbVolumes() controls = [] if e: controls += controls_1d pass if f: controls += controls_2d pass if v: controls += controls_3d pass if self.ui.control.count() != len(controls): self.ui.control.clear() self.ui.control.addItems(controls) self.compute_minmax() sg.getObjectBrowser().selectionChanged.connect(self.select) pass