Assembly

The assembly is a single object in a model, accessed by

mdb.models[modelname].rootAssembly

having a huge numbers of properties and methods, demonstrated for the default empty model:

>>> ass = mdb.models['Model-1'].rootAssembly
>>> len(dir(ass))
302

  mdb
   |
 models  
   |              
 ------------------------------
   |            |            |   
'Model-1'    'Model-2'      ...
                |    
            rootAssembly
                |
                ------------------------------------------------------------------ 
                |           |                 |                   |              |
            Instance()  instances    DatumAxisByThreePoint()    datums          ...

For example, constructors for coordinate systems

>>> [i for i in dir(ass) if i[0:9] == 'DatumCsys']
['DatumCsysByDefault', 'DatumCsysByOffset', 'DatumCsysByThreePoints', 'DatumCsysByTwoLines']

or anything related to instances

>>> [i for i in dir(ass) if 'Instance' in i or 'instance' in i]
['Instance', 'InstanceFromBooleanCut', 'InstanceFromBooleanMerge', 'LinearInstancePattern', 'PartFromInstanceMesh',
 'RadialInstancePattern', 'allInstances', 'instances', 'modelInstances', 'seedPartInstance', 'unlinkInstances']

Instances

Script-1a creates a model mdb.models['M1'] with a part mdb.models['M1'].parts['Brick']. Four instances of the part are added to the assembly by the constructor Instance(...), and they are positioned next to each other along the y-axis.

Script-1a

In [ ]:
from abaqus import *
from abaqusConstants import *

def solidBrick(modelname, L, b, h):
    mod = mdb.Model(name=modelname)
    ske = mod.ConstrainedSketch(name='__profile__', sheetSize=200.0)
    ske.rectangle(point1=(0.0, 0.0), point2=(L, b))
    prt = mod.Part(name='Brick', dimensionality=THREE_D, type=DEFORMABLE_BODY)
    prt.BaseSolidExtrude(sketch=ske, depth=h)
    del ske
    
    # Assembly and instances
    ass = mod.rootAssembly
    for i in range(0,4):
        ins = ass.Instance(name='Brick-'+str(i), part=prt, dependent=ON)
        ass.translate(instanceList=('Brick-'+str(i), ), vector=(0.0, b*i, 0.0))
        
    
solidBrick(modelname='M1', L=100.0, b=50.0, h=25.0)

Solid brick

Access to the instances:

>>> mod = mdb.models['M1']
>>> ass = mod.rootAssembly
>>> print ass.instances.keys()
['Brick-0', 'Brick-1', 'Brick-2', 'Brick-3']

Accessing the geometry of one instance:

>>> ins = ass.instances['Brick-1']
>>> print ins.faces
['Face object', 'Face object', 'Face object', 
 'Face object', 'Face object', 'Face object']

Observe that the assembly has repositories for items such as vertices and edges, but they are empty:

>>> print ass.vertices
[]
>>> print ass.edges
[]

The assembly of the current model has only geometry associated to the individual instances. For instance, the y-coordinates of the first vertex of the different instances can be accessed and listed by

>>> inames = ass.instances.keys()
>>> [ass.instances[iname].vertices[0].pointOn[0][1] for iname in inames]
[0.0, 50.0, 100.0, 150.0]

The total number of faces in the assembly:

>>> sum([len(ass.instances[iname].faces) for iname in inames])
24.0

More examples on operations on instances:

  • TODO
  • TODO
  • TODO
TOC Next Prev

Disclaimer:This site is designed for educational purposes only. There are most likely errors, mistakes, typos, and poorly crafted statements that are not detected yet... www.ntnu.edu/employees/nils.p.vedvik

Copyright 2024, All rights reserved