Alexander Hentschel
Alexander Hentschel

Reputation: 13

Abaqus python scripting: select one of two connectors which share the same coordinates

I am writing a script that automates the part of creating a model in Abaqus. In the model, two connector elements are applied to 2 nodes of two instances. The first connector starts at point a on instance 1 and ends at point b on instance 2. The second connector works vice versa. This means the two connectors obviously share the same coordinates and overlay. Picking the underlying connector with the cursor is not the problem, but automating this step and picking the underlaying connector to assign a section is where I am stuck since you cannot use the findAt() method, because it always picks the top connector. Both Wires are already implemented, but assigning a section to the second connector does not work. Can I somehow use getSequenceFromMask to access the second underlying connector?

I think it has something to do with how I can find the edges and maybe create a name or set for the edges when the wire for the connector is created. Can I specify the mask in getSequenceFromMask to be the desired edges of the second connector? This is part of the loop. The coordinates come from libraries and the name for the section comes from a list

mdb.models['Model-1'].rootAssembly.WirePolyLine(mergeType=IMPRINT, meshable=False, points=((
    mdb.models['Model-1'].rootAssembly.instances[ListeGConZug[0]].vertices.findAt((
    dctX2['XKoordLLZ_%s' % ladida[i]][y], dctY2['YKoordLLZ_%s' % ladida[i]][y], dctZ2['ZKoordLLZ_%s' % 
   ladida[i]][y]), ), 
mdb.models['Model-1'].rootAssembly.instances[ladida[i]].vertices.findAt((
   dctX3['XKoordLLE_%s' % ladida[i]][y], dctY3['YKoordLLE_%s' % ladida[i]][y], dctZ3['ZKoordLLE_%s' % 
   ladida[i]][y]), )), ))
mdb.models['Model-1'].rootAssembly.features.changeKey(NameWire[-1], 
   toName=NameWire[-1])
mdb.models['Model-1'].rootAssembly.Set(edges=
   mdb.models['Model-1'].rootAssembly.edges.findAt(((dctX3['XKoordLLE_%s' % ladida[i]][y], 
   dctY3['YKoordLLE_%s' % ladida[i]][y], dctZ3['ZKoordLLE_%s' % ladida[i]][y]), )), 
   name=NameWireSetConGZug[-1])
mdb.models['Model-1'].rootAssembly.SectionAssignment(region=
   mdb.models['Model-1'].rootAssembly.sets[NameWireSetConGZug[-1]], sectionName=
   NameWireSetConGZug[-1])

Upvotes: 1

Views: 967

Answers (1)

Roman Zh.
Roman Zh.

Reputation: 1049

From the documentation of the WirePolyLine (Abaqus Scripting Reference Guide):

points: A tuple of point pairs, each pair being itself represented by a tuple. For part level features each point can be a Vertex, Datum point, Reference point, orphan mesh Node, or InterestingPoint object specifying the points through which the polyline wire will pass. Each point can also be a tuple of Floats representing the coordinates of a point. For assembly level features each point can only be a Vertex, Reference point, or orphan mesh Node specifying the points through which the polyline wire will pass (coordinates cannot be specified). In any of the pairs, the first or second point can be NONE. In that case, the point pair will create a zero-length wire, which is required for certain types of connectors. You must specify at least one pair.

So, you can either create a Reference point on each instance and use them to define your Wire object, either directly use Vertices (Nodes if you are using Orphan mesh).


Just a comment to your code: try to use variables and formatting, so your code is clear and easy readable. For example:

m = mdb.models['Model-1']
a = m.rootAssembly

points = (
    a.instances[ListeGConZug[0]].vertices.findAt((
        dctX2['XKoordLLZ_%s' % ladida[i]][y],
        dctY2['YKoordLLZ_%s' % ladida[i]][y],
        dctZ2['ZKoordLLZ_%s' % ladida[i]][y]),
    ),
    #<...the rest of your points definition>
)

wire_feature = WirePolyLine(mergeType=IMPRINT, meshable=False, points=(points, )

Update for everyone searching to find a "Wire" edge when it is seems to be impossible

As presented by OP, sometimes it seems impossible to be sure that Abaqus will choose the right edge as a result of findAt method. For example, it could happen if you have several connectors at the same place and/or connectors are connecting nodes that are located at the same coordinate position. I have found a nice workaround.

When the WirePolyLine method is called it:

  1. Creates an edge at the rootAssembly level (important!);
  2. Creates a Feature object;
  3. Returns the Feature object.

The Feature objects have only two members: name and id. So it is impossible to use it directly to create a Set required afterward to assign the connector section (see SectionAssignment method documentation). However, as the Wire's edge was created at the rootAssembly level, we can loop through all edges found at the required position and take the one with a good featureName!

pos = (-5., 0., 0.)  # For example, this is the point where we are searching for our Wire

for edg in a.edges.findAt((pos,)):
    if edg.featureName == wire_feature.name:
        break

Upvotes: 1

Related Questions