Abaqus Surface getSequenceFromMask
Asked Answered
O

5

5

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

Orthogenic answered 14/11, 2017 at 18:58 Comment(0)
S
8

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).

Salmon answered 14/11, 2017 at 21:29 Comment(2)
It seems there is no such a constant COORDINATES in Abaqus 6.14. But COORDINATE works fine.Aesir
@JKepler Thank you, I corrected my answer by changing 'COORDINATES' to 'COORDINATE'.Salmon
W
2

I suppose you are creating an edge based surface. There are many ways to do it, easiest one is

Create an assembly based set ("setName") of those edges for which you want to create surface.

instance=mdb.rootAssembly.instances["InstanceName"]
set_for_surface=instance.sets["setName"].edges
assembly.Surface(side1Edges=set_for_surface, name="surf_name")

Have look at findAt() or selecting region by bounding box "getBoundingBox()". See this SO answer, which is somewhat similar.

Edit: If the set is an assembly based set, access it directly from assembly not instance. Then, use the same procedure.

mdb.rootAssembly.sets['Set_name'].edges
Whereto answered 16/11, 2017 at 3:46 Comment(0)
E
0

Late to answer but i found simpler way to select all the edges by giving coordinates:

p = mdb.models['Model-1'].parts['Part-1']
e = p.edges
edges = e.getByBoundingBox(x1,y1,z1,x2,y2,z2)
p.Set(edges=edges, name='AllPartSet')

x, y and z are two coordinates for making a box.

Elmore answered 5/2, 2021 at 19:1 Comment(0)
S
0

One more thing, the getByBoundingBox function return a mask string (if the element set is not empty), which can be used in getSequenceFromMask to create sets and surfaces.

Selfesteem answered 28/12, 2023 at 15:1 Comment(1)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewKilkenny
T
0

I think the simple solution is:

s1 = a.instances['kolo-1'].edges
side1Edges1 = s1.getSequenceFromMask(s1.getMask())
a.Surface(side1Edges=side1Edges1 , name='kolkoSurf')
Tirpitz answered 7/3 at 3:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.