Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Some scripting methods not available to the user?

Status
Not open for further replies.

DrBwts

Mechanical
Nov 4, 2012
297
I'm trying to extract views of a large number of *.odbs.

I ran through a test case manually then checked the abaqus.rpy file to find that I needed the following objects & methods,

Python:
leaf = dgo.LeafFromElementSets(elementSets=('MODEL-1.EVERYTHINGELSE', ))
session.viewports['Viewport: 1'].odbDisplay.displayGroup.remove(leaf=leaf)

But when I try to use,

Python:
session.viewports['Viewport: 1'].odbDisplay.displayGroup.remove(leaf=leaf)

I get the following error,

AttributeError:'OdbDisplay' object has no attribute 'displayGroup'

So what gives here? Is it just that some methods are not made public?
 
Replies continue below

Recommended for you

You need to import the modules, scroll up in the .rpy file.
 
Here's the full script, I have imported all the modules listed in the abaqus.rpy file.

Python:
from abaqus import *
from abaqusConstants import *
from caeModules import *
import os

for gen in range(1, 43):
    odbName = 'TopLoad_Gen_' + str(gen) + '.odb'
    odb = session.openOdb(name=odbName)
    leaf = dgo.LeafFromElementSets(elementSets=('MODEL-1.EVERYTHINGELSE', ))
    session.viewports['Viewport: 1'].odbDisplay.displayGroup.remove(leaf=leaf)
    axiFile = 'TwoSpheres_Axi_' + str(gen)
    session.printToFile(fileName=axiFile, format=PNG, canvasObjects=(session.viewports['Viewport: 1'], ))
    session.viewports['Viewport: 1'].view.setValues(session.views['Left'])
    zyFile = 'TwoSpheres_yz_' + str(gen)
    session.printToFile(fileName=zyFile, format=PNG, canvasObjects=(session.viewports['Viewport: 1'], ))
    session.odbs[odb].close()
 
The scripting manual section 16 has it as a legit member of a legit object.

[ponder]
 
To add insult to injury all the commands work if I enter them at the command line.
 
Try again and import these modules first.

import displayGroupMdbToolset
import displayGroupOdbToolset
 
I hadnt set the display object, works when I add,

Python:
session.viewports['Viewport: 1'].setValues(displayedObject=odb)

..after opening the *.odb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor