Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Selecting features NEAR a location with python

Status
Not open for further replies.

SwimBikeRun4342

Mechanical
Mar 6, 2013
28
0
0
US
Hi,

I am writing parametric studies for some abaqus designs via python. Most of this has went pretty smoothly but I have reached a frustrating problem for selecting edges (from python) for a particular structure as the geometry changes. I typically use the findAt() commands and write basic algebra equations so the features are continuously selected as the geometry changes, but now the points I need to determine are slightly inexact. Is there a command where I specify points NEAR to the desired feature I wish to select rather than the EXACT location?

In other words, errors emerge in selecting the feature with findAt because the points are off by about 1E-6 (very small for the system I'm working with) as the geometry changes after a certain amount. Rather than rewriting my model so it has this inaccuracy corrected, I would rather find a python command or algorithm that just selects points within a 1E-6 to 1E-5 range of the desired feature. Is there a command for this?? If not, do any of you guys have an idea on an algorithm I could write to achieve this?

Thanks!
 
Replies continue below

Recommended for you

from numpy import * # this works in 6.12
p = point
q = array of points
d = asarray(q)-asarray(p)
d = asarray(sqrt(sum(d*d,-1)))
d.argmin() or d[d<1e-5] for the closest point or the points within the tolerance
 
Status
Not open for further replies.
Back
Top