×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Some scripting methods not available to the user?

Some scripting methods not available to the user?

Some scripting methods not available to the user?

(OP)
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,

CODE --> Python

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

But when I try to use,

CODE --> 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?

RE: Some scripting methods not available to the user?

You need to import the modules, scroll up in the .rpy file.

RE: Some scripting methods not available to the user?

(OP)
Here's the full script, I have imported all the modules listed in the abaqus.rpy file.

CODE --> 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() 

RE: Some scripting methods not available to the user?

(OP)
The scripting manual section 16 has it as a legit member of a legit object.

ponder

RE: Some scripting methods not available to the user?

(OP)
To add insult to injury all the commands work if I enter them at the command line.

RE: Some scripting methods not available to the user?

Try again and import these modules first.

import displayGroupMdbToolset
import displayGroupOdbToolset

RE: Some scripting methods not available to the user?

(OP)
I hadnt set the display object, works when I add,

CODE --> Python

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

..after opening the *.odb

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources