示例#1
0
    def setUp(self):
        session.New("discard")
        utils.Merge(_TEST_RESOURCE + "/custom_checks.ansa")

        self.warn_group = base.GetPartFromName("CheckMaterials_custom_id_warn")
        self.warn_parts = base.CollectEntities(constants.NASTRAN,
                                               self.warn_group, "ANSAPART")
        self.warn_n_parts = len(self.warn_parts)

        self.mismatch_group = base.GetPartFromName(
            "CheckMaterials_matdb_fields_mismatch")
        self.mismatch_parts = base.CollectEntities(constants.NASTRAN,
                                                   self.mismatch_group,
                                                   "ANSAPART")
        self.mismatch_n_parts = len(self.mismatch_parts)

        self.ok_group = base.GetPartFromName("CheckMaterials_ok")
        self.ok_parts = base.CollectEntities(constants.NASTRAN, self.ok_group,
                                             "ANSAPART")

        self.fail_group = base.GetPartFromName("custom_id_beyond_range_fail")
        self.fail_parts = base.CollectEntities(constants.NASTRAN,
                                               self.fail_group, "ANSAPART")
        self.fail_n_parts = len(self.fail_parts)

        return 0
示例#2
0
def ConstrainedRigidBodies(Include='None', PutInInclude=0):
    dogy = list()
    if (Include == 'None'):
        RigidBodies = base.CollectEntities(constants.LSDYNA, None,
                                           "CONSTRAINED_RIGID_BODIES", False)
    else:
        RigidBodies = base.CollectEntities(constants.LSDYNA, Include,
                                           "CONSTRAINED_RIGID_BODIES", False)
    print("    Starting ConstrainedRigidBodies To RBE2 %s" %
          (datetime.datetime.now()))
    print("        Proccesing %s entities" % (len(RigidBodies)))
    for RigidBody in RigidBodies:
        PIDM = base.GetEntityCardValues(constants.LSDYNA, RigidBody,
                                        ('PIDM', ))['PIDM']
        PartEntity = base.GetEntity(constants.LSDYNA, '__PROPERTIES__', PIDM)
        PartNodes = base.CollectEntities(constants.LSDYNA,
                                         PartEntity,
                                         "NODE",
                                         recursive=True)
        if (len(PartNodes) == 0):
            print("            ***Warning: Part %s has no nodes" %
                  (PartEntity._id))
            continue
        PartMNode1 = ansa.base.GetEntityCardValues(constants.LSDYNA,
                                                   entity=PartNodes[0],
                                                   fields=('NID', ))['NID']
        PIDS = base.GetEntityCardValues(constants.LSDYNA, RigidBody,
                                        ('PIDS', ))['PIDS']
        PartEntity = base.GetEntity(constants.LSDYNA, '__PROPERTIES__', PIDS)
        PartNodes = base.CollectEntities(constants.LSDYNA,
                                         PartEntity,
                                         "NODE",
                                         recursive=True)
        if (len(PartNodes) == 0):
            print("            ***Warning: Part %s has no nodes" %
                  (PartEntity._id))
            continue
        PartSNode1 = ansa.base.GetEntityCardValues(constants.LSDYNA,
                                                   entity=PartNodes[0],
                                                   fields=('NID', ))['NID']
        RBE2 = base.CreateEntity(
            constants.NASTRAN, "RBE2", {
                'GN': PartMNode1,
                'GM1': PartSNode1,
                'No.of.Nodes': '2',
                'CM': '123456'
            })
        dogy.append(RBE2)
    print("    Finished ConstrainedRigidBodies To RBE2 %s" %
          (datetime.datetime.now()))
    if (PutInInclude == 1 and Include != 'None'):
        base.AddToInclude(Include, dogy)
示例#3
0
    def setUp(self):
        session.New("discard")
        utils.Merge(_TEST_RESOURCE + "/custom_checks.ansa")

        self.fail_group = base.GetPartFromName("CheckNoGeometry_fail")
        self.fail_parts = base.CollectEntities(constants.NASTRAN,
                                               self.fail_group, "ANSAPART")
        self.fail_n_parts = len(self.fail_parts)

        self.ok_group = base.GetPartFromName("CheckNoGeometry_ok")
        self.ok_parts = base.CollectEntities(constants.NASTRAN, self.ok_group,
                                             "ANSAPART")

        return 0
示例#4
0
    def test_bar_stiffness_system(self):
        """
        System test starting with the following top level function:
        
        custom_checks._ExecCheckBarStiffness(ANSAPart, _ ) -> [CheckReport]
        """

        #Check failure part
        failure_part = base.GetPartFromName("CheckBarStiffness_error_elements")
        failure_entity = base.CollectEntities(constants.NASTRAN, failure_part,
                                              "__ELEMENTS__")

        nada = 'None'
        output = custom_checks._ExecCheckBarStiffness(
            failure_entity, nada)  #second input is unused.
        report = output[0]

        #Making sure the only return is just the report object within a list.
        self.assertEqual(
            len(report.issues), 1,
            "The size of the return list is > 1. List contents: " +
            str([x for x in report.issues]))

        #Verify that the single issue that arose is accounted for.
        self.assertEqual(
            report.type,
            "CC Bar Stiffness: Bar elements with error prone stiffness")
        self.assertEqual(report.issues[0].status, "error")
        self.assertEqual(report.issues[0].type, "Error")

        #Check ok part
        ok_part = base.GetPartFromName("CheckBarStiffness_ok_elements")
        ok_entity = base.CollectEntities(constants.NASTRAN, ok_part,
                                         "__ELEMENTS__")

        output2 = custom_checks._ExecCheckBarStiffness(
            ok_entity, nada)  #second input is unused.
        report2 = output2[0]

        #Making sure the only return is just the report object within a list.
        self.assertEqual(
            len(report2.issues), 0,
            "The size of the return list is > 1. List contents: " +
            str([x for x in report2.issues]))

        #Verify that the single issue that arose is accounted for.
        self.assertEqual(
            report2.type,
            "CC Bar Stiffness: Bar elements with error prone stiffness")
示例#5
0
    def setUp(self):
        session.New("discard")
        utils.Merge(_TEST_RESOURCE + "/custom_checks.ansa")

        self.fail_group = base.GetPartFromName("CheckRealized_error")
        self.fail_parts = base.CollectEntities(constants.NASTRAN,
                                               self.fail_group,
                                               "__CONNECTIONS__", True)
        self.fail_n_parts = len(self.fail_parts)

        self.ok_group = base.GetPartFromName("CheckRealized_ok")
        self.ok_parts = base.CollectEntities(constants.NASTRAN, self.ok_group,
                                             "__CONNECTIONS__", True)

        return 0
示例#6
0
def ConstrainedJointRevolute(Include='None', PutInInclude='0'):
    dogy = list()
    if (Include == 'None'):
        Joints = base.CollectEntities(constants.LSDYNA, None,
                                      "CONSTRAINED_JOINT_REVOLUTE", False)
    else:
        Joints = base.CollectEntities(constants.LSDYNA, Include,
                                      "CONSTRAINED_JOINT_REVOLUTE", False)

    PBUSH = base.CreateEntity(constants.NASTRAN, 'PBUSH', {
        'K1': '1E6',
        'K2': '1E6',
        'K3': '1E6',
        'K4': '0',
        'K5': '0',
        'K6': '0'
    })
    print("    Starting ConstrainedJointRevolute To CBUSH %s" %
          (datetime.datetime.now()))
    print("        Proccesing %s entities" % (len(Joints)))
    for Joint in Joints:
        N1 = base.GetEntityCardValues(constants.LSDYNA, Joint, ('N1', ))['N1']
        N2 = base.GetEntityCardValues(constants.LSDYNA, Joint, ('N2', ))['N2']
        N3 = base.GetEntityCardValues(constants.LSDYNA, Joint, ('N3', ))['N3']
        N4 = base.GetEntityCardValues(constants.LSDYNA, Joint, ('N4', ))['N4']
        CBUSH = base.CreateEntity(
            constants.NASTRAN, 'CBUSH', {
                'PID': PBUSH._id,
                'GA': N1,
                'GB': N2,
                'Orient': 'With Cord',
                'CID': '0'
            })
        CBUSH = base.CreateEntity(
            constants.NASTRAN, 'CBUSH', {
                'PID': PBUSH._id,
                'GA': N3,
                'GB': N4,
                'Orient': 'With Cord',
                'CID': '0'
            })
        dogy.append(CBUSH)
    print("    Finished ConstrainedJointSpherical To CBUSH %s" %
          (datetime.datetime.now()))
    if (PutInInclude == 1 and Include != 'None'):
        base.AddToInclude(Include, dogy)
示例#7
0
	def CreateCouplingAndMPCs(self):
		self.CouplingSets=[i for i in self.CouplingSets if str(i).find('id:0>')==-1 and i!=None]
		self.MPCSets=[i for i in self.MPCSets if str(i).find('id:0>')==-1 and i!=None]
		for LoadSets in [self.CouplingSets,self.MPCSets]:
			for i in LoadSets:
				BoundaryArea = base.CollectEntities(constants.ABAQUS,i,{'SHELL','FACE','CONS','NODE','SOLIDFACET','SOLID',})
				BoundaryHotPoints = base.CollectEntities(constants.ABAQUS,BoundaryArea,{'NODE','HOT POINT'})
				BoundaryNodes=base.CollectEntities(constants.ABAQUS,i,{'NODE',})
#				print(BoundaryNodes+BoundaryHotPoints)
				if BoundaryNodes+BoundaryHotPoints==[]:
#					print("The contents in the sets are not supported to create coupling and MPC automatically!")
					continue
				else:
#					print(BoundaryHotPoints)
					CardVals=('X','Y','Z')
					PointTempX=[]
					PointTempY=[]
					PointTempZ=[]
			
					for BHP in BoundaryNodes+BoundaryHotPoints:
						CardValues=base.GetEntityCardValues(constants.ABAQUS, BHP,CardVals)
						PointTempX.append(CardValues['X'])
						PointTempY.append(CardValues['Y'])
						PointTempZ.append(CardValues['Z'])
					BoundaryNodeCoord=[sum(PointTempX)/len(PointTempX),sum(PointTempY)/len(PointTempY),sum(PointTempZ)/len(PointTempZ)]
					RefNode=base.CreateEntity(constants.ABAQUS, "NODE",{'X':BoundaryNodeCoord[0],'Y':BoundaryNodeCoord[1],'Z':BoundaryNodeCoord[2]})
#					print("RefNode=",RefNode)
					if LoadSets==self.CouplingSets:		
						CRCP={'COUPLING':'*DISTRIBUTING','REF NODE':base.GetEntityCardValues(constants.ABAQUS,RefNode,{'ID'})['ID'],'SURF.TYPE':'NODE-BASED','DOF':123,'NSET':base.GetEntityCardValues(constants.ABAQUS,i,{'SID'})['SID'],'Name': 'FromSet'+str(base.GetEntityCardValues(constants.ABAQUS,i,{'Name'})['Name'])}
						base.CreateEntity(constants.ABAQUS,"COUPLING",CRCP)
						CRRNS1={'Name':'RefNode'+str(base.GetEntityCardValues(constants.ABAQUS,RefNode,{'ID'})['ID'])+'For'+str(base.GetEntityCardValues(constants.ABAQUS,i,{'Name'})['Name']),}
						RNS1Set=base.CreateEntity(constants.ABAQUS,"SET",CRRNS1)
#						print('CRRNS1=',CRRNS1)
						base.AddToSet(RNS1Set,RefNode)
						self.RefNodesSets.append(RNS1Set)
					elif LoadSets==self.MPCSets:
						base.AddToSet(i,RefNode)
						CRMPC={'TYPE': 'BEAM', 'NSET': base.GetEntityCardValues(constants.ABAQUS,i,{'SID'})['SID'], 'NODE0': base.GetEntityCardValues(constants.ABAQUS,RefNode,{'ID'})['ID'],'Name': 'FromSet'+str(base.GetEntityCardValues(constants.ABAQUS,i,{'Name'})['Name']),}
						base.CreateEntity(constants.ABAQUS,"MPC",CRMPC)
						CRRNS2={'Name':'RefNode'+str(base.GetEntityCardValues(constants.ABAQUS,RefNode,{'ID'})['ID'])+'For'+str(base.GetEntityCardValues(constants.ABAQUS,i,{'Name'})['Name']),}
						RNS2Set=base.CreateEntity(constants.ABAQUS,"SET",CRRNS2)
						base.AddToSet(RNS2Set,RefNode)
						self.RefNodesSets.append(RNS2Set)
		return 0
示例#8
0
def ConstrainedExtraNodesNode(Include='None', PutInInclude='0'):
    print("Inlude File Name:%s ,ID:%s" % (Include._name, Include._id))

    dogy = list()
    if (Include == 'None'):
        ExtraNodes = base.CollectEntities(constants.LSDYNA, None,
                                          "CONSTRAINED_EXTRA_NODES_NODE",
                                          False)
    else:
        ExtraNodes = base.CollectEntities(constants.LSDYNA, Include,
                                          "CONSTRAINED_EXTRA_NODES_NODE",
                                          False)
    print("    Starting ConstrainedExtraNodesNode To RBE2 %s" %
          (datetime.datetime.now()))
    print("        Proccesing %s entities" % (len(ExtraNodes)))
    for ExtraNode in ExtraNodes:
        PID = base.GetEntityCardValues(constants.LSDYNA, ExtraNode,
                                       ('PID', ))['PID']
        NID = base.GetEntityCardValues(constants.LSDYNA, ExtraNode,
                                       ('NID', ))['NID']
        PartEntity = base.GetEntity(constants.LSDYNA, '__PROPERTIES__', PID)
        PartNodes = base.CollectEntities(constants.LSDYNA,
                                         PartEntity,
                                         "NODE",
                                         recursive=True)
        if (len(PartNodes) == 0):
            print("            ***Warning: Part %s has no nodes" %
                  (PartEntity._id))
            continue
        PartNode1 = ansa.base.GetEntityCardValues(constants.LSDYNA,
                                                  entity=PartNodes[0],
                                                  fields=('NID', ))['NID']
        RBE2 = base.CreateEntity(constants.NASTRAN, "RBE2", {
            'GN': PartNode1,
            'GM1': NID,
            'No.of.Nodes': '2',
            'CM': '123456'
        })
        dogy.append(RBE2)
    print("    Finished ConstrainedExtraNodesNode To RBE2 %s" %
          (datetime.datetime.now()))
    if (PutInInclude == 1 and Include != 'None'):
        base.AddToInclude(Include, dogy)
示例#9
0
    def setUp(self):
        session.New("discard")
        utils.Merge(_TEST_RESOURCE + "/custom_checks.ansa")

        self.fail_group = base.GetPartFromName("CheckConnectivity_error")
        self.fail_parts = base.CollectEntities(constants.NASTRAN,
                                               self.fail_group, "ANSAPART",
                                               True)
        self.fail_n_parts = len(self.fail_parts)

        self.warn_group = base.GetPartFromName("CheckConnectivity_warning")
        self.warn_parts = base.CollectEntities(constants.NASTRAN,
                                               self.warn_group, "ANSAPART",
                                               True)
        self.warn_n_parts = len(self.warn_parts)

        self.ok_group = base.GetPartFromName("CheckConnectivity_ok")
        self.ok_parts = base.CollectEntities(constants.NASTRAN, self.ok_group,
                                             "ANSAPART", True)

        return 0
示例#10
0
def MatRigid(Include='None', PutInInclude='0'):
    dogy = list()
    Mat20 = base.CollectEntities(constants.LSDYNA, None, 'MAT20 MAT_RIGID',
                                 False)
    PartsMat20 = Parts = base.CollectEntities(constants.LSDYNA,
                                              Mat20,
                                              '__PROPERTIES__',
                                              prop_from_entities=True)
    if (Include == 'None'):
        PartsInclude = base.CollectEntities(constants.LSDYNA, None,
                                            '__PROPERTIES__', False)
    else:
        PartsInclude = base.CollectEntities(constants.LSDYNA, Include,
                                            '__PROPERTIES__', False)
    Parts = list(set(PartsMat20) & set(PartsInclude))
    print("    Starting MatRigid To RBE2 %s" % (datetime.datetime.now()))
    print("        Proccesing %s entities" % (len(Parts)))
    for Part in Parts:
        # MatType = base.GetEntityCardValues(constants.LSDYNA,Part,('MID->__type__',)) # See page 27
        PartNodes = base.CollectEntities(constants.LSDYNA,
                                         Part,
                                         "NODE",
                                         recursive=True)
        NodeSet = base.CreateEntity(constants.LSDYNA, "SET",
                                    {'OUTPUT TYPE': 'SET_NODE'})
        base.AddToSet(NodeSet, PartNodes)
        if (len(PartNodes) == 0):
            print("            ***Warning: Part %s has no nodes" % (Part._id))
            continue
        RBE2 = base.CreateEntity(constants.NASTRAN, "RBE2", {
            'GN': PartNodes[0]._id,
            'GM NSET': NodeSet._id,
            'CM': '123456'
        })
        dogy.append(RBE2)
    print("    Finished MatRigid To RBE2 %s" % (datetime.datetime.now()))
    if (PutInInclude == 1 and Include != 'None'):
        base.AddToInclude(Include, dogy)
示例#11
0
 def get_content_of_group(self, group):
     group_content = None
     type_group = None
     self.group_content = None  # output atribute - ansa entity in group
     self.type_group = None  # output atribute - type of group (combine group/mesh group)
     type_group = "MESH GROUP"
     if group and group != ' ':
         print('group content:', group, '\'')
         group_content = base.CollectEntities(constants.PAMCRASH, group,
                                              None)
         for entity in group_content:
             type_group_tmp = entity.ansa_type(constants.PAMCRASH)
             if type_group_tmp == 'GROUP':
                 type_group = "COMBINE GROUP"
                 break
     self.group_content = group_content
     self.type_group = type_group
示例#12
0
	def BatchMesh(self):
		if os.path.isfile('work.ansa_mpar'):
			mpar='./work.ansa_mpar'
			if base.GetEntity(constants.ABAQUS, "BATCH_MESH_SESSION", 1)==None:
				NewScenario=batchmesh.GetNewMeshingScenario('Work','PIDS',)
			else:
				print("Already a Meshing Scenario!")
				NewScenario=base.GetEntity(constants.ABAQUS, "BATCH_MESH_SESSION_GROUP", 1)
			GetSession=base.GetEntity(constants.ABAQUS, "BATCH_MESH_SESSION", 1)
			SessionName = base.GetEntityCardValues(constants.ABAQUS,GetSession, ('Name',))
			print(SessionName)
			base.SetEntityCardValues(constants.ABAQUS,GetSession, {'Name':'WorkSession',})
			batchmesh.AddPartToMeshingScenario (base.CollectEntities(constants.ABAQUS, None, "__PROPERTIES__",True),NewScenario)
			batchmesh.ReadSessionMeshParams(GetSession,mpar)
			batchmesh.RunAllMeshingScenarios()
		else:
			print("please copy your work.ansa_mpar to the working directory first!")
		return
示例#13
0
    def setUp(self):  #Name matters, do not change
        session.New("discard")
        utils.Merge(_TEST_RESOURCE + "/custom_checks.ansa")
        self.CBEAM_regression_set = {(('E', 1000000.0), ('A', 1.0), ('L',
                                                                     10.0))}
        self.CROD_regression_set = {(('E', 1000000.0), ('A', 1.0), ('L', 10.0))
                                    }
        self.CBAR_regression_set = {(('E', 1000000.0), ('A', 1.0), ('L', 10.0))
                                    }
        parts = base.GetPartFromName("test_get_one_d_info_elements")

        self.entities = base.CollectEntities(constants.NASTRAN, parts,
                                             "__ELEMENTS__")
        for each in self.entities:
            if 536 == each._type:
                self.CBEAM_ent = each
            elif 540 == each._type:
                self.CROD_ent = each
            elif 532 == each._type:
                self.CBAR_ent = each

        return 0
示例#14
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]
示例#15
0
	def CreateDloadForPressureSets(self):
		self.PressureSets=[i for i in self.PressureSets if str(i).find('id:0>')==-1 and i!=None]
		for i in self.PressureSets:
			if base.CollectEntities(constants.ABAQUS, i, "__ALL_ENTITIES__",True)!=[]:
				PressureVals={ 'by': 'set','STEP':1,'ELSET':base.GetEntityCardValues(constants.ABAQUS,i,{'SID'})['SID'],'LOAD TYPE':'P','magn(EID)':0,'Name':'DloadOf'+str(base.GetEntityCardValues(constants.ABAQUS,i,{'Name'})['Name'])}
				base.CreateEntity(constants.ABAQUS,"DLOAD",PressureVals)
示例#16
0
 def collect(search_type,
             container=None,
             deck=base.CurrentDeck(),
             **kwargs):
     return QDEntity.convert(
         base.CollectEntities(*(deck, container, search_type), **kwargs))
示例#17
0
 def collect(self, search_type, deck=None, **kwargs):
     if deck is None:
         deck = self.myDeck
     return QDEntity.convert(
         base.CollectEntities(*(deck, self, search_type), **kwargs))
示例#18
0
def Free_Edge():
    '''
	Name: Free_Edge
	Description: Creates a set of elements having more than 1 free edge
	'''

    deck = constants.NASTRAN
    set_check = base.CollectEntities(deck, None, "SET")
    for set in set_check:
        if set.get_entity_values(deck, {'Name'}) == {'Name': 'Free Edge'}:
            guitk.UserWarning("SET named Free Edge already exists")
            return 1
        else:
            continue
    parts = base.CollectEntities(deck, None, "ANSAPART", filter_visible=True)
    idlist = []
    element_list = []
    final = []

    # Collect node ids of first order boundary elements from visible parts
    for part in parts:
        nodes = base.CollectBoundaryNodes(part, False)
        ids = nodes.perimeters
        for id in ids:
            for x in id:
                idlist.append(x._id)

    # collect elements from node list
    for id in idlist:
        ans = base.NodesToElements(id)
        for key, data in ans.items():
            for x in data:
                element_list.append(x)

    # remove duplicate elements
    for element in sorted(element_list):
        while element_list.count(element) > 1:
            element_list.remove(element)

    # collect nodes of each element
    # collect all the elements attached to each node
    # create a list of no.of elements attached to each node
    for element in element_list:
        G1_elements = []
        G2_elements = []
        G3_elements = []
        G4_elements = []
        G_elements = []
        card = element.get_entity_values(deck, {'G1', 'G2', 'G3', 'G4'})
        for key, data in (base.NodesToElements(card['G1']._id)).items():
            for x in data:
                G1_elements.append(x)
        for key, data in (base.NodesToElements(card['G2']._id)).items():
            for x in data:
                G2_elements.append(x)
        for key, data in (base.NodesToElements(card['G3']._id)).items():
            for x in data:
                G3_elements.append(x)
        # element type 517 is tria, ignore fourth node
        if element._type == 517:
            pass
        else:
            for key, data in (base.NodesToElements(card['G4']._id)).items():
                for x in data:
                    G4_elements.append(x)
            G4_elements.remove(element)
            G_elements.append(len(G4_elements))
        G1_elements.remove(element)
        G_elements.append(len(G1_elements))
        G2_elements.remove(element)
        G_elements.append(len(G2_elements))
        G3_elements.remove(element)
        G_elements.append(len(G3_elements))

        # element has free edge if two adj nodes have no common elements
        # store elements with more than two free edges in final list
        result = []
        for val in G1_elements:
            if G2_elements.count(val) >= 1:
                Edge1 = 0
                break
            else:
                Edge1 = 1
        result.append(Edge1)
        for val in G2_elements:
            if G3_elements.count(val) >= 1:
                Edge2 = 0
                break
            else:
                Edge2 = 1
        result.append(Edge2)
        if element._type == 517:
            for val in G3_elements:
                if G1_elements.count(val) >= 1:
                    Edge3 = 0
                    break
                else:
                    Edge3 = 1
            result.append(Edge3)
        else:
            for val in G3_elements:
                if G4_elements.count(val) >= 1:
                    Edge3 = 0
                    break
                else:
                    Edge3 = 1
            result.append(Edge3)
            for val in G4_elements:
                if G1_elements.count(val) >= 1:
                    Edge4 = 0
                    break
                else:
                    Edge4 = 1
            result.append(Edge4)
        if result.count(1) >= 2:
            final.append(element)

        # no.of elements attached to a node is 0, then node has two free edges
        elif element._type == 513 and G_elements.count(0) >= 1:
            final.append(element)

        # Trias have G4 value as zero
        elif element._type == 517 and G_elements.count(0) >= 2:
            final.append(element)
        else:
            pass

    set = base.CreateEntity(deck, 'SET', {'Name': 'Free Edge'})
    base.AddToSet(set, final)
    return 1
