×
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

Display Groups using Python

Display Groups using Python

Display Groups using Python

(OP)
Hi friends, colleagues and ABAQUS gurus!!

I'm having a bit of a problem getting my python script to create and plot some display groups. The documentation is helpful but still, I can't quite get it to work. I can do it in CAE and when I check the abaqus.rpy file and literally cut and paste the commands into my script I get an error. Here's what I've done:

# Now we can create some display groups to aid in the post processing...
a = mdb.models['G3_4_3_C3D8I_LUPB_Vis001'].rootAssembly
session.viewports['G3_4_3_C3D8I_LUPB_Vis001'].setValues(displayedObject=a)
session.viewports['G3_4_3_C3D8I_LUPB_Vis001'].assemblyDisplay.setValues(
loads=OFF, bcs=OFF)

# For the aluminum layers...
set1 = mdb.models['G3_4_3_C3D8I_LUPB_Vis001'].rootAssembly.sets['Aluminum_1st_Layer']
set2 = mdb.models['G3_4_3_C3D8I_LUPB_Vis001'].rootAssembly.sets['Aluminum_2nd_Layer']
set3 = mdb.models['G3_4_3_C3D8I_LUPB_Vis001'].rootAssembly.sets['Aluminum_3rd_Layer']
set4 = mdb.models['G3_4_3_C3D8I_LUPB_Vis001'].rootAssembly.sets['Aluminum_4th_Layer']
leaf = dgm.LeafFromSets(sets=(set1, set2, set3, set4,))
session.viewports['G3_4_3_C3D8I_LUPB_Vis001'].assemblyDisplay.displayGroup.replace(
leaf=leaf)
dg = session.viewports['G3_4_3_C3D8I_LUPB_Vis001'].assemblyDisplay.displayGroup
dg = session.DisplayGroup(name='Alum Only', objectToCopy=dg)
session.viewports['G3_4_3_C3D8I_LUPB_Vis001'].assemblyDisplay.setValues(
visibleDisplayGroups=(dg,)

The error message states that dgm in my leaf = dgm.LeafFromSets statement is not defined. What am I missing here? I have imported the following into my script:

from abaqus import *
import testUtils
testUtils.setBackwardCompatibility()
from abaqusConstants import *
import sketch, part, material, section, assembly, mesh, load, job
import step, interaction, regionToolset, visualization
import displayGroupMdbToolset, displayGroupOdbToolset

Is there another import I should include? Or simply another way to do it? I find it strange that I can do it in CAE but it won't work when I use the commands generated by CAE.

Any insight would be greatly appreciated and thanks in advance!!

RE: Display Groups using Python

You should have tried:

import displayGroupMdbToolset as dgm

Then your dgm.LeafFromSets constructor would have been defined...

RE: Display Groups using Python

(OP)
Thanks brep!!!

It worked like a charm!!!!!!

= bEaker

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