-
-
July 26, 2021 at 1:30 pm
RustyJohnston
SubscriberI am working on a model and I want to count the number of nodes that are above or below a threshold value. I imagine this could be done somehow with scripting, but I don't know enough about that in ANSYS to do it on my own. I am sure that ansys already does something like this to make contour bands. Thanks in advance.
July 26, 2021 at 2:24 pmErik Kostson
Ansys Employee
If we say have a displacement results and do export, we can filter in excel and se how many nodes there are.
Otherwise of course this is scriptable either with mechanical act, or with apdl command object .
As an example (for UZ displacement) the sample code below gets nodes that have absolute z-displacements larger than 0.009 m. These nodes are also added to a named selection and finally a result is scoped to these nodes only.
model=ExtAPI.DataModel.Project.Model # refer to model
reader = model.Analyses[0].GetResultsData() # get results data of first analysis in the tree
DispResults = reader.GetResult('U') # obtain stress results
DispResults.SelectComponents(["Z"]) # select direction
nd=ExtAPI.DataModel.Project.Model.Mesh.Nodes
stNdres=[]
stNd=[]
for i in range(1,nd):
tempres=DispResults.GetNodeValues(i)
if abs(tempres[0])>0.0090:
stNdres.append(abs(tempres[0]))
stNd.append(i)
reader.Dispose
temp_sel=ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.MeshNodes)
nodeNs=ExtAPI.DataModel.Project.Model.AddNamedSelection temp_sel.Ids=stNd
nodeNs.Location=temp_sel
totDef=ExtAPI.DataModel.Project.Model.Analyses[0].Solution.AddTotalDeformation totDef.ScopingMethod=GeometryDefineByType.Component
totDef.Location=temp_sel
totDef.EvaluateAllResults
All the best
July 26, 2021 at 9:51 pmRustyJohnston
SubscriberAppreciate the info. While this answers my question in general, it would have been helpful if the example was specific to what I was asking so that I could use it/experiment with it directly, rather than having to do a bunch of additional research to figure out the missing pieces to get to what I needed. Still, this is much further than I was before.
Viewing 2 reply threads- The topic ‘How can I count nodes above a threshold value?’ is closed to new replies.
Ansys Innovation SpaceTrending discussionsTop Contributors-
3402
-
1057
-
1051
-
896
-
877
Top Rated Tags© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-

Ansys Assistant

Welcome to Ansys Assistant!
An AI-based virtual assistant for active Ansys Academic Customers. Please login using your university issued email address.

Hey there, you are quite inquisitive! You have hit your hourly question limit. Please retry after '10' minutes. For questions, please reach out to ansyslearn@ansys.com.
RETRY