示例#19
0
def exe(entities, params):
    solver = params['Solver']
    solver_name = solver.upper()
    if solver_name == 'ABAQUS' or solver_name == 'PAMCRASH':
        if solver_name == 'ABAQUS':
            solver = constants.ABAQUS
            ent = ["SHELL_SECTION", "SOLID_SECTION", "MEMBRANE_SECTION"]
            id_mat = 'MID'
            thickness = 'T'
            remove_text = "_SECTION"
        if solver_name == 'PAMCRASH':
            solver = constants.PAMCRASH
            ent = ["PART_SHELL", "PART_SOLID", "PART_MEMBRANE"]
            id_mat = 'IMAT'
            remove_text = "PART_"
            thickness = 'h'
            c_thickness = 'TCONT'
    # else:
    # session.Quit()

    t5 = base.CheckReport('Thickness same as in part name')
    t7 = base.CheckReport('Material same as in part name')

    t5.has_fix = False
    t7.has_fix = False

    m = utils.SelectOpenFile(0, 'Excel files (*.xlsx)')
    if len(m):
        print('Used :', m[0])
        xl_parts = utils.XlsxOpen(m[0])

        # read excel, find cell position of part name params['Excel part name identifier']
        row = 0
        empty_row = 0
        Component_column = -1
        Component_row = 0
        Component_name = params['Excel part name identifier']
        Component_name = Component_name.replace("\r", "")
        Component_name = Component_name.replace("\n", "")
        Component_name = Component_name.replace(" ", "")
        while (empty_row < 20 and Component_column == -1):
            empty_column = 0
            column = 0
            while (empty_column < 20 and Component_column == -1):
                value = utils.XlsxGetCellValue(xl_parts,
                                               params['Excel sheet name'], row,
                                               column)
                if value != None and value != '':
                    value = value.replace("\r", "")
                    value = value.replace("\n", "")
                    value = value.replace(" ", "")
                    empty_column = 0
                    if value == Component_name:
                        Component_column = column
                        Component_row = row
                else:
                    empty_column += 1
                column += 1
            if column == empty_column:
                empty_row += 1
            row += 1
        # print('Component_column:',Component_column)
        # print('Component_row:',Component_row)
        if Component_column == -1:
            print('NOT FOUND cell with name "',
                  params['Excel part name identifier'], '" in file ', m[0],
                  'in sheet ', params['Excel sheet name'])
            # session.Quit()

        # read excel, find cell position of part nummer name params['Excel part number name identifier']
        empty_column = 0
        column = 0
        P_N_column = -1
        P_N_name = params['Excel part number name identifier']
        P_N_name = P_N_name.replace("\r", "")
        P_N_name = P_N_name.replace("\n", "")
        P_N_name = P_N_name.replace(" ", "")
        while (empty_column < 20 and P_N_column == -1):
            value = utils.XlsxGetCellValue(xl_parts,
                                           params['Excel sheet name'],
                                           Component_row, column)
            if value != None and value != '':
                value = value.replace("\r", "")
                value = value.replace("\n", "")
                value = value.replace(" ", "")
                empty_column = 0
                if value == P_N_name:
                    P_N_column = column
            else:
                empty_column += 1
            column += 1
        # print('P_N_column:',P_N_column)
        if P_N_column == -1:
            print('NOT FOUND cell with name "',
                  params['Excel part number name identifier'], '" in file ',
                  m[0], 'in sheet ', params['Excel sheet name'])
            # session.Quit()

        # read excel, find cell position of part material name params['Excel material name identifier']
        empty_column = 0
        column = 0
        Material_column = -1
        Material_name = params['Excel material name identifier']
        Material_name = Material_name.replace("\r", "")
        Material_name = Material_name.replace("\n", "")
        Material_name = Material_name.replace(" ", "")
        while (empty_column < 20):
            value = utils.XlsxGetCellValue(xl_parts,
                                           params['Excel sheet name'],
                                           Component_row, column)
            if value != None and value != '':
                value = value.replace("\r", "")
                value = value.replace("\n", "")
                value = value.replace(" ", "")
                empty_column = 0
                if value == Material_name:
                    Material_column = column
            else:
                empty_column += 1
            column += 1
        # print('Material_column:',Material_column)
        if Material_column == -1:
            print('NOT FOUND cell with name "',
                  params['Excel material name identifier'], '" in file ', m[0],
                  'in sheet ', params['Excel sheet name'])
            # session.Quit()

        # read excel, find cell position of part thickness name 't \r\n[mm]'
        empty_column = 0
        column = 0
        Th_column = -1
        Th_name = params['Excel thickness name identifier']
        Th_name = Th_name.replace("\r", "")
        Th_name = Th_name.replace("\n", "")
        Th_name = Th_name.replace(" ", "")
        while (empty_column < 20):
            value = utils.XlsxGetCellValue(xl_parts,
                                           params['Excel sheet name'],
                                           Component_row, column)
            if value != None and value != '':
                value = value.replace("\r", "")
                value = value.replace("\n", "")
                value = value.replace(" ", "")
                empty_column = 0
                if value == Th_name:
                    Th_column = column
            else:
                empty_column += 1
            column += 1
        # print('Th_column:',Th_column)
        if Th_column == -1:
            print('NOT FOUND cell with name of thickness in file ', m[0],
                  'in sheet ', params['Excel sheet name'])
            # session.Quit()
        row = Component_row + 1
        empty = 0
        parts = 0
        excel_part_id = list()
        excel_part_name = list()
        excel_part_thickness = list()
        excel_part_mat = list()

        value = utils.XlsxGetCellValue(xl_parts, params['Excel sheet name'],
                                       row, Component_column)
        while empty < 20:
            if value != None and value != '':
                part_name = value
                print('excel_part_name:', part_name)
                part_id = utils.XlsxGetCellValue(xl_parts,
                                                 params['Excel sheet name'],
                                                 row, P_N_column)
                print('excel_part_id:', part_id)
                value = utils.XlsxGetCellValue(xl_parts,
                                               params['Excel sheet name'], row,
                                               Th_column)
                try:
                    part_thickness = float(value)
                    print('excel_part_thickness:', part_thickness)
                except ValueError:
                    part_thickness = float(0.)
                part_mat = utils.XlsxGetCellValue(xl_parts,
                                                  params['Excel sheet name'],
                                                  row, Material_column)
                print('excel_part_mat:', part_mat)
                empty = 0
                excel_part_id.append(part_id)
                excel_part_name.append(part_name)
                excel_part_thickness.append(part_thickness)
                excel_part_mat.append(part_mat)
            else:
                empty += 1
            row += 1
            value = utils.XlsxGetCellValue(xl_parts,
                                           params['Excel sheet name'], row,
                                           Component_column)
            name_list = value.split('Battery Case Assembly')
            if len(name_list) > 1:
                empty = 20

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

        for part in parts:
            name = part._name
            name_list = name.split(params['Delimiter for part name'])
            pid_name = name_list[int(params['Segment of part name']) - 1]
            identifier = -1
            for interval in range(len(excel_part_name)):
                if (len(pid_name.split(excel_part_name[interval])) > 1
                        and len(pid_name.split(excel_part_id[interval])) > 1):
                    print('find_excel_part_name:', pid_name, ' vs.:',
                          excel_part_id[interval], '_',
                          excel_part_name[interval])
                    identifier = interval

            if identifier != -1:

                # check of thickness by info from part name
                if str(params['Thickness by part name check']) == 'YES':
                    # print('Segment of thickness name :',params['Segment of thickness name'])
                    # print('excel value :',excel_part_thickness[identifier])
                    if (str(params['Segment of thickness name']) != "0" and
                            str(params['Segment of thickness name']) != "var"
                        ) and str(params['Segment of thickness name']) != "":
                        thickness_from_part_name = name_list[
                            int(params['Segment of thickness name']) - 1]
                        thickness_from_part_name = thickness_from_part_name.replace(
                            "mm", "")
                        thickness_from_part_name = thickness_from_part_name.replace(
                            "t", "")
                        thickness_from_part_name = thickness_from_part_name.replace(
                            "_", "")
                        if float(excel_part_thickness[identifier]) != float(
                                thickness_from_part_name):
                            if float(excel_part_thickness[identifier]) > 0.:
                                t5.add_issue(
                                    entities=[part],
                                    status='Error',
                                    description='Thickness is different than '
                                    + str(excel_part_thickness[identifier]),
                                    thickness=str(thickness_from_part_name),
                                    thickness_suggest=str(
                                        excel_part_thickness[identifier]),
                                    key=thickness,
                                    solver=str(solver))
                            else:
                                t5.add_issue(
                                    entities=[part],
                                    status='Warning',
                                    description='Thickness is different than '
                                    + str(excel_part_thickness[identifier]),
                                    thickness=str(thickness_from_part_name),
                                    key=thickness,
                                    solver=str(solver))

                # check of material by info from part name
                if str(params['Material by part name check']) == 'YES':
                    # print('Segment of material name :',params['Segment of material name'])
                    # print('excel value :',excel_part_mat[identifier])
                    if (str(params['Segment of material name']) != "0" and
                            str(params['Segment of material name']) != "var"
                        ) and str(params['Segment of material name']) != "":
                        material_from_part_name = name_list[
                            int(params['Segment of material name']) - 1]
                        if excel_part_mat[
                                identifier] != material_from_part_name:
                            t7.add_issue(
                                entities=[part],
                                status='Error',
                                description='Material is different than ' +
                                str(excel_part_mat[identifier]),
                                thickness=str(material_from_part_name),
                                thickness_suggest=str(
                                    excel_part_mat[identifier]),
                                key=thickness,
                                solver=str(solver))

        CheckItem.reports.append(t5)
        CheckItem.reports.append(t7)
    else:
        print('Excel file was not chosen.')
        # session.Quit()

    return CheckItem.reports
示例#20
0
def exe(entities, params):
    t0 = time.time()
    print('start measure time')
    mesh.ReadQualityCriteria(params['Quality mesh file'])

    # Solver dependent variables
    solver = params['Solver']
    solver_name = solver.upper()
    limit_lines = int(params['Detail list for number of errors'])
    if solver_name == 'ABAQUS' or solver_name == 'PAMCRASH':
        if solver_name == 'ABAQUS':
            solver = constants.ABAQUS
            ent = ["SHELL_SECTION", "SOLID_SECTION", "MEMBRANE_SECTION"]
            thickness = 'T'
            remove_text = "_SECTION"
            name_part_key = 'PID'
        if solver_name == 'PAMCRASH':
            solver = constants.PAMCRASH
            ent = ["PART_SHELL", "PART_SOLID", "PART_MEMBRANE"]
            thickness = 'h'
            c_thickness = 'TCONT'
            name_part_key = 'IPART'
    else:
        session.Quit()

    # Basic criteria
    criterias = { \
     'ASPECT,SHELL,QUAD,TRIA':{'criteria name F11': 'aspect ratio', 'comparison':'<','type':'QUAD,TRIA'},
     'SKEW,SHELL,QUAD,TRIA':{'criteria name F11':"skewness",'comparison':'<','type':'QUAD,TRIA'},
     'WARP,SHELL,QUAD':{'criteria name F11':"warping",'comparison':'<','type':'QUAD'},
     'TAPER,SHELL,QUAD':{'criteria name F11':"taper",'comparison':'>','type':'QUAD'},
     'CRASH,SHELL,QUAD,TRIA':{'criteria name F11':"crash time step",'comparison':'>','type':'QUAD,TRIA'},
     'MIN HEI,SHELL,QUAD,TRIA':{'criteria name F11':"min height",'comparison':'>','type':'QUAD,TRIA'},
     'MIN-LEN,SHELL,QUAD,TRIA':{'criteria name F11':"min length",'comparison':'>','type':'QUAD,TRIA'},
     'MINANGLE,SHELL,QUAD':{'criteria name F11':"min angle quads",'comparison':'>','type':'QUAD'},
     'MAXANGLE,SHELL,QUAD':{'criteria name F11':"max angle quads",'comparison':'<','type':'QUAD'},
     'MINANGLE,SHELL,TRIA':{'criteria name F11':"min angle trias",'comparison':'>','type':'TRIA'},
     'MAXANGLE,SHELL,TRIA':{'criteria name F11':"max angle trias",'comparison':'<','type':'TRIA'},
     'TRIANGLES PER NODE,SHELL,QUAD,TRIA':{'criteria name F11':"triangles per node",'comparison':'<=','type':'QUAD,TRIA'},
     'ASPECT,SOLID,TETRA,HEXA,PENTA':{'criteria name F11': 'aspect ratio', 'comparison':'<','type':'TETRA,HEXA,PENTA'},
     'SKEW,SOLID,TETRA,HEXA,PENTA':{'criteria name F11':"skewness",'comparison':'<','type':'TETRA,HEXA,PENTA'},
     'WARP,SOLID,TETRA,HEXA,PENTA':{'criteria name F11':"warping",'comparison':'<','type':'TETRA,HEXA,PENTA'},
     'CRASH,SOLID,TETRA,HEXA,PENTA':{'criteria name F11':"crash time step",'comparison':'>','type':'TETRA,HEXA,PENTA'},
     'MIN-LEN,SOLID,TETRA,HEXA,PENTA':{'criteria name F11':"min length",'comparison':'>','type':'TETRA,HEXA,PENTA'},
     'MINANGLE,SOLID,TETRA':{'criteria name F11':"min angle tetras",'comparison':'>','type':'TETRA'},
     'MAXANGLE,SOLID,TETRA':{'criteria name F11':"max angle tetras",'comparison':'<','type':'TETRA'},
     'MINANGLE,SOLID,HEXA':{'criteria name F11':"min angle hexas",'comparison':'>','type':'HEXA'},
     'MAXANGLE,SOLID,HEXA':{'criteria name F11':"max angle hexas",'comparison':'<','type':'HEXA'},
     'MINANGLE,SOLID,PENTA':{'criteria name F11':"min angle pentas",'comparison':'>','type':'PENTA'},
     'MAXANGLE,SOLID,PENTA':{'criteria name F11':"max angle pentas",'comparison':'<','type':'PENTA'}}

    criterias_type_ent = {}
    criterias_type_val = {}
    criterias_type_oper = {}
    criterias_val = {}
    t = {}

    # Reorder criteria for checking
    for key, val in criterias.items():
        key = key.split(',')
        if key[1] == 'SOLID':
            m = base.F11SolidsOptionsGet(val['criteria name F11'])
        if key[1] == 'SHELL':

            m = base.F11ShellsOptionsGet(val['criteria name F11'])
        if m['status'] == 1:
            val['val'] = m['value']
            criterias_val[key[0] + ',' + key[1]] = val

            for ty in val['type'].split(','):
                disct_text = key[1] + ',' + ty

                # Type of entity
                if disct_text in criterias_type_ent:
                    criterias_type_ent[disct_text] = criterias_type_ent[
                        disct_text] + [key[0]]
                else:
                    criterias_type_ent[disct_text] = [key[0]]

                # Value of limit
                if disct_text in criterias_type_val:
                    criterias_type_val[disct_text] = criterias_type_val[
                        disct_text] + [m['value']]
                else:
                    criterias_type_val[disct_text] = [m['value']]

                # Operator for comparison
                if disct_text in criterias_type_oper:
                    criterias_type_oper[disct_text] = criterias_type_oper[
                        disct_text] + [val['comparison']]
                else:
                    criterias_type_oper[disct_text] = [val['comparison']]

            t[','.join(key[0:2])] = base.CheckReport(key[1] + ',' + key[0])
            t[','.join(key[0:2])].has_fix = False

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

    mats = base.CollectEntities(solver,
                                parts,
                                '__MATERIALS__',
                                mat_from_entities=True)

    elements = {}
    elements['SHELL'] = base.CollectEntities(deck=solver,
                                             containers=None,
                                             search_types=['SHELL'],
                                             filter_visible=True)
    elements['SOLID'] = base.CollectEntities(deck=solver,
                                             containers=None,
                                             search_types=['SOLID'],
                                             filter_visible=True)

    # Extracting the thickness parameter from PARTs
    thickness_dict = {}
    for part in parts:
        if part.ansa_type(solver) == 'PART_SHELL':
            thick = part.get_entity_values(solver, [thickness, c_thickness])
        if part.ansa_type(solver) == 'PART_MEMBRANE':
            thick = part.get_entity_values(solver, [thickness])
            thick[c_thickness] = thick[thickness]
        if not thick[c_thickness]:
            thickness_dict[part] = thick[thickness]
        else:
            thickness_dict[part] = thick[c_thickness]

    # Extracting the defined mats
    flag_defined_mat = 'YES'
    for mat in mats:
        defined = mat.get_entity_values(solver, ['DEFINED', 'Name'])
        if defined['DEFINED'] == 'NO':
            flag_defined_mat = 'NO'
            break

    # Checking loops
    i = {}
    en = {}
    for type, elems in elements.items():
        t3 = time.time()
        for ent in elems:
            if type == 'SHELL':
                prop = ent.get_entity_values(solver, ['IPART'])['IPART']
            typ = ent.get_entity_values(solver, ['type'])['type']
            dict_text = type + ',' + typ
            qual = base.ElementQuality(ent, criterias_type_ent[dict_text])
            crit = criterias_type_ent[dict_text]
            limit = criterias_type_val[dict_text]
            oper = criterias_type_oper[dict_text]
            for compare in zip(qual, limit, crit, oper):
                text = compare[2] + ',' + type

                # Standard check for elements
                if text not in i:
                    i[text] = 0
                    en[text] = []

                flag_error = False
                if compare[0] != 'error':
                    if compare[3] == '>':
                        if float(compare[0]) < float(compare[1]):
                            flag_error = True
                            diff = str(compare[1] - compare[0])

                    if compare[3] == '<':

                        if float(compare[0]) > float(compare[1]):
                            flag_error = True
                            diff = str(compare[0] - compare[1])

                    if compare[3] == '<=':
                        if float(compare[0]) >= float(compare[1]):
                            flag_error = True
                            diff = str(compare[0] - compare[1])

                    if flag_error == True:
                        i[text] = i[text] + 1
                        if i[text] < limit_lines:
                            t[text].add_issue(entities=[ent],
                                              status='Error',
                                              description=compare[2] + '  ' +
                                              type,
                                              value=str(compare[0]),
                                              limit=str(compare[1]),
                                              diffe=diff)
                        else:
                            en[text].append(ent)
                else:
                    continue

                # Additional check for lenght - thick * THICKNESS FACTOR
                if type == 'SHELL':
                    if compare[2] == "MIN HEI" or compare[2] == "MIN-LEN":
                        lim = float(thickness_dict[prop]) * float(
                            params['THICKNESS FACTOR'])
                        if compare[0] < lim:
                            i[text] = i[text] + 1
                            if i[text] < limit_lines:
                                diff = str(lim - compare[0])
                                t[text].add_issue(entities=[ent],
                                                  status='Error',
                                                  description=compare[2] +
                                                  ' THICKNESS FACTOR',
                                                  value=str(compare[0]),
                                                  limit=str(lim),
                                                  diff=diff)
                            else:
                                en[text].append(ent)

                    # Check for skewness - user defined
                    if compare[2] == 'SKEW':
                        if typ == 'TRIA':
                            lim = float(params['SKEW,TRIA'])
                        elif typ == 'QUAD':
                            lim = float(params['SKEW,QUAD'])
                        if compare[0] > lim:
                            i[text] = i[text] + 1
                            if i[text] < limit_lines:
                                diff = str(lim - compare[0])
                                t[text].add_issue(entities=[ent],
                                                  status='Error',
                                                  description=compare[2] +
                                                  '  ' + type,
                                                  value=str(compare[0]),
                                                  limit=str(lim),
                                                  diff=diff)
                            else:
                                en[text].append(ent)
        t4 = time.time()
        print('Time of checking the type of entity: ', type)
        print(t4 - t3)

    if i != None:
        for key, val in i.items():
            if val > limit_lines:
                t[key].add_issue(entities=en[key],
                                 status='Error',
                                 description=key + '  number of errors: ' +
                                 str(len(en[key])))

    t5 = time.time()
    print('End of execution of the check: ')
    print(t5 - t0)

    return list(t.values())
