Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Display Groups using Python 1

Status
Not open for further replies.

bEakerPPK

Aerospace
Dec 14, 2007
11
0
0
CA
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!!
 
Replies continue below

Recommended for you

You should have tried:

import displayGroupMdbToolset as dgm

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

 
Status
Not open for further replies.
Back
Top