Ejemplo n.º 1
0
    def create_field(self):
        """Process inputs."""
        field_name = self.nameTextField.getText()
        description = self.descTextField.getText()

        item = self.s1combo.getCurrentItem()
        s1 = self.s1combo.getItemText(item)
        item = self.s2combo.getCurrentItem()
        s2 = self.s2combo.getItemText(item)
        item = self.s3combo.getCurrentItem()
        s3 = self.s3combo.getItemText(item)
        item = self.s4combo.getCurrentItem()
        s4 = self.s4combo.getItemText(item)
        item = self.s5combo.getCurrentItem()
        s5 = self.s5combo.getItemText(item)
        item = self.s6combo.getCurrentItem()
        s6 = self.s6combo.getItemText(item)

        sendCommand("from abq_meshio.combine import *")
        cmdstr = ("tensor('" + self.odbFileNameFull + "', '" + field_name +
                  "', '" + description + "', '" + s1 + "', '" + s2 + "', '" +
                  s3 + "', '" + s4 + "', '" + s5 + "', '" + s6 + "')")
        sendCommand(cmdstr)
        self.form.deactivate()
        return 1
Ejemplo n.º 2
0
 def on_slave_exempt_selected(self):
     # Undo highlighting of previous slave exempt
     if self.highlight_es is not '' and self.currentSExempt != self.currentMExempt:
         abaqusGui.sendCommand(self.highlight_es + '\nunhighlight(es)')
         self.highlight_es = ''
     # Check if there are items in the slave exempt list
     count = self.cbx_ex_slave.getNumItems()
     if count <= 0:
         self.currentSExempt = -1
         reset_combo_box(self.cbx_ex_slave, [])
         self.check_ex_slave.setCheck(False)
         self.check_ex_slave.disable()
     else:
         # If a different slave has been selected, the GUI needs to be updated
         ex_slave = self.cbx_ex_slave.getItemData(
             self.cbx_ex_slave.getCurrentItem())
         # Update the selected slave exempt
         self.currentSExempt = ex_slave
         # Check if the exempt combo box is enabled
         if self.check_ex_slave.getCheck():
             # Make sure the combo box is enabled
             self.cbx_ex_slave.enable()
             # Highlight the current slave exempt
             self.highlight_es = 'es = (mdb.models[\'' + self.cbx_model.getItemText(self.currentModel) + '\']' +\
                                '.parts[\'' + self.cbx_part.getItemText(self.currentPart) + '\']' +\
                                '.sets[\'' + self.cbx_ex_slave.getItemText(self.currentSExempt) + '\'],)'
             abaqusGui.sendCommand(self.highlight_es + '\nhighlight(es)')
         else:
             # Disable the combo box
             self.cbx_ex_slave.disable()
Ejemplo n.º 3
0
 def on_master_selected(self):
     # Undo highlighting of previous master
     if self.highlight_m is not '' and self.currentSlave != self.currentMaster:
         abaqusGui.sendCommand(self.highlight_m + '\nunhighlight(m)')
         self.highlight_m = ''
     # Check if there are items in the master list
     count = self.cbx_master.getNumItems()
     if count <= 0:
         # Reset currently selected master
         self.currentMaster = -1
         # Also reset the master exempt selection
         self.currentMExempt = -1
         self.check_ex_master.setCheck(False)
         self.check_ex_master.disable()
         reset_combo_box(self.cbx_ex_master, [])
         self.on_master_exempt_selected()
     else:
         master = self.cbx_master.getItemData(
             self.cbx_master.getCurrentItem())
         # If a different master has been selected, the GUI needs to be updated
         if master != self.currentMaster:
             # Update the selected master
             self.currentMaster = master
             # Highlight the current master
             self.highlight_m = 'm = (mdb.models[\'' + self.cbx_model.getItemText(self.currentModel) + '\']' +\
                                '.parts[\'' + self.cbx_part.getItemText(self.currentPart) + '\']' +\
                                '.surfaces[\'' + self.cbx_master.getItemText(self.currentMaster) + '\'],)'
             abaqusGui.sendCommand(self.highlight_m + '\nhighlight(m)')
             # Reset master exempts
             self.currentMExempt = -1
             self.check_ex_master.setCheck(False)
             self.check_ex_master.enable()
             reset_combo_box(self.cbx_ex_master,
                             self.get_selected_part().sets.keys())
             self.on_master_exempt_selected()
Ejemplo n.º 4
0
 def on_slave_selected(self):
     # Undo highlighting of previous slave
     if self.highlight_s is not '' and self.currentSlave != self.currentMaster:
         abaqusGui.sendCommand(self.highlight_s + '\nunhighlight(s)')
         self.highlight_s = ''
     # Check if there are items in the slave list
     count = self.cbx_slave.getNumItems()
     if count <= 0:
         # Reset currently selected slave
         self.currentSlave = -1
         # Also reset the slave exempt selection
         self.currentSExempt = -1
         self.check_ex_slave.setCheck(False)
         self.check_ex_slave.disable()
         reset_combo_box(self.cbx_ex_master, [])
         self.on_slave_exempt_selected()
     else:
         slave = self.cbx_slave.getItemData(self.cbx_slave.getCurrentItem())
         # If a different slave has been selected, the GUI needs to be updated
         if slave != self.currentSlave:
             # Update the selected slave
             self.currentSlave = slave
             # Highlight the current slave
             self.highlight_s = 's = (mdb.models[\'' + self.cbx_model.getItemText(self.currentModel) + '\']' +\
                                '.parts[\'' + self.cbx_part.getItemText(self.currentPart) + '\']' +\
                                '.surfaces[\'' + self.cbx_slave.getItemText(self.currentSlave) + '\'],)'
             abaqusGui.sendCommand(self.highlight_s + '\nhighlight(s)')
             # Reset slave exempts
             self.currentSExempt = -1
             self.check_ex_slave.setCheck(False)
             self.check_ex_slave.enable()
             reset_combo_box(self.cbx_ex_slave,
                             self.get_selected_part().sets.keys())
             self.on_slave_exempt_selected()
Ejemplo n.º 5
0
 def un_highlight(self):
     if self.hl_m is not '':
         abaqusGui.sendCommand(self.hl_m + '\nunhighlight(hl_m)')
         self.hl_m = ''
     if self.hl_s is not '':
         abaqusGui.sendCommand(self.hl_s + '\nunhighlight(hl_s)')
         self.hl_s = ''
Ejemplo n.º 6
0
 def highlight(self, matcher):
     self.hl_m = 'hl_m = (mdb.models[\'' + matcher.get_model_name() + '\']' +\
                 '.parts[\'' + matcher.get_part_name() + '\']' +\
                 '.surfaces[\'' + matcher.get_master_name() + '\'],)'
     self.hl_s = 'hl_s = (mdb.models[\'' + matcher.get_model_name() + '\']' +\
                 '.parts[\'' + matcher.get_part_name() + '\']' +\
                 '.surfaces[\'' + matcher.get_slave_name() + '\'])'
     abaqusGui.sendCommand(self.hl_m + '\nhighlight(hl_m)')
     abaqusGui.sendCommand(self.hl_s + '\nhighlight(hl_s)')
Ejemplo n.º 7
0
 def reset_selection(self):
     # Remove highlighting
     if self.keyword.getValue() and self.keyword.getValue()[0] != '<':
         abaqusGui.sendCommand(self.keyword.getSetupCommands() +
                               '\nunhighlight(%s)' %
                               self.keyword.getValue())
     # Reset keyword value
     self.keyword.setValueToDefault()
     # Reset the label
     self.label.setText(self.label_text.replace('Picked', 'None'))
Ejemplo n.º 8
0
 def hide(self):
     # Undo highlighting of master surface
     if self.highlight_m is not '':
         abaqusGui.sendCommand(self.highlight_m + '\nunhighlight(m)')
         self.highlight_m = ''
     # Undo highlighting of slave surface
     if self.highlight_s is not '':
         abaqusGui.sendCommand(self.highlight_s + '\nunhighlight(s)')
         self.highlight_s = ''
     # Undo highlighting of master exempt
     if self.highlight_em is not '':
         abaqusGui.sendCommand(self.highlight_em + '\nunhighlight(em)')
         self.highlight_em = ''
     # Undo highlighting of slave exempt
     if self.highlight_es is not '':
         abaqusGui.sendCommand(self.highlight_es + '\nunhighlight(es)')
         self.highlight_es = ''
     # Call super method
     abaqusGui.AFXDataDialog.hide(self)
Ejemplo n.º 9
0
    def create_field(self):
        """Process inputs."""
        field_name = self.nameTextField.getText()
        description = self.descTextField.getText()

        item = self.s1combo.getCurrentItem()
        s1 = self.s1combo.getItemText(item)
        item = self.s2combo.getCurrentItem()
        s2 = self.s2combo.getItemText(item)
        item = self.s3combo.getCurrentItem()
        s3 = self.s3combo.getItemText(item)
        item = self.s4combo.getCurrentItem()
        s4 = self.s4combo.getItemText(item)
        item = self.s5combo.getCurrentItem()
        s5 = self.s5combo.getItemText(item)
        item = self.s6combo.getCurrentItem()
        s6 = self.s6combo.getItemText(item)
        item = self.framecombo.getCurrentItem()
        frame_name = self.framecombo.getItemText(item)

        #translate frame name to frame list
        if frame_name == "All":
            frame_list = str([0, -1])
        elif frame_name == "Last":
            frame_list = str([-1])
        elif frame_name == "First":
            frame_list = str([0])
        else:
            sendCommand(
                "print(No valid frame was selected. All frames are concidered."
            )
            frame_list = str([0, -1])

        sendCommand("from abq_meshio.combine import *")
        cmdstr = ("tensor('" + self.odbFileNameFull + "', '" + field_name +
                  "', '" + description + "', '" + s1 + "', '" + s2 + "', '" +
                  s3 + "', '" + s4 + "', '" + s5 + "', '" + s6 + "', '" +
                  frame_list + "')")
        sendCommand(cmdstr)
        self.form.deactivate()
        return 1