def exe(entities, params):

    if base.CurrentDeck() != constants.PAMCRASH:
        base.SetCurrentDeck(constants.PAMCRASH)
        print("Switch form current deck to PAMCRASH")
        print("Please run the check again !!!!")
        return []

    type_check = params['Car - SKODA/DAIMLER']
    element_length = params['Default mesh length']
    THICKNESS_FACTOR = 1.1
    SKEW_TRIA = 60.0
    SKEW_QUAD = 48.0

    t0 = time.time()
    print('Start measure time....')

    if params['User quality mesh file'] != '':
        user_define_qual = True
        success = mesh.ReadQualityCriteria(params['User quality mesh file'])
        if success == 1:
            print('User defined mesh quality file was loaded')
        else:
            print('User defined mesh quality file was\'n loaded')
            session.Quit()

    else:
        if type_check == 'DAIMLER' and params[
                'Material type (polymer/steel)'] == 'polymer' and element_length == '5':
            success = mesh.ReadQualityCriteria(
                os.path.join(PATH_SELF, 'res', 'DAIMLER', 'O5mm.ansa_qual'))
            if success == 1:
                print(
                    'Mesh quality file was loaded - DAIMLER - O5mm.ansa_qual')
            else:
                print('User defined mesh quality file was\'n loaded')
                session.Quit()

        if type_check == 'SKODA' and params[
                'Material type (polymer/steel)'] == 'polymer' and element_length == '5':
            success = mesh.ReadQualityCriteria(
                os.path.join(PATH_SELF, 'res', 'SKODA', 'Plast_5mm.ansa_qual'))
            if success == 1:
                print(
                    'Mesh quality file was loaded - SKODA - Plast_5mm.ansa_qual'
                )
            else:
                print('User defined mesh quality file was\'n loaded')
                session.Quit()

    if success == 0:
        print(
            'Any mesh quality file was\'n loaded - current mesh quality element will be used'
        )

    # Solver dependent variables
    solver = params['Solver']
    solver_name = solver.upper()
    limit_lines = int(params['Detail list for number of errors'])
    if solver_name == 'ABAQUS' or solver_name == 'PAMCRASH' or solver_name == 'LSDYNA':

        if solver_name == 'ABAQUS':
            solver = constants.ABAQUS
            properties_types = {
                'SHELL_SECTION': "SHELL_SECTION",
                "SOLID_SECTION": "SOLID_SECTION",
                "MEMBRANE_SECTION": "MEMBRANE_SECTION",
                'COMPOSITE': 'COMPOSITE',
                'LAMINATE': 'LAMINATE'
            }
            thickness = 'T'
            c_thickness = 'T'
            name_part_key = 'PID'
            element_types = {
                'SHELL': 'SHELL',
                'MEMBRANE': 'MEMBRANE',
                'SOLID': 'SOLID'
            }
            material_key = 'MID'
            material_key_comp = 'MID(1)'

        if solver_name == 'PAMCRASH':
            solver = constants.PAMCRASH
            properties_types = {
                'SHELL_SECTION': "PART_SHELL",
                "SOLID_SECTION": "PART_SOLID",
                "MEMBRANE_SECTION": "PART_MEMBRANE",
                'COMPOSITE': 'COMPOSITE',
                'LAMINATE': 'LAMINATE'
            }
            thickness = 'h'
            c_thickness = 'TCONT'
            name_part_key = 'IPART'
            material_key = 'IMAT'
            material_key_comp = 'IMAT'
            element_types = {
                'SHELL': 'SHELL',
                'MEMBRANE': 'MEMBRANE',
                'SOLID': 'SOLID'
            }

        if solver_name == 'LSDYNA':
            solver = constants.LSDYNA
            properties_types = {
                'SHELL_SECTION': "SECTION_SHELL",
                "SOLID_SECTION": "SECTION_SOLID",
                "MEMBRANE_SECTION": "SECTION_MEMBRANE",
                'COMPOSITE': 'PART_COMPOSITE',
                'LAMINATE': 'LAMINATE'
            }
            thickness = 'T1'
            material_key_comp = 'mid1'
            c_thickness = 'OPTT'
            name_part_key = 'PID'
            material_key = 'MID'
            element_types = {
                'SHELL': 'ELEMENT_SHELL',
                'MEMBRANE': 'MEMBRANE',
                'SOLID': 'ELEMENT_SOLID'
            }
    else:
        session.Quit()

    properties_types_list = [
        typ_property for _, typ_property in properties_types.items()
    ]

    print("SOLVER:", solver_name)

    # Basic criteria
    criterias = {
        'ASPECT,SHELL,QUAD,TRIA': {
            'criteria name F11': 'aspect ratio',
            'comparison': '<',
            'type': 'QUAD,TRIA'
        },
        'SKEW,SHELL,QUAD,TRIA': {
            'criteria name F11': "skewness",
            'comparison': '<',
            'type': 'QUAD,TRIA'
        },
        'WARP,SHELL,QUAD': {
            'criteria name F11': "warping",
            'comparison': '<',
            'type': 'QUAD'
        },
        'TAPER,SHELL,QUAD': {
            'criteria name F11': "taper",
            'comparison': '>',
            'type': 'QUAD'
        },
        'CRASH,SHELL,QUAD,TRIA': {
            'criteria name F11': "crash time step",
            'comparison': '>',
            'type': 'QUAD,TRIA'
        },
        'MIN HEI,SHELL,QUAD,TRIA': {
            'criteria name F11': "min height",
            'comparison': '>',
            'type': 'QUAD,TRIA'
        },
        'MIN-LEN,SHELL,QUAD,TRIA': {
            'criteria name F11': "min length",
            'comparison': '>',
            'type': 'QUAD,TRIA'
        },
        'MINANGLE,SHELL,QUAD': {
            'criteria name F11': "min angle quads",
            'comparison': '>',
            'type': 'QUAD'
        },
        'MAXANGLE,SHELL,QUAD': {
            'criteria name F11': "max angle quads",
            'comparison': '<',
            'type': 'QUAD'
        },
        'MINANGLE,SHELL,TRIA': {
            'criteria name F11': "min angle trias",
            'comparison': '>',
            'type': 'TRIA'
        },
        'MAXANGLE,SHELL,TRIA': {
            'criteria name F11': "max angle trias",
            'comparison': '<',
            'type': 'TRIA'
        },
        'TRIANGLES PER NODE,SHELL,QUAD,TRIA': {
            'criteria name F11': "triangles per node",
            'comparison': '>=',
            'type': 'QUAD,TRIA'
        },
        'ASPECT,SOLID,TETRA,HEXA,PENTA': {
            'criteria name F11': 'aspect ratio',
            'comparison': '<',
            'type': 'TETRA,HEXA,PENTA'
        },
        'SKEW,SOLID,TETRA,HEXA,PENTA': {
            'criteria name F11': "skewness",
            'comparison': '<',
            'type': 'TETRA,HEXA,PENTA'
        },
        'WARP,SOLID,TETRA,HEXA,PENTA': {
            'criteria name F11': "warping",
            'comparison': '<',
            'type': 'TETRA,HEXA,PENTA'
        },
        'CRASH,SOLID,TETRA,HEXA,PENTA': {
            'criteria name F11': "crash time step",
            'comparison': '>',
            'type': 'TETRA,HEXA,PENTA'
        },
        'MIN-LEN,SOLID,TETRA,HEXA,PENTA': {
            'criteria name F11': "min length",
            'comparison': '>',
            'type': 'TETRA,HEXA,PENTA'
        },
        'MINANGLE,SOLID,TETRA': {
            'criteria name F11': "min angle tetras",
            'comparison': '>',
            'type': 'TETRA'
        },
        'MAXANGLE,SOLID,TETRA': {
            'criteria name F11': "max angle tetras",
            'comparison': '<',
            'type': 'TETRA'
        },
        'MINANGLE,SOLID,HEXA': {
            'criteria name F11': "min angle hexas",
            'comparison': '>',
            'type': 'HEXA'
        },
        'MAXANGLE,SOLID,HEXA': {
            'criteria name F11': "max angle hexas",
            'comparison': '<',
            'type': 'HEXA'
        },
        'MINANGLE,SOLID,PENTA': {
            'criteria name F11': "min angle pentas",
            'comparison': '>',
            'type': 'PENTA'
        },
        'MAXANGLE,SOLID,PENTA': {
            'criteria name F11': "max angle pentas",
            'comparison': '<',
            'type': 'PENTA'
        }
    }

    criterias_type_ent = {}
    criterias_type_val = {}
    criterias_type_oper = {}
    criterias_val = {}
    t = {}

    # Reorder criteria for checking
    for key, val in criterias.items():
        key = key.split(',')

        if key[1] == 'SOLID':
            criteria_from_f11 = base.F11SolidsOptionsGet(
                val['criteria name F11'])

        if key[1] == 'SHELL':
            criteria_from_f11 = base.F11ShellsOptionsGet(
                val['criteria name F11'])

        if criteria_from_f11['status'] == 1:
            val['val'] = criteria_from_f11['value']
            criterias_val[key[0] + ',' + key[1]] = val

            for ty in val['type'].split(','):
                disct_text = key[1] + ',' + ty

                # Type of entity
                if disct_text in criterias_type_ent:
                    criterias_type_ent[disct_text] = criterias_type_ent[
                        disct_text] + [key[0]]
                else:
                    criterias_type_ent[disct_text] = [key[0]]
                # Value of limit
                if disct_text in criterias_type_val:
                    criterias_type_val[disct_text] = criterias_type_val[
                        disct_text] + [criteria_from_f11['value']]
                else:
                    criterias_type_val[disct_text] = [
                        criteria_from_f11['value']
                    ]

                # Operator for comparison
                if disct_text in criterias_type_oper:
                    criterias_type_oper[disct_text] = criterias_type_oper[
                        disct_text] + [val['comparison']]
                else:
                    criterias_type_oper[disct_text] = [val['comparison']]

            t[','.join(key[0:2])] = base.CheckReport(key[1] + ',' + key[0])
            t[','.join(key[0:2])].has_fix = False

    t['Check of materials DEFINED = YES'] = base.CheckReport(
        'Check of materials DEFINED = YES')
    t['Check of materials DEFINED = YES'].has_fix = False

    # Collecting entities
    parts = base.CollectEntities(solver,
                                 entities,
                                 properties_types_list,
                                 prop_from_entities=True)

    mats = base.CollectEntities(solver,
                                parts,
                                '__MATERIALS__',
                                mat_from_entities=True)

    # Extracting the thickness parameter from PARTs

    thickness_dict = dict()
    defined_material = dict()
    text_errors_mat = list()
    thick = dict()

    for part in parts:

        if part.ansa_type(solver) == properties_types['SOLID_SECTION']:
            continue

        if part.ansa_type(solver) == properties_types['SHELL_SECTION']:
            thick = part.get_entity_values(solver, [thickness, c_thickness])

        if part.ansa_type(
                solver) == properties_types['LAMINATE'] or part.ansa_type(
                    solver) == properties_types['COMPOSITE']:
            thick[thickness] = 10000

        if part.ansa_type(solver) == properties_types['MEMBRANE_SECTION']:
            thick = part.get_entity_values(solver, [thickness])
            thick[c_thickness] = thick[thickness]

        if c_thickness in thick:
            thickness_dict[part] = thick[c_thickness]
        else:
            thickness_dict[part] = thick[thickness]

        # # Extracting the defined mats
        if type_check == 'SKODA':
            part_type = part.ansa_type(solver)
            if part_type == 'LAMINATE':
                material_key = material_key_comp
#            print('part', part)

            mat = part.get_entity_values(solver, [material_key])[material_key]
            defined = mat.get_entity_values(solver, ['DEFINED'])

            if defined['DEFINED'] == 'NO':
                defined_material[part] = False
                text = 'The material id = ' + str(
                    mat._id
                ) + ' wasn\'t defined - the check the CRASH TIME STEP was skipped'

                if not (text in text_errors_mat):
                    t['Check of materials DEFINED = YES'].add_issue(
                        entities=[mat],
                        status='Error',
                        description=text,
                        value="",
                        diff="")
                text_errors_mat.append(text)
            else:
                defined_material[part] = True

    # Checking loops
    number_errors = {}
    text_errors = {}
    #print(len(entities))
    for element in entities:

        element_type = element.ansa_type(solver)

        if element_type == element_types['SHELL']:
            prop = element.get_entity_values(solver,
                                             [name_part_key])[name_part_key]
            element_type_universal = 'SHELL'
        elif element_type == element_types['SOLID']:
            element_type_universal = 'SOLID'
        elif element_type == element_types['MEMBRANE']:
            element_type_universal = 'MEMBRANE'

        typ = element.get_entity_values(solver, ['type'])['type']
        dict_text = element_type_universal + ',' + typ

        qual = base.ElementQuality(element, criterias_type_ent[dict_text])
        crit = criterias_type_ent[dict_text]
        limit = criterias_type_val[dict_text]
        oper = criterias_type_oper[dict_text]

        for compare in zip(qual, limit, crit, oper):
            text = compare[2] + ',' + element_type_universal

            if text not in number_errors:
                number_errors[text] = 0
                text_errors[text] = []

            # Additional check for lenght - thick * THICKNESS FACTOR
            if element_type == element_types['SHELL'] and type_check == 'SKODA':

                if compare[2] == "MIN HEI" or compare[2] == "MIN-LEN":

                    if thickness_dict[prop]:
                        lim = float(
                            thickness_dict[prop]) * float(THICKNESS_FACTOR)

                        if compare[0] < lim:

                            number_errors[text] = number_errors[text] + 1

                            if number_errors[text] < limit_lines:
                                diff = str(lim - compare[0])
                                t[text].add_issue(entities=[element],
                                                  status='Error',
                                                  description=compare[2] +
                                                  ' THICKNESS FACTOR',
                                                  value=str(compare[0]),
                                                  limit=str(lim),
                                                  diff=diff)
                            else:
                                text_errors[text].append(element)
                    continue

                # Check for skewness - user defined
                if compare[2] == 'SKEW':
                    if typ == 'TRIA':
                        lim = float(SKEW_TRIA)
                    elif typ == 'QUAD':
                        lim = float(SKEW_QUAD)
                    if compare[0] > lim:

                        number_errors[text] = number_errors[text] + 1
                        if number_errors[text] < limit_lines:
                            diff = str(lim - compare[0])
                            t[text].add_issue(entities=[element],
                                              status='Error',
                                              description=compare[2] + ',' +
                                              element_type_universal,
                                              value=str(compare[0]),
                                              limit=str(lim),
                                              diff=diff)
                        else:
                            text_errors[text].append(element)
                    continue

            # Check for solid angle MIN HEI only for TETRA
            if (compare[2] == 'MIN HEI' and typ != 'TETRA'
                    and type_check == 'DAIMLER'
                    and element_type == element_types['SOLID']):
                continue

            if (compare[2] == 'CRASH' and not (defined_material[prop])
                    and type_check == 'SKODA'
                    and element_type == element_types['SHELL']):
                continue

            # Standard check for elements

            flag_error = False
            if compare[0] != 'error':
                if compare[3] == '>':
                    if float(compare[0]) < float(compare[1]):
                        flag_error = True
                        diff = str(compare[1] - compare[0])

                if compare[3] == '<':

                    if float(compare[0]) > float(compare[1]):
                        flag_error = True
                        diff = str(compare[0] - compare[1])

                if compare[3] == '<=':

                    if float(compare[0]) >= float(compare[1]):
                        flag_error = True
                        diff = str(compare[0] - compare[1])

                if flag_error == True:

                    number_errors[text] = number_errors[text] + 1

                    if number_errors[text] < limit_lines:

                        t[text].add_issue(entities=[element],
                                          status='Error',
                                          description=compare[2] + ',' +
                                          element_type_universal,
                                          value=str(compare[0]),
                                          limit=str(compare[1]),
                                          diffe=diff)
                    else:
                        text_errors[text].append(element)

    if number_errors != None:
        for key, val in number_errors.items():
            if val > limit_lines:
                t[key].add_issue(entities=text_errors[key],
                                 status='Error',
                                 description=key + '  number of errors: ' +
                                 str(len(text_errors[key])))

    t5 = time.time()
    print('End of execution of the check: ')
    print(t5 - t0)

    return list(t.values())
