问题
I am trying write an Abaqus/Python script that will select all the elements that "belong" to a certain face. I.e. taking all the elements that have a connection to one face of a meshed cube (I will calculate the total force acting on that face for force-displacement or stress-strain curves later).
If I do it using the GUI I get:
mdb.models['Model-1'].rootAssembly.Set(elements=
mdb.models['Model-1'].rootAssembly.instances['Part-1-1'].elements.getSequenceFromMask(
mask=('[#0:5 #fff80000 #ff #f #ffe00000 #f000000f #3f',
' #0:6 #fffe #c0003f00 #3 #3fff8 #ffc00 ]', ), ), name='Set-1')
But, getSequenceFromMask
does not work in a general case. I tried using findat
with no luck.
Is there a way to do that?
回答1:
define a face set on the part or assembly:
part.Set('facename',faces=part.faces.findAt(((1,0,0),),))
where (1,0,0)
is a coordinate anywhere on the face. (Don't use a point on a edge/corner though)
then after meshing you can access the elements attached to that face, something like:
instance.sets['facename'].elements
note if you want to get those elements on the odb after running an analysis it is a little different:
instance.elementSets['FACENAME'].elements
note that the set name is upcased on the odb..
回答2:
One can select an specific element from its label by using:
mdb.models['model-name'].parts['part_name'].elements.getFromLabel(lable=element_id)
This way it is not necessary to have information about the coordinate of the element. Only the element id is enough to access to it.
回答3:
You are apparently using a Macro in order to get the location of your surface in order to pick the set using Python. The issue is: the Macro facility uses getSequenceFromMask() by default and isn't very user-friendly...
Fortunately, this default option can be changed! One just needs to run the following line of code:session.journalOptions.setValues(replayGeometry=COORDINATE,recoverGeometry=COORDINATE)
Now when you record a macro using the MacroManager, you get findAt() which is what you want.
Extra TIP:
You can include this piece of code in the onCaeStartup() function in your custom_v6.env file. It will then run every time you open CAE.
C:\Program Files\Dassault Systemes\SimulationServices\V6R2018x\win_b64\SMA\site\custom_v6.env
回答4:
I had this issue myself a few days ago. Maybe I'm wrong but as far as I know, there is no way to directly select particular elements. You can select them with a "Bounding Box" or a "Bounding Sphere" or you can get them by your parts/ instances faces and cells. If you need to select the elements in a more specific way then you can get them by the nodes with which they are connected. You can use the "findAt" command with these nodes and get the elements by the "getElements()" command.
That is how I solved it and it works pretty fine. If there are other ways to solve that I will be happy to hear them because this is sometimes really frustrating.
Cheers
来源:https://stackoverflow.com/questions/37048689/abaqus-script-to-select-elements-on-a-surface