Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

DEFINE A REGION

Status
Not open for further replies.

chourouk

Mechanical
Joined
Sep 15, 2016
Messages
41
Location
FR
Hello
How can I define a region through edges such as edge[0],edge[3],edge[4].....
On the other hand the number of these edges is variable according to the case
for example i make this :
region = p.SetFromElementLabels(elementLabels=edges11, name='Wire_cubic_cell1')
p = mdb.models['Model-1'].parts['Part-1']
p.SectionAssignment(region=region, sectionName='cylindrical_section1', offset=0.0,
offsetType=MIDDLE_SURFACE, offsetField='',
thicknessAssignment=FROM_SECTION)
such as edges11 contain the index of edges,edges11=(0,3,4,7,8,....)
but in the affection of section i have error "region, found none,expecting region

thanks
 
Do you want to create a set with elements or with edges? Clarify what kind of entity you want to use and don't mix it randomly.
 
Do you want to use all edges of your part? Then you could use a slicing, that is larger than needed.

Code:
p = mdb.models['Model-1'].parts['Part-1']
e = p.edges
edges = e[0:100]
p.Set(edges=edges, name='Set-1')
 

I do not want to use all the edges but I want to use some edges already chosen
 
Then do it with a loop and combine the single slices.

Code:
p = mdb.models['Model-1'].parts['Part-1']

ids = [1, 3, 4, 7]

for i,x in enumerate(ids):
	if i==0:
		eregion = p.edges[x:x+1]
	else:
		eregion = eregion + p.edges[x:x+1]

p.Set(edges=eregion, name='Set-1')
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top