Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Selecting all edges in python scripting to create wire 1

Status
Not open for further replies.

skr3178

Mechanical
Sep 5, 2020
34
0
0
US
Hello,
Goal is develop a script to create wire from edges-selecting all the edges.
Used macro recorder and then using the .jnl file as reference for the scripting.
.jnl shows the following line for the command >create wire by selecting all edges:

e = p.edges
p.WireFromEdge(edgeList=(e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8],
e[9], e[10],..... e[210]))

I have tried to replace it with:
p.WireFromEdge(edgeList=(mdb.models['Model-1'].parts['Circular_knit - 2, 3, 9'].edges))
which gives me the error found edgeArray, expecting tuple


I have therefore modified my code as
p.WireFromEdge(edgeList=tuple(','.join((['e[' + str(i) + ']' for i in range(a)]))))

which then for some reason shuts the abaqus CAE.

I would appreciate any ideas/codes which can allow me to select all the edges in my model.

 
Replies continue below

Recommended for you

Still have error
TypeError: edgelist; Expected a tuple, found string


I could find hint when I expanded the
edgelist=(e[9], e[10], e[11], e[12], e[13], e[14], e[15], e[16], e[17], e[18],
... e[19], e[20], e[21], e[22], e[23], e[24], e[25], e[26], e[27], e[28],
... e[29], e[30], ......e[405])

edgeList as
(mdb.models['Model-1'].parts['Circular_knit - 2, 3, 9'].edges[0], mdb.models['Model-1'].parts['Circular_knit - 2, 3, 9'].edges[1], mdb.models['Model-1'].parts['Circular_knit - 2, 3, 9'].edges[2], mdb.models['Model-1'].parts['Circular_knit - 2, 3, 9'].edges[3], .... mdb.models['Model-1'].parts['Circular_knit - 2, 3, 9'].edges[405]]



 
Create an empty list, loop over all edges and add each edge into the list. Convert the list to a tuple and use that tuple in the final command.

Example:
Code:
from abaqus import *
from abaqusConstants import *
from caeModules import *

p = mdb.models['Model-1'].parts['block']

all_edges = []

for i in p.edges:
	all_edges.append(i)

x=tuple(all_edges)
p.WireFromEdge(edgeList=(x))
 
Status
Not open for further replies.
Back
Top