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!

Python make set from reference points 1

Status
Not open for further replies.

nice_guy

Mechanical
Joined
Nov 27, 2019
Messages
3
Location
IL
Hi everyone,
I have some reference point which are defined in my model.
Now I want to produce a set which contains some of those reference point in it and I want to automate this procedure by looping it.
When I look at the recording of the python commands used to do build that set it looks like this:

a = mdb.models['Model-1'].rootAssembly
r1 = a.referencePoints
refPoints1=(r1[5], r1[7], r1[9], r1[10], )
a.Set(referencePoints=refPoints1, name='mySet')

I have some simple logic rules on which point I want in that set, can anyone advice on how can I loop this picking action?

Thanks,
Itay
 
What you see are the indices of the points (5,7,9,10).

What logic do you want to use?

Example:
You could cycle through all points and check their coordinates. If certain criteria are fulfilled, their index is stored and then used when creating the set.
 
Thanks!
Problem solved.. so I'll share it here anyway.

refPoints1=[0]*size
j=0
for i in range(start,end,interval):
refPoints1[j]=(mdb.models['Model-1'].rootAssembly.referencePoints)
j+=1
mdb.models['Model-1'].rootAssembly.Set(referencePoints=refPoints1, name='mySet')
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top