-
-
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 pmErKo
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.
Innovation SpaceTrending discussionsTop Contributors-
5674
-
1890
-
1419
-
1305
-
1021
Top Rated Tags© 2026 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 will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.