July 26, 2021 at 2:24 pm
Erik 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