Ejemplo n.º 10
0
def issue_command(cmd):
    abaqusGui.sendCommand(cmd.getCommandString())
Ejemplo n.º 11
0
    def export(self, sender, sel, ptr):
        """Process inputs."""
        instance_item = self.instlist.getSingleSelection()
        inst = self.instlist.getItemText(instance_item)

        frame_item = self.framelist.getSingleSelection()
        substring = self.framelist.getItemText(frame_item).split("(")[0]
        step, frame = substring.split(": ")

        deformed = bool(self.check_deform.getCheck())

        variables = []
        for i, var in enumerate(self.variables):
            if self.varlist.isItemSelected(i):
                variables.append(var)

        tgt = r"".join(self.file_name.getValue())

        sendCommand("import meshio")
        sendCommand("from abq_meshio.abq_meshio_converter "
                    "import convertODBtoMeshio")
        sendCommand("odb = session.openOdb('%s')" % self.odbFileNameFull)
        sendCommand("instance = odb.rootAssembly.instances['%s']" % inst)
        sendCommand("frame = odb.steps['%s'].frames[%d]" % (step, int(frame)))
        sendCommand("odb_mesh = convertODBtoMeshio(instance, frame,"
                    " list_of_outputs=['%s'], deformed=%s)" %
                    ("','".join(variables), str(deformed)))
        sendCommand("meshio.write('%s', odb_mesh, write_binary=False)" % tgt)
        self.form.deactivate()
        return 1
Ejemplo n.º 12
0
 def deactivate(self):
     abaqusGui.AFXProcedure.deactivate(self)
     # Send a command to highlight the selected face
     if self.keyword.getValue() and self.keyword.getValue()[0] != '<':
         abaqusGui.sendCommand(self.keyword.getSetupCommands() +
                               '\nhighlight(%s)' % self.keyword.getValue())
Ejemplo n.º 13
0
    def export(self, sender, sel, ptr):
        """Process inputs."""
        tgt = r"".join(self.file_name.getValue())
        if "." not in tgt:
            # Probably, the user left out a ending. Let's add ".vtk"
            tgt = tgt + ".vtk"

        sendCommand("import meshio")
        sendCommand(
            "from abq_meshio.abq_meshio_converter import convertMDBtoMeshio")
        sendCommand(
            "currentViewport = session.viewports[session.currentViewportName]")
        sendCommand("displayedObject = currentViewport.displayedObject")
        sendCommand("mdb_mesh = convertMDBtoMeshio(displayedObject)")
        sendCommand("print(mdb_mesh)")
        sendCommand("meshio.write('%s', mdb_mesh, binary=False)" % tgt)
        self.form.deactivate()
        return 1
Ejemplo n.º 14
0
    def export(self, sender, sel, ptr):
        """Process inputs."""
        region_item = self.regionlist.getSingleSelection()
        region = self.regionlist.getItemText(region_item)

        frame_item = self.framelist.getSingleSelection()
        substring = self.framelist.getItemText(frame_item).split("(")[0]
        step, frame = substring.split(": ")

        deformed = bool(self.check_deform.getCheck())

        variables = []
        for i, var in enumerate(self.variables):
            if self.varlist.isItemSelected(i):
                variables.append(var)

        tgt = r"".join(self.file_name.getValue())
        if "." not in tgt:
            # Probably, the user left out a ending. Let's add ".vtk"
            tgt = tgt + ".vtk"

        sendCommand("import meshio")
        sendCommand("from abq_meshio.abq_meshio_converter "
                    "import convertODBtoMeshio")
        sendCommand("odb = session.openOdb('%s')" % self.odbFileNameFull)
        if " : " in region:
            inst, abqset = region.split(" : ")
            sendCommand(
                "region = odb.rootAssembly.instances['%s'].elementSets['%s']" %
                (inst, abqset))
        else:
            sendCommand("region = odb.rootAssembly.instances['%s']" % region)
        sendCommand("frame = odb.steps['%s'].frames[%d]" % (step, int(frame)))
        sendCommand("odb_mesh = convertODBtoMeshio(region, frame,"
                    " list_of_outputs=['%s'], deformed=%s)" %
                    ("','".join(variables), str(deformed)))
        sendCommand("print(odb_mesh)")
        sendCommand("meshio.write('%s', odb_mesh, binary=False)" % tgt)
        self.form.deactivate()
        return 1