I would like to extract an integer(30) from a tuple list as shown below which comes after the set "vertices". The code has to have some logic to look for after vertices.
(mdb.models['model-3'].rootAssembly.instances['Circular_knit - 2, 3, 3-1'].vertices[30], (-3.61088101472848e-14, 5.0, -3.95139073393513e-16))
I found examples to extract this integer when the tuple is comprising only in integers. My case here is that it is after a specific set of character("vertices") that I want to extarct the integer value('30'). I would appreciate any advise on this.
>>>v
[mdb.models['model-3'].rootAssembly.instances['Circular_knit - 2, 3, 3-1'].vertices[30], (-3.61088101472848e-14, 5.0, -3.95139073393513e-16)]
>>> v[0]
mdb.models['model-3'].rootAssembly.instances['Circular_knit - 2, 3, 3-1'].vertices[30]
k=v[0]
k=str(k)
>>> i=0
>>> num_list = [int(i.split('[')[1]) for i in k]
IndexError: list index out of range
Lets split your object mdb.models['model-3'].rootAssembly.instances['Circular_knit - 2, 3, 3-1'].vertices[30]
:
mdb
- high-level Abaqus model database object. Among other members it has a container models
which contain all models of your the actual database;.models['model-3']
- Model object with the name 'model-3'. Among it's members you can find rootAssembly
..rootAssembly
- a root object for all your instances (approximately as model
object is a "root" for all your parts);.instances['Circular_knit - 2, 3, 3-1']
- an Instance object which is an instance of one of your Part objects. It contains many members and one among them is vertices
container (Note that if you are working with an orphan mesh you will have only nodes, but no vertices)..vertices[30]
- finally here you are accessing the vertex under the index '30', so as a result, you have the Vertex object. Any vertex object has several members and one of them is index
.So, the answer to your question will be:
v[0].index