Search code examples
pythonexcelabaqus

Importing amplitude data from excel file in Abaqus by Python Script


I have created the following macro in Abaqus while importing amplitude data from an excel file. Then tried to run this script for creating another amplitude from the same excel file but unfortunately, I'm having the following error. Could anybody help me in this regard?

Script:

# Do not delete the following import lines
from abaqus import *
from abaqusConstants import *
import __main__

def importingExcel():
    import section
    import regionToolset
    import displayGroupMdbToolset as dgm
    import part
    import material
    import assembly
    import step
    import interaction
    import load
    import mesh
    import job
    import sketch
    import visualization
    import xyPlot
    import displayGroupOdbToolset as dgo
    import connectorBehavior
    import glob
    import os
    import sys

    p = mdb.models['NodeSet'].parts['MM']
    session.viewports['Viewport: 1'].setValues(displayedObject=p)
    session.viewports['Viewport: 1'].partDisplay.setValues(mesh=ON)
    session.viewports['Viewport: 1'].partDisplay.meshOptions.setValues(
        meshTechnique=ON)
    session.viewports['Viewport: 1'].partDisplay.geometryOptions.setValues(
        referenceRepresentation=OFF)
    abq_ExcelUtilities.excelUtilities.ExcelToAmplitude(
        inputFileForAmp='F:/U/M/D/L.xlsx', 
        sheetNameForAmp='Sheet1', ampStartCell='A2', ampEndCell='B242', 
        ampNameStr='Amp-1', amplitudeType=0)



importingExcel()

Error:

NameError: name 'abq_ExcelUtilities' is not defined.


Solution

  • Probably you need to import abq_ExcelUtilities before use it.

    import abq_ExcelUtilities.excelUtilities