Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross 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
Nov 27, 2019
3
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
 
Replies continue below

Recommended for you

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