By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,697 Members | 1,362 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,697 IT Pros & Developers. It's quick & easy.

I want to make python script in abaqus 6.10

P: 1
Hi all.

I try to make the python script with the macro.

As you know, the funtion of macro manager can record the every acticvity in python script. But this script work on the macro manager only. I want to make this script work on the run script menu.

The error message was done when I try to run the macro script.

Message says "C:/Temp/abaqusMacros.py:56: SyntaxWarning: import * only allowed at module level
def analzer2():
C:/Temp/abaqusMacros.py:56: SyntaxWarning: import * only allowed at module level
def analzer2():"
Following codes are the macro script what I try to transfer.
Plz help me.
Expand|Select|Wrap|Line Numbers
  1. # Do not delete the following import lines
  2. from abaqus import *
  3. from abaqusConstants import *
  4. import __main__
  5.  
  6. def analyzer():
  7.     import section
  8.     import regionToolset
  9.     import displayGroupMdbToolset as dgm
  10.     import part
  11.     import material
  12.     import assembly
  13.     import step
  14.     import interaction
  15.     import load
  16.     import mesh
  17.     import job
  18.     import sketch
  19.     import visualization
  20.     import xyPlot
  21.     import displayGroupOdbToolset as dgo
  22.     import connectorBehavior
  23.     o1 = session.openOdb(name='C:/Temp/1.odb')
  24.     session.viewports['Viewport: 1'].setValues(displayedObject=o1)
  25.     import sys
  26.     sys.path.insert(11, r'C:\SIMULIA\Abaqus\6.10-1\abaqus_plugins\reportGenerator')
  27.     from abaqus import *
  28.     from abaqusConstants import *
  29.     import form
  30.     import reportGenerator
  31.     report=reportGenerator.ReportGenerator()
  32.     report.setValues('C:/Temp/1.odb', interactionAdditionalFigure=r"(, , )", 
  33.         logo=r"*.gif", styleSheet=r"*.css", includeXYData=1, 
  34.         outputVariableList=r"(, , , , )", outputVariableView=r"(, , , , )", 
  35.         resultsXYData=r"(, , , , )", resultsAdditionalFigure=r"(, , , , )", 
  36.         userName=r"", includeUsername=1, includeTOC=1, includeLoadData=1, 
  37.         includeResultsData=1, includeStepData=1, imageStyle=r"INLINE", 
  38.         includeInteractionData=1, includePartData=1, includeJobData=1, 
  39.         includeAssemblyData=1, includeMaterialData=1, outputDir=r"C:\Temp", 
  40.         reportTitle=r"Report Generated by 'Abaqus Report Generator'", 
  41.         instanceFigureTop=1, instanceFigureBottom=0, instanceFigureUser2=0, 
  42.         instanceFigureUser1=0, instanceFigureUser3=0, instanceFigureFront=1, 
  43.         instanceThreeDXML=1, imageTogether=r"TOGETHER", instanceFigureIso=1, 
  44.         instanceFigureLeft=0, instanceFigureRight=0, 
  45.         instanceList=r"(ALL, , , , )", instanceFigureUser4=0, 
  46.         includeInstanceTable=1, instanceAdditionalFigure=r"(, , , , )", 
  47.         materialFigureBottom=0, materialFigureFront=1, materialFigureUser1=0, 
  48.         materialFigureUser3=0, materialFigureUser2=0, materialFigureRight=0, 
  49.         materialFigureTop=1, materialFigureUser4=0, materialFigureIso=1, 
  50.         includeMaterialDetails=1, materialThreeDXML=1, 
  51.         materialAdditionalFigure=r"(, , )", includeMaterialTable=1, 
  52.         materialFigureLeft=0, loadAdditionalFigure=r"(, , )", )
  53.     report.processRequest()
Feb 20 '12 #1
Share this Question
Share on Google+
1 Reply

bvdet
Expert Mod 2.5K+
P: 2,851
As the error message indicates, "import *" is only allowed at the module level (outside of the function scope). Better yet, put all your imports at the top of the file just after module comments and doc strings. See Python PEP 8.
Feb 20 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.