-
-
July 26, 2021 at 1:30 pmRustyJohnstonSubscriber
I 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 KostsonAnsys 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 pmRustyJohnstonSubscriberAppreciate 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 discussions- At least one body has been found to have only 1 element in at least 2 directions
- Error when opening saved Workbench project
- How to apply Compression-only Support?
- Geometric stiffness matrix for solid elements
- Frictional No separation contact
- Image to file in Mechanical is bugged and does not show text
- Timestep range set for animation export
- Script Error Code:800a000d
- Elastic limit load, Elastic-plastic limit load
- Element has excessive thickness change, distortion, is turning inside out
Top Contributors-
1406
-
599
-
591
-
555
-
366
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.
-