Abaqus Surface getSequenceFromMask

Cenarius picture Cenarius · Nov 14, 2017 · Viewed 9.3k times · Source

I am writing script in Abaqus, where I crush circle and square with cut circle (like cheese). I need to put Contact between parts so I need Surface.

macro manager generates:

s1 = a.instances['kolo-1'].edges
side1Edges1 = s1.getSequenceFromMask(mask=('[#1 ]', ), )
a.Surface(side1Edges=side1Edges1 , name='kolkoSurf')

The problem is: getSequenceFromMask(mask=('[#1 ]', ), ) How to get this #1? Can I replace it? I searched little and there were some ideas to use: 'find', 'face', 'COORDS' but I cannot manage it. Please help me. I dream to get an simple example how to extract this Surface using X, Y or anyway.

BR, Wonman

Answer

JulianBauer picture JulianBauer · Nov 14, 2017

You recorded the above journal using the macro manager with default journal options. Therefore, the variable side1Edges1 is defined in your journal using the getSequenceFromMask()-method. This method is the recording of the selection you performed by clicking the GUI during the recording. This means you clicked the GUI to select an edge and the result is the getSequenceFromMask()-method acting on s1 which is a set of all edges of the instance 'kolo-1'.

According to Abaqus Scripting Reference Guide 6.14 - 7.2.2 the method getSequenceFromMask() is highly efficient when a large number of objects are involved. However, this is not very helpful if your trying to customize your journal file to select another geometry element to work with. There are two solutions:

  1. Solution: Paste the command

    session.journalOptions.setValues(replayGeometry=COORDINATE, recoverGeometry=COORDINATE)
    

    into the Abaqus command line at the bottom of Abaqus CAE to set the members replayGeometry and recoverGeometry of your JournalOptions object to COORDINATE and repeat the recording of your journal. You can, most of the time, omit clicking the GUI again by executing your old journal after issuing the command above. You can then save your project, preferably with a new name, and use the newly created journal. In the new journal the command getSequenceFromMask(mask=('[#1 ]', ), ) will by replaced by a selection based on coordinates to represent your recorded GUI-click. You can then modify the coordinates in order to customize your journal file and to select the edge you like to use in subsequent modeling steps.

  2. Solution: Define side1Edges1 using variables you defined from Scratch in the preceding lines of your python script. I recommend using the journal file as a blueprint in which all click-events have to be replaced using well known variables, defined by yourself. For example, define a list of points myPoints = [(0,0), (0,1) ] using your own logic and then use these points as arguments of the methods e.g. myLine = mySketch.Line(point1=myPoints[0], point2=myPoints[1]), constructing new variables like myLine for the usage in subsequent modeling steps.

To get a basic understanding of the modeling workflow using the Abaqus Python API, i can recommend Puri, G. M., 2011. Python scripts for Abaqus : learn by example, 1st Edition, also it is hardly available in most universities.

Looking at the Abaqus Benchmark Guide can be helpful, as some newer Benchmarks contain Python scripts (e.g. Fracture Mechanics).