Search code examples
pythonabaqus

How do i query the parts' volume information with abaqus python script in abaqus/cae and abaqus/viewer mode?


in abaqus/cae mode ,i use getMassProperties() function to query the volume,but in viewr mode(visualization module only),that not work..


Solution

  • Part volume in CAE:

     from abaqus import *
     mask=mdb.models['Model'].parts['part'].cells.getMask()
     cellobj_sequence=mdb.models['Model'].parts['part'].cells.getSequenceFromMask(mask=mask)
     part_volume=mdb.models['Model'].parts[part'].getVolume(cells=cellobj_sequence)
    

    Assembly volume in CAE:

        from abaqus import *
        prop=mdb.models['Model'].rootAssembly.getMassProperties()
    

    (Now, the 'prop' variable is a dictionary object. prop[volume] should give your desired result.

    Option #2: If you want to access volumes of only certain part instances, create a part instance object and call that in your getMassProperties()

    m=mdb.models['Model'].rootAssembly
    inst=m.instances['instance'] 
    mask=inst.cells.getMask()
    partinstance_obj1=inst.cells.getSequenceFromMask(mask=mask)
    prop1=mdb.models['Model'].rootAssembly.getMassProperties(regions=(partinstance_obj1,)) #Regions here will accept only a sequence of part instance obj