Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng 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
Joined
Nov 4, 2012
Messages
297
Location
GB
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?
 
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

Back
Top