def createContent(self): self.contentLayout = guitk.BCGridLayoutCreate(self.frame, 5, 3) # clip type selector label = guitk.BCLabelCreate(self.contentLayout, 'Select CLIP geometrical type') clipTypeOptions = list(comp_items.CLIP_GEOM_TYPES.keys()) self.clipGeomTypeComboBox = guitk.BCComboBoxCreate( self.contentLayout, clipTypeOptions) guitk.BCGridLayoutAddWidget(self.contentLayout, label, 0, 0, guitk.constants.BCAlignLeft) guitk.BCGridLayoutAddWidget(self.contentLayout, self.clipGeomTypeComboBox, 0, 1, guitk.constants.BCAlignLeft) # entity info self._addContentLine('Geomerical type Info:', 'geomTypeInfo') # manufacturer selector label = guitk.BCLabelCreate(self.contentLayout, 'Select CLIP beam type') clipTypeOptions = list(comp_items.CLIP_BEAM_TYPES.keys()) self.clipBeamTypeComboBox = guitk.BCComboBoxCreate( self.contentLayout, clipTypeOptions) guitk.BCGridLayoutAddWidget(self.contentLayout, label, 2, 0, guitk.constants.BCAlignLeft) guitk.BCGridLayoutAddWidget(self.contentLayout, self.clipBeamTypeComboBox, 2, 1, guitk.constants.BCAlignLeft) # entity info self._addContentLine('Beam type Info:', 'beamTypeInfo') # setup connections guitk.BCComboBoxSetCurrentIndexChangedFunction( self.clipBeamTypeComboBox, self.beamTypeChanged, None) guitk.BCComboBoxSetCurrentIndexChangedFunction( self.clipGeomTypeComboBox, self.geomTypeChanged, None) # set initial values guitk.BCComboBoxSetCurrentItem(self.clipBeamTypeComboBox, self.parentApplication.DFT_TYPE_BEAM) guitk.BCComboBoxSetCurrentItem(self.clipGeomTypeComboBox, self.parentApplication.DFT_TYPE_GEOM) #TODO: this will be replaced with other geometrical types loaded from comp_items self.geomTypeChanged(self.clipGeomTypeComboBox, self.parentApplication.DFT_TYPE_GEOM, None) self.beamTypeChanged(self.clipBeamTypeComboBox, self.parentApplication.DFT_TYPE_BEAM, None)
def _addContentLine(self, label, valueAttrName): rowCount = guitk.BCGridLayoutRows(self.contentLayout) labelWidget = guitk.BCLabelCreate(self.contentLayout, label) valueWidget = guitk.BCLabelTickerCreate(self.contentLayout, '-') setattr(self, valueAttrName + '_label', labelWidget) setattr(self, valueAttrName, valueWidget) self.infoAttributeNames.append(valueAttrName) guitk.BCGridLayoutAddWidget(self.contentLayout, labelWidget, rowCount, 0, guitk.constants.BCAlignLeft) guitk.BCGridLayoutAddWidget(self.contentLayout, valueWidget, rowCount, 1, guitk.constants.BCAlignLeft)
def createContent(self): self.contentLayout = guitk.BCGridLayoutCreate(self.frame, 5, 3) # entity info self._addContentLine( 'Selected NODES', 'noOfNodes') self._addContentLine( 'Beam material ID', 'beamMID') self.pushButtonSelectCon = guitk.BCPushButtonCreate(self.contentLayout, "Select", self.nodesSelected, None) guitk.BCGridLayoutAddWidget(self.contentLayout, self.pushButtonSelectCon, 1, 2, guitk.constants.BCAlignLeft)
def createContent(self): self.contentLayout = guitk.BCGridLayoutCreate(self.frame, 5, 3) # add check box for mirror option self.mirrorCheckBox = guitk.BCCheckBoxCreate(self.contentLayout, 'Mirror created clip') guitk.BCGridLayoutAddWidget(self.contentLayout, self.mirrorCheckBox, 0, 0, guitk.constants.BCAlignLeft) # setup connections guitk.BCCheckBoxSetToggledFunction(self.mirrorCheckBox, self.mirrorCheckBoxChanged, None) # set initial values guitk.BCCheckBoxSetChecked(self.mirrorCheckBox, self.parentApplication.DFT_MIRROR_CLIP)
def createContent(self): self.contentLayout = guitk.BCGridLayoutCreate(self.frame, 5, 3) # entity info self._addContentLine('x Lower Limit', 'xLow') self._addContentLine('x Upper Limit', 'xUp') self._addContentLine('y Lower Limit', 'yLow') self._addContentLine('y Upper Limit', 'yUp') self._addContentLine('z Lower Limit', 'zLow') self._addContentLine('z Upper Limit', 'zUp') # create buttons for stop distance redefinition stopDistances = ['xLow', 'xUp', 'yLow', 'yUp', 'zLow', 'zUp'] for i, stopDistanceName in enumerate(stopDistances): button = guitk.BCPushButtonCreate( self.contentLayout, "Select", #lambda buttonWidget, stopDistanceName: self.smartClip().redefineStopDistance(stopDistanceName), lambda buttonWidget, stopDistanceName: self. redefineStopDistance(button, stopDistanceName), stopDistanceName) editButton = guitk.BCPushButtonCreate( self.contentLayout, "Edit", #lambda buttonWidget, stopDistanceName: self.smartClip().redefineStopDistance(stopDistanceName), lambda buttonWidget, stopDistanceName: self.editStopDistance( button, stopDistanceName), stopDistanceName) self.selectButtons[stopDistanceName] = button self.editButtons[stopDistanceName] = editButton guitk.BCGridLayoutAddWidget(self.contentLayout, button, 1 + i, 2, guitk.constants.BCAlignLeft) guitk.BCGridLayoutAddWidget(self.contentLayout, editButton, 1 + i, 3, guitk.constants.BCAlignLeft)
def createContent(self): ''' This is a space for the code where page widget definition should/can be done. Please keep "self.contentLayout" attribute name for main page layout.''' # self.contentLayout = guitk.BCBoxLayoutCreate(self.frame, guitk.constants.BCVertical) self.contentLayout = guitk.BCGridLayoutCreate(self.frame, 3, 4) self._addContentLine('Select CON', 'selectedCONid') self.pushButtonSelectCon = guitk.BCPushButtonCreate( self.contentLayout, "Select", self.conSelect, None) guitk.BCGridLayoutAddWidget(self.contentLayout, self.pushButtonSelectCon, 1, 2, guitk.constants.BCAlignLeft) # rotate coor sys labelWidget = guitk.BCLabelCreate(self.contentLayout, 'Rotate coor sys') guitk.BCGridLayoutAddWidget(self.contentLayout, labelWidget, 2, 0, guitk.constants.BCAlignLeft) # self.coorSysIdLabelWidget = guitk.BCLabelCreate(gridLayout, 'Count: -') # guitk.BCGridLayoutAddWidget(gridLayout, self.coorSysIdLabelWidget, 0, 1, guitk.constants.BCAlignHCenter) # # self.pushButtonSelectCoorSys = guitk.BCPushButtonCreate(gridLayout, "", self.selectCoorSys, None) # guitk.BCButtonSetIconFileName(self.pushButtonSelectCoorSys, self.PICK_ICON_PATH) # guitk.BCGridLayoutAddWidget(gridLayout, self.pushButtonSelectCoorSys, 0, 2, guitk.constants.BCAlignLeft) # rotate X self.pushButtonRotXminus = guitk.BCPushButtonCreate( self.contentLayout, "-X", self.rotateXminus, None) guitk.BCGridLayoutAddWidget(self.contentLayout, self.pushButtonRotXminus, 2, 1, guitk.constants.BCAlignLeft) self.pushButtonRotXplus = guitk.BCPushButtonCreate( self.contentLayout, "+X", self.rotateXplus, None) guitk.BCGridLayoutAddWidget(self.contentLayout, self.pushButtonRotXplus, 2, 2, guitk.constants.BCAlignLeft) self.rotXspinBox = guitk.BCSpinBoxCreate(self.contentLayout) guitk.BCGridLayoutAddWidget(self.contentLayout, self.rotXspinBox, 2, 3, guitk.constants.BCAlignLeft) guitk.BCSpinBoxSetValue(self.rotXspinBox, 5) # rotate Y self.pushButtonRotYminus = guitk.BCPushButtonCreate( self.contentLayout, "-Y", self.rotateYminus, None) guitk.BCGridLayoutAddWidget(self.contentLayout, self.pushButtonRotYminus, 3, 1, guitk.constants.BCAlignLeft) self.pushButtonRotYplus = guitk.BCPushButtonCreate( self.contentLayout, "+Y", self.rotateYplus, None) guitk.BCGridLayoutAddWidget(self.contentLayout, self.pushButtonRotYplus, 3, 2, guitk.constants.BCAlignLeft) self.rotYspinBox = guitk.BCSpinBoxCreate(self.contentLayout) guitk.BCGridLayoutAddWidget(self.contentLayout, self.rotYspinBox, 3, 3, guitk.constants.BCAlignLeft) guitk.BCSpinBoxSetValue(self.rotYspinBox, 5) # rotate Z self.pushButtonRotZminus = guitk.BCPushButtonCreate( self.contentLayout, "-Z", self.rotateZminus, None) guitk.BCGridLayoutAddWidget(self.contentLayout, self.pushButtonRotZminus, 4, 1, guitk.constants.BCAlignLeft) self.pushButtonRotZplus = guitk.BCPushButtonCreate( self.contentLayout, "+Z", self.rotateZplus, None) guitk.BCGridLayoutAddWidget(self.contentLayout, self.pushButtonRotZplus, 4, 2, guitk.constants.BCAlignLeft) self.rotZspinBox = guitk.BCSpinBoxCreate(self.contentLayout) guitk.BCGridLayoutAddWidget(self.contentLayout, self.rotZspinBox, 4, 3, guitk.constants.BCAlignLeft) guitk.BCSpinBoxSetValue(self.rotZspinBox, 5) self._setRotationButtonsEnabled(False)
#******************************************************************************** import ansa from ansa import* deck=constants.OPENFOAM from ansa import guitk from ansa import constants def Isolate_face_area(): TopWindow = guitk.BCWindowCreate("Display faces Less than", guitk.constants.BCOnExitDestroy) BCGridLayout_1 = guitk.BCGridLayoutCreate(TopWindow, 1, 2) BCLabel_1 = guitk.BCLabelCreate(TopWindow, "Input") BCLineEdit_1 = guitk.BCLineEditCreate(TopWindow, "1") bclist=[BCLineEdit_1] BCDialogButtonBox_1 = guitk.BCDialogButtonBoxCreate(TopWindow) guitk.BCGridLayoutAddWidget(BCGridLayout_1,BCLabel_1,0,0,guitk.constants.BCAlignVCenter) guitk.BCGridLayoutAddWidget(BCGridLayout_1,BCLineEdit_1,0,0,guitk.constants.BCAlignVCenter) guitk.BCWindowSetAcceptFunction(TopWindow,main,bclist) guitk.BCWindowSetRejectFunction(TopWindow,sub,0) guitk.BCShow(TopWindow) def main(w,bclist): area_text=guitk.BCButtonLineEditGetText(bclist[0]) area_fl=float(area_text) faces=base.CollectEntities(deck,None,"FACE",False) print(faces) print(type(faces)) print(len(faces))