3

In abaqus Python script, several Plies have a large number of copies, each of which has many fibers. In each Fiber, a set of edges has been selected: App1-1, App1-2, ..., App99-1, App99-2, ..., App99-88. How to create a new set that will contain all or some of these set of edges? Thank you.

Code:

allApps=[]
...
for i in range(Plies):
    ...
    for j in range (Fiber):
        appSet = Model.rootAssembly.Set(edges=
            Model.rootAssembly.instances['Part'+str(i+1)+'-'+str(1+j)].edges[0:0+1], 
            name='App'+str(i+1)+'-'+str(1+j))
        allApps.append(appSet)

I can guess it should be something like this:

Model.rootAssembly.Set(name='allAppEdges', edges=.?.Array(allApps))

but I'm not sure about this and I have no idea about correct syntax

chepner
  • 497,756
  • 71
  • 530
  • 681
Mike Cy
  • 41
  • 4
  • Have you looked at `part.EdgeArray`? I believe you'll have to `import part` explicitly, and you can create a new EdgeArray from a list of edges (`allApps` in your case): `...edges=part.EdgeArray(allApps))` – brady Sep 30 '18 at 13:54
  • Do you want a simple union? Python set already supports that. Or "update". https://docs.python.org/2/library/sets.html I would expect the same from this set, although I'm not entirely sure what library it is. – Kenny Ostrom Sep 30 '18 at 18:12
  • Thanks brady and Kenny Ostrom. Edges created in instances not in part. Example of appSet: Model.rootAssembly.sets['App4-88'] and example of array allApps: [Model.rootAssembly.sets['App1-1'], Model.rootAssembly.sets['App1-2'], ..., Model.rootAssembly.sets['App4-88']] – Mike Cy Sep 30 '18 at 21:37
  • The `part` module just gives you access to the `EdgeArray` type. I don't think it matters that your edges are coming from an instance rather than a part. I'll write up an answer with an example that I think will work for you. – brady Oct 01 '18 at 13:00

1 Answers1

1

I tested the following on a simple part and it worked for me. I think you could adapt this to achieve what you're trying to do for your specific model. The key is the part.EdgeArray type. For whatever reason Abaqus requires your edges be supplied within that type, rather than a simple list or tuple. The Abaqus documentation is not clear on this, and when you pass a list of edges it will fail with a vague error: Feature creation failed.

from abaqus import *
import part

mdl = mdb.models['Model-1']
inst = mdl.rootAssembly.instances['Part-1-1']

# Loop through all edges in the instance and add them to a list
my_edges = []
for e in inst.edges:
    my_edges.append(e)

# Create a new set with these edges
#mdl.rootAssembly.Set(name='my_edges', edges=my_edges) # This will fail because my_edges needs to be an EdgeArray
mdl.rootAssembly.Set(name='my_edges', edges=part.EdgeArray(my_edges))

For others that may find themselves here - similar types are available for vertices, faces, and cells: part.VertexArray, part.FaceArray, and part.CellArray.

brady
  • 2,227
  • 16
  • 18