示例#22
0
	'fix_action': ('fix', os.path.realpath(__file__)),
	'deck': CheckItem.SOLVER_TYPE,
	'requested_types': CheckItem.ENTITY_TYPES,
	'info': 'Checks materials'}
checkDescription = base.CheckDescription(**checkOptions)

# Add parameters
checkDescription.add_str_param('Number of segments', '5')
checkDescription.add_str_param('Segment of material name', '5')
checkDescription.add_str_param('Type of loadcase', 'MAP_KEY')
checkDescription.add_str_param('Solver', 'PAMCRASH')
checkDescription.add_str_param('Matching list', '/data/fem/+software/SKODA_INCLUDE/white_list')
checkDescription.add_str_param('Delimiter for part name', '__')

# ==============================================================================

if __name__ == '__main__' and DEBUG:
	
	testParams = {
		'Delimiter for part name': '__',
		'Matching list'	: '/data/fem/users/siegl/eclipse/ansaTools/ansaChecksPlistUpdater/res/test_files/white_list',
		'Solver'		:	'PAMCRASH',
		'Type of loadcase': 'SK3165_+65',
		'Segment of material name': '5',
		'Number of segments': '5'}
	entities = base.CollectEntities(constants.PAMCRASH, None, "__MATERIALS__")
	
	check_base_items.debugModeTestFunction(CheckItem, testParams, entities=entities)

# ==============================================================================
示例#23
0
    def get_part_name_from_entity(self, entity):
        type = entity.ansa_type(constants.PAMCRASH)
        part_return = {'part name': ' ', 'part id': ' '}
        exit_loop = False

        if type == 'COMPOSITE' or type == 'PART_SHELL':
            part_name = entity._name
            if not part_name:
                part_name = " "
            part_id = entity._id
            part_return = {'part_name': part_name, 'part_id': part_id}
            print("reference part shell-like:   ", entity._id)

        if type == "SHELL":
            part_return = self.get_part_name_from_shell(entity)
            print("shell: ", entity._id)

        if type == "NODE":
            shells = base.NodesToElements(entity)
            for from_node in shells[entity]:
                type_content = from_node.ansa_type(constants.PAMCRASH)
                if type_content == "SHELL":
                    print("node: ", entity._id, "  -reference shell:   ",
                          from_node._id)
                    part_return = self.get_part_name_from_shell(from_node)
                    break

        if type == "CNODE":
            print('cnode: ', entity._id)
            shells = base.NodesToElements(entity)
            flag_shell = False
            for from_cnode in shells[entity]:
                if exit_loop == True:
                    break
                type_elem = from_cnode.ansa_type(constants.PAMCRASH)

                if type_elem == "SHELL":
                    part_return = self.get_part_name_from_shell(from_cnode)
                    flag_shell = True
                    print('cnode: ', cn._id,
                          ' - directy connected to reference shell:',
                          from_cnode._id)
                    break

            if not flag_shell:
                print(
                    "cnode: ", entity._id,
                    " without shell reference - will be try to find a close cnode entity "
                )
                coords = (entity.position)
                near_elem = base.NearElements(coordinates=coords, tolerance=1)
                type_content = "CNODE"
                cnodes = base.CollectEntities(constants.PAMCRASH, near_elem[0],
                                              type_content)
                cnodes.remove(entity)
                list_lenghts = list()
                i = 0
                for cnode in cnodes:
                    i = i + 1
                    pos = cnode.position
                    lenght = ((coords[0] - pos[0])**2 +
                              (coords[1] - pos[1])**2 +
                              (coords[2] - pos[2])**2)**0.5
                    list_lenghts.append(lenght)
                if i == 1:
                    list_lenghts = [list_lenghts]
                min_lenght = min(list_lenghts)
                index = list_lenghts.index(min_lenght)
                # print('index', index)
                if cnodes[index]:
                    cn = cnodes[index]
                    print('cnode: ', entity._id, ' - was found close cnode: ',
                          cn._id)
                    shells = base.NodesToElements(cn)
                    for elem in shells[cn]:
                        exit_loop = True
                        type_elem = elem.ansa_type(constants.PAMCRASH)
                        print(
                            'cnode: ', entity._id,
                            ' - was found close cnode and a connected entity  :',
                            elem._id)

                        if 'KJOIN' in type_elem:
                            print(
                                'cnode: ', entity._id,
                                ' - was found close cnode and connected entity is KJOIN-ish :',
                                elem._id)
                            vals = ['N1', 'N2']
                            kjoint = elem.get_entity_values(
                                constants.PAMCRASH, vals)
                            if kjoint['N1'] == cn:
                                node = kjoint['N2']
                            else:
                                node = kjoint['N1']

                            from_kjoint = base.NodesToElements(node)

                            for to_rbody in from_kjoint[node]:
                                type_elem = to_rbody.ansa_type(
                                    constants.PAMCRASH)
                                if type_elem == 'RBODY' or type_elem == 'MTOCO' or type_elem == 'OTMCO':
                                    print(
                                        'cnode: ', entity._id,
                                        ' was found close cnode and connected entity is KJOIN-ish and was found some RBODY :',
                                        to_rbody._id)
                                    vals = ['NOD1', 'NOD2', 'NSET']
                                    node = to_rbody.get_entity_values(
                                        constants.PAMCRASH, vals)
                                    if node:
                                        node = node['NOD1']
                                        if node == cn:
                                            node = node['NOD2']
                                        shells = base.NodesToElements(node)
                                        for from_node in shells[node]:
                                            type_content = from_node.ansa_type(
                                                constants.PAMCRASH)
                                            if type_content == "SHELL":
                                                print(
                                                    'cnode: ', entity._id,
                                                    ' - was found close cnode and connected entity is KJOIN-ish and was found some RBODY and connected SHELL is :',
                                                    from_node._id)
                                                part_return = self.get_part_name_from_shell(
                                                    from_node)
                                                exit_loop = True
                                                break

                        if type_elem == 'RBODY' or type_elem == 'MTOCO' or type_elem == 'OTMCO':
                            print(
                                'cnode: ', entity._id,
                                ' was found close cnode and connected entity is RBODY',
                                elem._id)
                            vals = ['NOD1', 'NOD2', 'NSET']
                            node = elem.get_entity_values(
                                constants.PAMCRASH, vals)
                            if node and ('NOD1' in node.keys()):
                                node = node['NOD1']
                                if node == cn:
                                    node = node['NOD2']
                                    shells = base.NodesToElements(node)
                                    for from_node in shells[node]:
                                        type_content = from_node.ansa_type(
                                            constants.PAMCRASH)
                                        if type_content == "SHELL":
                                            print(
                                                'cnode: ', entity._id,
                                                ' was found close cnode and connected entity is RBODY and connected SHELL is:',
                                                from_node._id)
                                            part_return = self.get_part_name_from_shell(
                                                from_node)
                                            exit_loop = True
                                            break

                            elif node and ('NSET' in node.keys()):
                                self.get_content_of_group(node['NSET'])
                                entities_from_group_e = self.group_content
                                for e in entities_from_group_e:
                                    type_elem = e.ansa_type(constants.PAMCRASH)
                                    if type_elem == "SHELL":
                                        part_return = self.get_part_name_from_shell(
                                            e)
                                        exit_loop = True
                                        break

                        if type_elem == 'SHELL':
                            print("cnode: ", entity._id,
                                  " - reference cnode shell:", elem._id)
                            part_return = self.get_part_name_from_shell(elem)
                            exit_loop = True
                            break

        return part_return
示例#24
0
def exe(entities, params):

    solver = params['Solver']
    solver_name = solver.upper()
    if solver_name == 'ABAQUS' or solver_name == 'PAMCRASH':
        if solver_name == 'ABAQUS':
            solver = constants.ABAQUS
            ent = ["SHELL_SECTION", "SOLID_SECTION", "MEMBRANE_SECTION"]
            id_mat = 'MID'
            thickness = 'T'
            remove_text = "_SECTION"
        if solver_name == 'PAMCRASH':
            solver = constants.PAMCRASH
            ent = ["PART_SHELL", "PART_SOLID", "PART_MEMBRANE"]
            id_mat = 'IMAT'
            remove_text = "PART_"
            thickness = 'h'
            c_thickness = 'TCONT'
    else:
        session.Quit()

    t4 = base.CheckReport('Number of segments')
    t5 = base.CheckReport('Thickness same as in part name')
    t6 = base.CheckReport('Rounding of thickness')
    t7 = base.CheckReport('Filling the TCONT based on SKODA')
    t8 = base.CheckReport('Lenght of part name')

    t4.has_fix = False
    t5.has_fix = True
    t6.has_fix = True
    t7.has_fix = True
    t8.has_fix = False

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

    for part in parts:
        name = part._name
        name_list = name.split(params['Delimiter for part name'])
        thickness_number = part.get_entity_values(solver, [thickness])
        if thickness_number:
            thickness_number = float(thickness_number[thickness])
        else:
            thickness_number = 0.0

        # Check of number of segments
        if len(name_list) != int(params['Number of segments']):
            t4.add_issue(entities=[part],
                         status='Error',
                         description='Wrong numer of segment')

        else:
            # Check of number of chars
            if len(name) > int(params['Max. number of chars']):
                t8.add_issue(entities=[part],
                             status='Error',
                             description='The lenght is bigger then ' +
                             str(params['Max. number of chars']))

            # Check of rouding
            thickness_number_round = round(
                thickness_number,
                int(params['Number of digits for thickness']))
            if float(thickness_number) != thickness_number_round:
                t6.add_issue(
                    entities=[part],
                    status='Error',
                    description='Thickness -  digits are bigger then ' +
                    str(params['Number of digits for thickness']),
                    thickness=str(thickness_number),
                    thickness_suggest=str(thickness_number_round),
                    __key=thickness,
                    __solver=str(solver))

            # Check of thickness by info from part name
            if str(params['Thickness by part name check']) == 'YES':
                if (str(params['Segment of thickness name']) != "0"
                        and str(params['Segment of thickness name']) != "var"
                    ) and str(params['Segment of thickness name']) != "":
                    thickness_from_part_name = name_list[
                        int(params['Segment of thickness name']) - 1]
                    thickness_from_part_name = thickness_from_part_name.replace(
                        "mm", "")
                    thickness_from_part_name = thickness_from_part_name.replace(
                        "t", "")
                    thickness_from_part_name = thickness_from_part_name.replace(
                        "_", "")

                    # TODO ValueError: could not convert string to float: 'TM2'
                    if float(thickness_number) != float(
                            thickness_from_part_name):
                        t5.add_issue(
                            entities=[part],
                            status='Error',
                            description='Thickness is different than ' +
                            thickness_from_part_name,
                            thickness=str(thickness_number),
                            thickness_suggest=str(thickness_from_part_name),
                            __key=thickness,
                            __solver=str(solver))

            # Check of contact thickness
            if deck == constants.PAMCRASH and str(
                    params['Contact thickness check']) == 'YES':
                c_thickness_number = part.get_entity_values(
                    solver, [c_thickness])

                if c_thickness_number:
                    c_thickness_number = float(c_thickness_number[c_thickness])
                else:
                    c_thickness_number = 0.0

                if 'CONNECTION' in name:
                    if float(c_thickness_number) != 0.5:
                        t7.add_issue(
                            entities=[part],
                            status='Error',
                            description=
                            'Contact thickness for CONNECTION parts should be 0.5 mm',
                            c_thickness=str(c_thickness_number),
                            c_thickness_suggest=str(0.5),
                            __key=c_thickness,
                            __solver=str(solver))
                        continue

                if c_thickness_number == 0.0:
                    c_thickness_suggest = thickness
                    if c_thickness_number < 0.5:
                        c_thickness_number = 0.5
                    if c_thickness_number > 3:
                        c_thickness_number = 3

                    t7.add_issue(
                        entities=[part],
                        status='Error',
                        description=
                        'Contact thickness is different then thickness ' +
                        thickness_number,
                        c_thickness=str(c_thickness_number),
                        thickness=str(thickness_number),
                        c_thickness_suggest=c_thickness_number,
                        __key=c_thickness,
                        __solver=str(solver))

                else:
                    if c_thickness_number != thickness_number and thickness_number <= 3 and thickness_number >= 0.5:
                        t7.add_issue(
                            entities=[part],
                            status='Warning',
                            description=
                            'Contact thickness should be same as thickness',
                            c_thickness=str(c_thickness_number),
                            thickness=str(thickness_number),
                            c_thickness_suggest=str(thickness_number),
                            __key=c_thickness,
                            __solver=str(solver))

                    if c_thickness_number < 0.5 and thickness_number < 0.5:
                        t7.add_issue(
                            entities=[part],
                            status='Error',
                            description='Contact thickness should be >= 0.5',
                            c_thickness=str(c_thickness_number),
                            thickness=str(thickness_number),
                            c_thickness_suggest='0.5',
                            __key=c_thickness,
                            __solver=str(solver))

                    if c_thickness_number > 3 and thickness_number >= 3.0:
                        t7.add_issue(
                            entities=[part],
                            status='Error',
                            description='Contact thickness should be <= 3',
                            c_thickness=str(c_thickness_number),
                            thickness=str(thickness_number),
                            c_thickness_suggest='3',
                            __key=c_thickness,
                            __solver=str(solver))

    # TODO OSError: [Errno5] Input/output error - can't fix
    print('Properties check for PAMCRASH - SKODA. Number of errors:',
          len(t4.issues) + len(t5.issues) + len(t7.issues))
    return [t4, t5, t6, t7, t8]
