Example property generation script

A complete example of a property generation script is provided in the blog post “Property generation scripts for assembled fasteners in Abaqus/CAE” in the Will link to swym.3ds.com/#community:73. The script uses a method named getSurfaceSections that is useful for assembled fastener property scripts. This method accepts a surface name and returns a list of all section names found on the geometry underlying the named surface region; see Will link to ker-assembly-getsurfacesections-pyc. The getSurfaceSections method can be used to obtain section information such as the material name and thickness, as shown in the code fragment below.

    def __init__(self, scriptName, modelName, fastenerName):
        self.scriptName   = scriptName
        self.modelName    = modelName
        self.fastenerName = fastenerName
        print 'Running script "%s" for "%s"' % (scriptName, 
          fastenerName)
        assy = mdb.models[modelName].rootAssembly
        eo = assy.engineeringFeatures.fasteners[fastenerName]
        print eo.assignedSurfaces
        diameter = getInput('Enter %s bolt diameter:' % scriptName)
        print '  Bolt diameter: %s' % diameter
        for aSurf in eo.assignedSurfaces:
            sectNames = assy.getSurfaceSections(aSurf)
            print '  %s: %s' % (aSurf, sectNames)
            # No section assigned
            if (len(sectNames) > 0 and sectNames[0] == ''):
                continue
            for section in sectNames:
                sectObj = mdb.models[modelName].sections[section]
                if (type(sectObj) == HomogeneousShellSectionType):
                    print '    %s:  mat=%s, thk=%s' % \
                        (section, sectObj.material, sectObj.thickness)