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)
Esempio n. 2
0
    def __init__(self):

        revision, modifiedBy, lastModified = util.getVersionInfo()

        self.dialog = guitk.BCWindowCreate("%s (%s)" % (self.TITLE, revision),
                                           guitk.constants.BCOnExitDestroy)

        self.creator = SchutzKlasseSetsCreator()

        guitk.BCWindowSetInitSize(self.dialog, self.WIDTH, self.HEIGTH)
        guitk.BCWindowSetSaveSettings(self.dialog, False)

        self.mainLayout = guitk.BCBoxLayoutCreate(self.dialog,
                                                  guitk.constants.BCVertical)

        # input path
        configFileLayout = guitk.BCBoxLayoutCreate(
            self.dialog, guitk.constants.BCHorizontal)
        guitk.BCLabelCreate(configFileLayout, 'Input configuration file')

        self.inputConfigFileLineEdit = guitk.BCLineEditPathCreate(
            configFileLayout, guitk.constants.BCHistoryFiles,
            os.path.dirname(base.DataBaseName()),
            guitk.constants.BCHistorySelect, 'schutzKlasseInputConfigFile')
        guitk.BCLineEditPathSetFilter(self.inputConfigFileLineEdit,
                                      'MS Excel files (*.xlsx)')

        #		# output path
        #		configFileLayout = guitk.BCBoxLayoutCreate(self.dialog, guitk.constants.BCHorizontal)
        #		guitk.BCLabelCreate(configFileLayout, 'Output include file')
        #		self.outputIncludeFileLineEdit = guitk.BCLineEditPathCreate(configFileLayout, guitk.constants.BCHistoryFiles,
        #			os.path.dirname(base.DataBaseName()), guitk.constants.BCHistorySaveAs, 'schutzKlasseOutInclude')
        #		guitk.BCLineEditPathSetFilter(self.outputIncludeFileLineEdit, 'ABAQUS (*.inc)')

        dbb = guitk.BCDialogButtonBoxCreate(self.dialog)
        acceptButton = guitk.BCDialogButtonBoxGetAcceptButton(dbb)
        guitk.BCButtonSetText(acceptButton, 'Create sets')
        b = guitk.BCPushButtonCreate(dbb, 'Export include', self.exportInclude,
                                     None)
        guitk.BCDialogButtonBoxAddButton(dbb, b)

        guitk.BCWindowSetAcceptFunction(self.dialog, self.createSets, None)

        guitk.BCShow(self.dialog)
Esempio n. 3
0
def table(master_list, slave_list):
    window = guitk.BCWindowCreate("Master Slave Table",
                                  guitk.constants.BCOnExitDestroy)
    table = guitk.BCTableCreate(window, 2, 2)
    guitk.BCTableSetNumRows(table, len(master_list))
    guitk.BCTableHeaderSetLabel(table, guitk.constants.BCHorizontal, 0,
                                'Master')
    guitk.BCTableHeaderSetLabel(table, guitk.constants.BCHorizontal, 1,
                                'Slave')
    i = 0
    for i in range(0, len(master_list)):
        guitk.BCTableSetText(table, i, 0, str(master_list[i]))
        i += 1
    for i in range(0, len(slave_list)):
        guitk.BCTableSetText(table, i, 1, str(slave_list[i]))
        i += 1
    guitk.BCTableSetColumnAlignment(table, 0, guitk.constants.BCAlignRight)
    guitk.BCTableSetColumnAlignment(table, 1, guitk.constants.BCAlignRight)
    guitk.BCTableSetReadOnly(table, True)
    guitk.BCShow(window)
    return 1
Esempio n. 4
0
def Gui():
    w = guitk.BCWindowCreate('Simple BCWindow',
                             guitk.constants.BCOnExitDestroy)
    le1 = guitk.BCLineEditCreate(w, 'RBE3')
    le2 = guitk.BCLineEditCreate(w, '50')
    le3 = guitk.BCLineEditCreate(w, './')
    cb9 = guitk.BCCheckBoxCreate(w, 'Maintain Include File structure')
    cb1 = guitk.BCCheckBoxCreate(w, 'ExtraNodesNode')
    cb2 = guitk.BCCheckBoxCreate(w, 'ExtraNodesSet')
    cb3 = guitk.BCCheckBoxCreate(w, 'RigidBodies')
    cb4 = guitk.BCCheckBoxCreate(w, 'MatRigid')
    cb5 = guitk.BCCheckBoxCreate(w, 'JointSpherical')
    cb6 = guitk.BCCheckBoxCreate(w, 'JointRevolute')
    cb7 = guitk.BCCheckBoxCreate(w, 'Contact')
    cb8 = guitk.BCCheckBoxCreate(w, 'Append File')
    cb10 = guitk.BCCheckBoxCreate(w, 'Add Comments')
    f = guitk.BCFrameCreate(w)
    l = guitk.BCBoxLayoutCreate(f, guitk.constants.BCHorizontal)
    b1 = guitk.BCPushButtonCreate(
        l, "RUN", doda,
        [le1, le2, cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, cb9, cb10, le3])
    guitk.BCShow(w)