示例#25
0
def TiedContacts(TiedConvertionType='RBE3',
                 Tol=50,
                 FileAppend=0,
                 Include='None',
                 PutInInclude='0',
                 WorkDir="./"):
    dogy = list()
    if (TiedConvertionType == 'CGAPG'):
        if (Include == 'None'):
            FileName = 'None'
        else:
            FileName = Include._name
        OutFile = open(WorkDir + FileName + '.CGAPG', 'w+')

    if (Include == 'None'):
        Contacts = base.CollectEntities(constants.LSDYNA, None, "CONTACT",
                                        False)
    else:
        Contacts = base.CollectEntities(constants.LSDYNA, Include, "CONTACT",
                                        False)
    print("    Starting Contact To %s %s" %
          (TiedConvertionType, datetime.datetime.now()))
    ents = list()
    grid_coords = list()
    new_grids_list = list()
    parts_list = list()
    connections_list = list()
    refgrid_list = list()
    for Contact in Contacts:
        Counter = 0
        #contact = ansa.base.GetEntity(constants.LSDYNA, "CONTACT", contact_id)
        contact = Contact
        contact_card = ansa.base.GetEntityCardValues(constants.LSDYNA,
                                                     entity=contact,
                                                     fields=('SSID', 'MSID',
                                                             'SSTYP', 'MSTYP'))
        # Master
        if not ('MSTYP' in contact_card and 'SSTYP' in contact_card):
            continue
        if (contact_card['MSTYP'] == '2: Part  set'):
            MasterEntities = ansa.base.GetEntity(constants.LSDYNA, "SET",
                                                 contact_card['MSID'])
            biw_containers = ansa.base.CollectEntities(constants.NASTRAN,
                                                       MasterEntities,
                                                       "__PROPERTIES__",
                                                       recursive=True)
            elems = ansa.base.CollectEntities(constants.NASTRAN,
                                              biw_containers,
                                              "__ELEMENTS__",
                                              recursive=True)
        if (contact_card['MSTYP'] == '3: Part  id'):
            biw_containers = base.GetEntity(constants.LSDYNA, "__PROPERTIES__",
                                            contact_card['MSID'])
            elems = ansa.base.CollectEntities(constants.NASTRAN,
                                              biw_containers,
                                              "__ELEMENTS__",
                                              recursive=True)
        if (contact_card['SSTYP'] == '2: Part  set') or (contact_card['SSTYP']
                                                         == '4: Node  set'):
            SlaveEntities = ansa.base.GetEntity(constants.LSDYNA, "SET",
                                                contact_card['SSID'])
            grids = ansa.base.CollectEntities(constants.NASTRAN,
                                              SlaveEntities,
                                              "GRID",
                                              recursive=True)
        if (contact_card['SSTYP'] == '3: Part  id'):
            SlaveEntities = ansa.base.GetEntity(constants.LSDYNA,
                                                "__PROPERTIES__",
                                                contact_card['SSID'])
            grids = ansa.base.CollectEntities(constants.NASTRAN,
                                              SlaveEntities,
                                              "GRID",
                                              recursive=True)
        print(
            "        Contact ID = %s, Slave nodes = %s, Master elements = %s, Tol = %s"
            % (contact._id, len(grids), len(elems), Tol))
        grid_coords_list = list()
        for grid in grids:
            grid_card = ansa.base.GetEntityCardValues(constants.LSDYNA,
                                                      entity=grid,
                                                      fields=('NID', 'X', 'Y',
                                                              'Z'))
            grid_coords = (grid_card['X'], grid_card['Y'], grid_card['Z'])
            grid_coords_list.append(grid_coords)
        NearestElements = ansa.base.NearestShell(
            search_entities=biw_containers,
            tolerance=Tol,
            coordinates=grid_coords_list)
        if (TiedConvertionType == 'CGAPG'):
            val = {'KA': '1E6', 'KB': '1E6', 'Kt': '1E6'}
            PGAP = base.CreateEntity(constants.NASTRAN, "PGAP", val)
            CONM1 = base.CreateEntity(constants.NASTRAN, "CONM1",
                                      {'GA': grids[0]._id})
            MaxID = CONM1._id
            base.DeleteEntity(CONM1, True)
            i = 0
            for i in range(len(NearestElements)):
                if (NearestElements[i]):
                    OutFile.write("\nCGAPG,%s,%s,%s,ELEM\n,%s" %
                                  (i + MaxID, PGAP._id, grids[i]._id,
                                   NearestElements[i]._id))
                    Counter = Counter + 1

        if (TiedConvertionType == 'RBE3'):
            i = 0
            refc = '123456'
            for i in range(len(NearestElements)):
                if (NearestElements[i]):
                    elem_type = base.GetEntityCardValues(
                        constants.NASTRAN,
                        entity=NearestElements[i],
                        fields=('EID', 'type'))
                    if "QUAD" in elem_type['type']:
                        elem_ret = ansa.base.GetEntityCardValues(
                            constants.NASTRAN,
                            entity=NearestElements[i],
                            fields=('G1', 'G2', 'G3', 'G4'))
                        vals = {
                            'REFGRID': grids[i]._id,
                            'REFC': refc,
                            'WT1': 1.0,
                            'C1': '123',
                            'G1': elem_ret['G1'],
                            'G2': elem_ret['G2'],
                            'G3': elem_ret['G3'],
                            'G4': elem_ret['G4'],
                            'No.of.Nodes': 5
                        }
                        RBE3 = ansa.base.CreateEntity(constants.NASTRAN,
                                                      "RBE3", vals)
                        dogy.append(RBE3)
                    if "TRIA" in elem_type['type']:
                        elem_ret = ansa.base.GetEntityCardValues(
                            constants.NASTRAN,
                            entity=NearestElements[i],
                            fields=('G1', 'G2', 'G3'))
                        vals = {
                            'REFGRID': grids[i]._id,
                            'REFC': refc,
                            'WT1': 1.0,
                            'C1': '123',
                            'G1': elem_ret['G1'],
                            'G2': elem_ret['G2'],
                            'G3': elem_ret['G3'],
                            'No.of.Nodes': 4
                        }
                        RBE3 = ansa.base.CreateEntity(constants.NASTRAN,
                                                      "RBE3", vals)
                        dogy.append(RBE3)
                    Counter = Counter + 1
        print("            %s out of %s nodes succesfuly projected" %
              (Counter, len(grids)))
    print("    Finished Contact To %s %s" %
          (TiedConvertionType, datetime.datetime.now()))
    if (PutInInclude == 1 and Include != 'None'):
        base.AddToInclude(Include, dogy)
示例#26
0
def doda(WidgetInfo, listy):
    Type = guitk.BCLineEditGetText(listy[0])
    Tol = guitk.BCLineEditGetText(listy[1])
    WorkDir = guitk.BCLineEditGetText(listy[12])
    Switch_Xnn = guitk.BCCheckBoxIsChecked(listy[2])
    Switch_Xns = guitk.BCCheckBoxIsChecked(listy[3])
    Switch_Rb = guitk.BCCheckBoxIsChecked(listy[4])
    Switch_Mr = guitk.BCCheckBoxIsChecked(listy[5])
    Switch_Js = guitk.BCCheckBoxIsChecked(listy[6])
    Switch_Jr = guitk.BCCheckBoxIsChecked(listy[7])
    Switch_C = guitk.BCCheckBoxIsChecked(listy[8])
    Switch_FileAppend = guitk.BCCheckBoxIsChecked(listy[9])
    switch_Include = guitk.BCCheckBoxIsChecked(listy[10])

    Includes = base.CollectEntities(constants.LSDYNA, None, "INCLUDE", False)
    if (switch_Include == 1 and len(Includes) > 0):
        for Include in Includes:
            if (Switch_Xnn == 1):
                ConstrainedExtraNodesNode(Include=Include,
                                          PutInInclude=switch_Include)
            if (Switch_Xns == 1):
                ConstrainedExtraNodesSet(Include=Include,
                                         PutInInclude=switch_Include)

            if (Switch_Rb == 1):
                ConstrainedRigidBodies(Include=Include,
                                       PutInInclude=switch_Include)
            if (Switch_Mr == 1):
                MatRigid(Include=Include, PutInInclude=switch_Include)
            if (Switch_Js == 1):
                ConstrainedJointSpherical(Include=Include,
                                          PutInInclude=switch_Include)
            if (Switch_Jr == 1):
                ConstrainedJointRevolute(Include=Include,
                                         PutInInclude=switch_Include)
            if (Switch_C == 1):
                TiedContacts(TiedConvertionType=Type,
                             Tol=float(Tol),
                             FileAppend=Switch_FileAppend,
                             Include=Include,
                             PutInInclude=switch_Include,
                             WorkDir=WorkDir)
    else:
        Include = 'None'
        if (Switch_Xnn == 1):
            ConstrainedExtraNodesNode(Include=Include,
                                      PutInInclude=switch_Include)
        if (Switch_Xns == 1):
            ConstrainedExtraNodesSet(Include=Include,
                                     PutInInclude=switch_Include)
        if (Switch_Rb == 1):
            ConstrainedRigidBodies(Include=Include,
                                   PutInInclude=switch_Include)
        if (Switch_Mr == 1):
            MatRigid(Include=Include, PutInInclude=switch_Include)
        if (Switch_Js == 1):
            ConstrainedJointSpherical(Include=Include,
                                      PutInInclude=switch_Include)
        if (Switch_Jr == 1):
            ConstrainedJointRevolute(Include=Include,
                                     PutInInclude=switch_Include)
        if (Switch_C == 1):
            TiedContacts(TiedConvertionType=Type,
                         Tol=float(Tol),
                         FileAppend=Switch_FileAppend,
                         Include=Include,
                         PutInInclude=switch_Include,
                         WorkDir=WorkDir)
示例#27
0
def debug():
    Type = 'CGAPG'
    Tol = 50
    Switch_Xnn = 0
    Switch_Xns = 0
    Switch_Rb = 0
    Switch_Mr = 0
    Switch_Js = 0
    Switch_Jr = 0
    Switch_C = 1
    Switch_FileAppend = 0
    switch_Include = 1
    Includes = base.CollectEntities(constants.LSDYNA, None, "INCLUDE", False)
    WorkDir = 'C:/skrish/Tempy/'
    if (switch_Include == 1 and len(Includes) > 0):
        for Include in Includes:
            print("Inlude File Name:%s ,ID:%s" % (Include._name, Include._id))
            if (Switch_Xnn == 1):
                ConstrainedExtraNodesNode(Include=Include,
                                          PutInInclude=switch_Include)
            if (Switch_Xns == 1):
                ConstrainedExtraNodesSet(Include=Include,
                                         PutInInclude=switch_Include)

            if (Switch_Rb == 1):
                ConstrainedRigidBodies(Include=Include,
                                       PutInInclude=switch_Include)
            if (Switch_Mr == 1):
                MatRigid(Include=Include, PutInInclude=switch_Include)
            if (Switch_Js == 1):
                ConstrainedJointSpherical(Include=Include,
                                          PutInInclude=switch_Include)
            if (Switch_Jr == 1):
                ConstrainedJointRevolute(Include=Include,
                                         PutInInclude=switch_Include)
            if (Switch_C == 1):
                TiedContacts(TiedConvertionType=Type,
                             Tol=float(Tol),
                             FileAppend=Switch_FileAppend,
                             Include=Include,
                             PutInInclude=switch_Include,
                             WorkDir=WorkDir)

    else:
        Include = 'None'
        if (Switch_Xnn == 1):
            ConstrainedExtraNodesNode(Include=Include,
                                      PutInInclude=switch_Include)
        if (Switch_Xns == 1):
            ConstrainedExtraNodesSet(Include=Include,
                                     PutInInclude=switch_Include)
        if (Switch_Rb == 1):
            ConstrainedRigidBodies(Include=Include,
                                   PutInInclude=switch_Include)
        if (Switch_Mr == 1):
            MatRigid(Include=Include, PutInInclude=switch_Include)
        if (Switch_Js == 1):
            ConstrainedJointSpherical(Include=Include,
                                      PutInInclude=switch_Include)
        if (Switch_Jr == 1):
            ConstrainedJointRevolute(Include=Include,
                                     PutInInclude=switch_Include)
        if (Switch_C == 1):
            TiedContacts(TiedConvertionType=Type,
                         Tol=float(Tol),
                         FileAppend=Switch_FileAppend,
                         Include=Include,
                         PutInInclude=switch_Include,
                         WorkDir=WorkDir)
示例#28
0
    def get_entity_component_id(self, entities, type_group, group):
        groups = list()
        entities_all_in_groups = list()
        groups_all = list()
        entities_all = list()
        entities_without_groups_e = list()
        component_ids = list()
        component_id = ''
        groups_all = list()
        if entities and type_group:
            if type_group == 'COMBINE GROUP':
                component_id = []
                final_entity = []
                read_ent_stop = False

                for entity in entities:

                    if entity.ansa_type(constants.PAMCRASH) != "GROUP":
                        entities_all.append(entity)
                        final_entity.append(entity)
                    else:
                        groups_all.append(entity)
                        entities_all_in_groups.extend(
                            base.CollectEntities(constants.PAMCRASH, entity,
                                                 None))
                i = 0
                for entity in final_entity:
                    if not (entity in entities_all_in_groups):
                        if entity.ansa_type(
                                constants.PAMCRASH) == 'CNODE' and i < 1:
                            i = i + 1
                            name = self.get_part_name_from_entity(
                                entity)['part_id']
                            component_id.append('PID' + str(name))
                        if entity.ansa_type(constants.PAMCRASH) != 'CNODE':
                            name = self.get_part_name_from_entity(
                                entity)['part_id']
                            component_id.append(str(name))

                if not groups_all:
                    groups_all = " "
                if not component_id:
                    component_id = " "
                print('COMBINE GROUP part id:   ', component_id)
                return {'component_id': component_id, 'groups': groups_all}

            if type_group == 'MESH GROUP':
                i = 0
                for entity in entities:
                    if entity.ansa_type(constants.PAMCRASH) == 'CNODE':
                        i = i + 1
                    if entity.ansa_type(
                            constants.PAMCRASH) != 'CNODE' or i == 1:
                        name = self.get_part_name_from_entity(
                            entity)['part_name']
                        component_id = text_analyse.analyse(text=name,
                                                            delimiter='_',
                                                            start='Part',
                                                            end='screw_to',
                                                            index=1)
                        component_ids.append(component_id['text_list'])
                        break

                print('MESH GROUP:   ', component_ids)
                if not groups_all:
                    groups_all = " "
                if not component_id:
                    component_id = " "
                return {'component_id': component_ids, 'groups': group}
        else:
            if not groups_all:
                groups_all = " "
            if not component_id:
                component_id = " "
            return {'component_id': component_id, 'groups': group}
示例#29
0
    def __init__(self, id):
        super().__init__(constants.PAMCRASH, id, 'CNTAC')
        self.part_slave_name = "?"
        self.part_master_name = "?"
        self.entities = list()
        vals_tied = ['NTYPE', 'NSS', 'NMS', 'IDPRT']
        t = self.get_entity_values(constants.PAMCRASH, vals_tied)
        self.tied_name = "?"
        self.tied_part_name = "?"
        self.tied_part_ent = "?"
        self.master_name_id_group = "?"
        self.slave_name_id_group = "?"
        self.group_master_name = "?"
        self.group_slave_name = "?"
        self.group_master_id = " ?"
        self.group_slave_id = "?"
        self.master_name_id_part = "?"
        self.slave_name_id_part = "?"
        self.tied_name_component_id_1 = "?"
        self.tied_name_component_id_2 = "?"
        self.part_master_composite = False
        self.part_slave_composite = False
        self.part_slave_h = 0
        self.part_slave_name = "?"
        self.part_master_h = 0
        self.part_master_name = "?"
        if t['NTYPE'] == 'TIED':

            self.tied_name = self._name

            self.tied_part_ent = t['IDPRT']
            self.tied_part_name = t['IDPRT']._name

            self.group_ent_master = t['NMS']
            self.group_ent_slave = t['NSS']

            string_part = ['Name', 'SID']
            self.group_master = self.group_ent_master.get_entity_values(
                constants.PAMCRASH, string_part)
            self.group_slave = self.group_ent_slave.get_entity_values(
                constants.PAMCRASH, string_part)

            self.group_master_name = self.group_ent_master._name

            self.group_slave_name = self.group_ent_slave._name

            self.group_master_id = self.group_master['SID']
            self.group_slave_id = self.group_slave['SID']

            type = ["PART_SHELL", "COMPOSITE"]
            parts_master = base.CollectEntities(constants.PAMCRASH,
                                                self.group_ent_master, type)
            parts_slave = base.CollectEntities(constants.PAMCRASH,
                                               self.group_ent_slave, type)
            if not parts_master:
                parts_master = base.CollectEntities(constants.PAMCRASH,
                                                    self.group_ent_master,
                                                    type,
                                                    prop_from_entities=True)
            if not parts_slave:
                parts_slave = base.CollectEntities(constants.PAMCRASH,
                                                   self.group_ent_slave,
                                                   type,
                                                   prop_from_entities=True)

            h_s = 0.0
            h_m = 0.0
            m_i = 0
            s_i = 0
            if parts_master:
                for self.part_master in parts_master:

                    if self.part_master:
                        m = self.part_master.get_entity_values(
                            constants.PAMCRASH, ['h', 'Name', 'IMAT'])

                        if self.part_master.ansa_type(
                                constants.PAMCRASH) == 'PART_SHELL':
                            self.part_master_h = m['h']
                            h_m = h_m + float(self.part_master_h)
                            #print('self.part_master_h:', self.part_master_h)
                            m_i = m_i + 1.0
                            self.part_master_composite = False
                        elif self.part_master.ansa_type(
                                constants.PAMCRASH) == 'COMPOSITE':
                            self.part_master_h = m['h']
                            self.part_master_composite = True
                            h_m = h_m + float(self.part_master_h)
                            print('self.part_master_h:', self.part_master_h)
                            print('h_m:', h_m)
                            m_i = m_i + 1.0
                        self.part_master_name = m['Name']
                        #print('m_i:', m_i)
                    else:
                        self.part_master_h = 0
                        self.part_master_name = " "
                self.part_master_h = h_m / m_i
                print('self.part_master_h:', self.part_master_h)
            else:
                self.part_master_h = 0
                self.part_master_name = " "

            if parts_slave:
                for self.part_slave in parts_slave:
                    if self.part_slave:
                        m = self.part_slave.get_entity_values(
                            constants.PAMCRASH, ['h', 'Name', 'IMAT'])

                        if self.part_slave.ansa_type(
                                constants.PAMCRASH) == 'PART_SHELL':
                            self.part_slave_h = m['h']
                            #print(self.part_slave_h)
                            self.part_slave_composite = False
                            h_s = h_s + float(self.part_slave_h)
                            s_i = s_i + 1.0
                        elif self.part_slave.ansa_type(
                                constants.PAMCRASH) == 'COMPOSITE':
                            self.part_slave_h = m['h']
                            self.part_slave_composite = True
                            h_s = h_s + float(self.part_slave_h)
                            #print(self.part_slave_h)
                            s_i = s_i + 1.0
                        self.part_slave_name = m['Name']
                    else:
                        self.part_slave_h = 0
                        self.part_slave_name = " "
                self.part_slave_h = h_s / s_i
            else:
                self.part_slave_h = 0
                self.part_slave_name = " "
    def check(self, params):

        fieldConnector = ['G1', 'G2']
        dict_node = self.get_entity_values(constants.ABAQUS, fieldConnector)
        pos_A = dict_node['G1'].position
        pos_B = dict_node['G2'].position

        fieldConnectorSection = ['ORIENT_1']
        connectorSections = base.CollectEntities(constants.ABAQUS,
                                                 self,
                                                 "CONNECTOR_SECTION",
                                                 prop_from_entities=True)
        dict_cs = connectorSections[0].get_entity_values(
            constants.ABAQUS, fieldConnectorSection)
        ret4x3 = calc.GetCoordTransformMatrix4x3(constants.ABAQUS,
                                                 dict_cs['ORIENT_1'], 0, 0, 0)
        pos_A = calc.GlobalToLocal(dict_cs['ORIENT_1']._id, pos_A, "point")
        pos_B = calc.GlobalToLocal(dict_cs['ORIENT_1']._id, pos_B, "point")

        dist_x, dist_y, dist_z = pos_B[0] - pos_A[0], pos_B[1] - pos_A[
            1], pos_B[2] - pos_A[2]

        status_lenght = ''
        if dist_x > 1.e-5 or dist_x < -1.e-5:
            status_lenght = 'Initial lenght for local coord x of connector for should be 0.0, the current lenght is: ' + str(
                dist_x)
        if dist_y > 1.e-5 or dist_y < -1.e-5:
            status_lenght = status_lenght + ' .Initial lenght for local coord y of connector for should be 0.0, the current lenght is: ' + str(
                dist_y)
        if dist_z > 100001.e-5 or dist_z < 99999.e-5:
            status_lenght = status_lenght + ' .Initial lenght for local coord z of connector for should be 1.0, the current lenght is: ' + str(
                dist_z)

        connectorBehavior = base.CollectEntities(constants.ABAQUS,
                                                 self,
                                                 "CONNECTOR BEHAVIOR",
                                                 mat_from_entities=True)

        if len(connectorBehavior) == 0:
            # no connector behavior defined...
            return '', ''

        field_stop = ['*STOP', 'STP>data']
        dict_stop = connectorBehavior[0].get_entity_values(
            constants.ABAQUS, field_stop)
        field_stop_lim = [
            'Low.Lim.(1)', 'Up.Lim.(1)', 'Low.Lim.(2)', 'Up.Lim.(2)',
            'Low.Lim.(3)', 'Up.Lim.(3)'
        ]
        dict_stop_lim = dict_stop['STP>data'].get_entity_values(
            constants.ABAQUS, field_stop_lim)

        status = ''
        if 'Low.Lim.(1)' in dict_stop_lim:
            if not (dist_x > dict_stop_lim['Low.Lim.(1)']
                    and dist_x < dict_stop_lim['Up.Lim.(1)']):
                status = 'Penetration for x - connector x lenght: ' + str(
                    dist_x) + ' , connector x limit:<' + str(
                        dict_stop_lim['Low.Lim.(1)']) + ',' + str(
                            dict_stop_lim['Up.Lim.(1)']) + '>'
        if 'Low.Lim.(2)' in dict_stop_lim:
            if not (dist_y > dict_stop_lim['Low.Lim.(2)']
                    and dist_y < dict_stop_lim['Up.Lim.(2)']):
                status = status + 'Penetration for y - connector y lenght: ' + str(
                    dist_x) + ' , connector y limit:<' + str(
                        dict_stop_lim['Low.Lim.(2)']) + ',' + str(
                            dict_stop_lim['Up.Lim.(2)']) + '>'
        if 'Low.Lim.(3)' in dict_stop_lim:
            if not (dist_z > dict_stop_lim['Low.Lim.(3)']
                    and dist_z < dict_stop_lim['Up.Lim.(3)']):
                status = status + 'Penetration for z - connector z lenght: ' + str(
                    dist_z) + ' , connector z limit:<' + str(
                        dict_stop_lim['Low.Lim.(3)']) + ',' + str(
                            dict_stop_lim['Up.Lim.(3)']) + '>'

        return status, status_lenght