Abaqus Surface getSequenceFromMask

回眸只為那壹抹淺笑 提交于 2021-02-07 04:00:57

问题


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


回答1:


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




回答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



回答3:


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.



来源:https://stackoverflow.com/questions/47293330/abaqus-surface-getsequencefrommask

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!