Esempio n. 5
0
def exe(entities, params):
	file = params['Matching list']

	solver = params['Solver']
	solver_name = solver.upper()

	if solver_name == 'ABAQUS' or solver_name == 'PAMCRASH' or solver_name == 'NASTRAN':
		if solver_name == 'ABAQUS':
			solver = constants.ABAQUS
			ent = ["SHELL_SECTION","SOLID_SECTION", "MEMBRANE_SECTION"]
			id_mat = 'MID'
			remove_text = "_SECTION"
		if solver_name == 'PAMCRASH':
			solver = constants.PAMCRASH
			ent = ["PART_SHELL","PART_SOLID", "PART_MEMBRANE"]
			id_mat = 'IMAT'
			remove_text = "PART_"
		if solver_name == 'NASTRAN':
			solver = constants.NASTRAN
			ent = ["PSHELL","PSOLID"]
			id_mat = 'MID1'
			id_mat_nastran = ['MID1', 'MID2', 'MID3']
			remove_text = "P"
	else:
		print('Check works only for ABAQUS, PAMCRASH and NASTRAN')
		return 0

	if not os.path.isfile(file):
		m = utils.SelectOpenFile(0, 'Matching list (*)')
		file = m[0]
		if not os.path.isfile(file):
			return 0

	configuration_line, configuration_line_short, loadcase_list = read_configuration_file(file)

	loadcase = '' # initialize loadcase to aviod errors due to wrong file format
	if (params['Type of loadcase'] not in loadcase_list) and len(loadcase_list) > 1:
		print(loadcase_list)
		TopWindow = guitk.BCWindowCreate("Fill the  text from the combo box", guitk.constants.BCOnExitDestroy)
		ComboBox = guitk.BCComboBoxCreate(TopWindow,loadcase_list )
		guitk.BCComboBoxSetActivatedFunction( ComboBox, ComboActivated, None )
		guitk.BCShow(TopWindow)
		loadcase = loadcase_choose
	elif params['Type of loadcase'] in loadcase_list:
		loadcase = params['Type of loadcase']

	if len(loadcase_list) == 1:
		loadcase = loadcase_list[0]

	t1 = base.CheckReport('ID of material doesn\'t match with ID in the matching list')
	t2 = base.CheckReport('Wrong format of part')
	t3 = base.CheckReport('The material isn\'t in list')

	t1.has_fix = True
	t2.has_fix = False
	t3.has_fix = False

	parts = base.CollectEntities(solver, entities, ent, prop_from_entities=True)

	for part in parts:
		name = part._name
		name_list = name.split(params['Delimiter for part name'])
		if len(name_list) == int(params['Number of segments']):
			type_part = part.ansa_type(solver)
			type_part = type_part.replace(remove_text, "")

			material = name_list [int(params['Segment of material name']) - 1]
			material_ident = loadcase + ',' + material + ',' + type_part

			material_ent = part.get_entity_values(solver, [id_mat])
			material_id = material_ent[id_mat]._id

			if solver == constants.NASTRAN and type_part == 'SHELL':
				material_ent = part.get_entity_values(solver, id_mat_nastran)
				if material_ent[id_mat_nastran[0]]._id == material_ent[id_mat_nastran[1]]._id and \
					material_ent[id_mat_nastran[0]]._id == material_ent[id_mat_nastran[2]]._id:
					flag_nastran_same_mat = True
				else:
					flag_nastran_same_mat = False

			# the material was find at in matching list
			if material_ident in configuration_line:
				# the material was find at in matching list, but with wrong id
				if solver == constants.NASTRAN and type_part == 'SHELL':
					if int(configuration_line[material_ident]) != int(material_id) or not flag_nastran_same_mat:
						t1.add_issue(entities=[part], status='Error', description='Wrong assigning ID or MIDx are not same ',
							material=material, loadcase=str(loadcase),
							matching_mat_ID=str(configuration_line[material_ident]),
							mat_card_ID=str(material_ent[id_mat_nastran[0]]._id) +
								'/' + str(material_ent[id_mat_nastran[1]]._id) +  '/' +
								str(material_ent[id_mat_nastran[2]]._id),
							solver_name=solver_name, _solver=str(solver), mat=id_mat )
				else:
					if int(configuration_line[material_ident]) != int(material_id):
						t1.add_issue(entities = [part], status = 'Error', description = 'Wrong assigning ID',
							material = material,
							loadcase = str(loadcase),
							matching_mat_ID = str(configuration_line[material_ident]),
							mat_card_ID = str(material_id),
							solver_name =  solver_name,
							_solver = str(solver),
							mat = id_mat,
							)
			else:
				# the material wasnt able to find at in matching list
				material_ident_short = material + ',' + type_part
				if material_ident_short in configuration_line_short:
					suggest = configuration_line_short [material_ident_short]
				else:
					suggest = ['xxx','xxx']

				t3.add_issue(entities = [part], status = 'Error',
					description = 'The material isn\'t in list',
					material = material,
					suggest = str(suggest),
					loadcase = str(loadcase),
					solver_name =  solver_name,
					mat_card_ID = str(material_id),
					)
		else:
			# Wrong numer of segments
			t2.add_issue(entities = [part], status = 'Error', description = 'Wrong numer of segments')

	return [t1, t2, t3]