Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Abaqus Scripting - Select all in viewport

Status
Not open for further replies.

s8utt

Mechanical
Oct 13, 2022
1
I have a 3D deformed model that I need to create a display group based on the elements that intersect the Z plane at 0.

If i run this script on an opened simulation

Python:
from abaqus import *
from caeModules import *
from abaqusConstants import *
import displayGroupOdbToolset as dgo
vp = session.viewports[session.currentViewportName]
odbName = vp.displayedObject.name
odb = session.odbs[odbName]
leaf = dgo.LeafFromElementSets(elementSets=('PRODUCT',))
vp.odbDisplay.displayGroup.replace(leaf=leaf)
vp.odbDisplay.display.setValues(plotState=(
    CONTOURS_ON_DEF, ))
vp.odbDisplay.setValues(viewCutNames=('Z-Plane',), viewCut=ON)
vp.odbDisplay.viewCuts['Z-Plane'].setValues(position=0, showModelBelowCut=False, showModelAboveCut=False)

The resulting ODB shows only the Z slice at position 0.
Now manually I can choose
> Create Display Group
Item > Elements
Method > Pick from viewport
Drag a box over the 'slice' and it will select all the elements that intersect the slice.
> Click replace ( So only all the elements I have selected are shown in the model )
> Deactivate the view cut.

I am left with only the elements that intersect the Z at position 0.

Is there a way to automate this with a script ?

 
Replies continue below

Recommended for you

Try with bounding box (it’s described in scripting documentation), it should help you with this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor