-
-
May 5, 2022 at 7:15 am
gokbayrak
SubscriberI am trying to get stress values from nodes on a named selection by using DPF script below and it gives values also for mid nodes.
Do you know how to exclude mid nodes ? Thanks in advance.
import mech_dpf
import Ans.DataProcessing as dpf
import Ans.DataProcessing.operators as ops
mech_dpf.setExtAPI(ExtAPI)
my_data_source = mech_dpf.GetDataSources()
ns = ops.scoping.on_named_selection()
ns.inputs.data_sources.Connect(my_data_source)
ns.inputs.requested_location.Connect("Nodal")
ns.inputs.named_selection_name.Connect("MY_NS")
stress_op = ops.result.stress_X()
stress_op.inputs.data_sources.Connect(my_data_source)
stress_op.inputs.mesh_scoping.Connect(ns.outputs.mesh_scoping)
my_stress = stress_op.outputs.fields_container.GetData()
my_stress[0].Data
May 5, 2022 at 8:14 amMay 5, 2022 at 8:33 amgokbayrak
SubscriberThanks for the reply ekostson
This manual selection is not an option for me because i have lots of face named selections and somehow i need to do that in scripting window.
I searched DPF docs but could not find a solution
May 5, 2022 at 9:59 amErKo
Ansys EmployeeHi - no worries - glad to be of help.
There is no other way I believe since as we said you are using ns.inputs.requested_location.Connect("Nodal")
so nodal results and it will look at every node in your named selection, thus it will get stresses for these nodes in the NS, and hence why we need to remove them (mid-side) which is easily done as shown from the NS.
One can automate this (above removal of mid-side using the named selection worksheet) using the act api call for the worksheet for adding rows and remove nodes in the worksheet of the named selection (below is a sample code)model = ExtAPI.DataModel.Project.Model # reference model
nsall=ExtAPI.DataModel.Project.Model.NamedSelections.Children
for ns in nsall:
objId = ns.ObjectId # reference ID of named selection object for future use
DataModel.GetObjectById(objId).ScopingMethod=GeometryDefineByType.Worksheet
DataModel.GetObjectById(objId).GenerationCriteria.Add(None)
Viewing 3 reply threads- The topic ‘How to Exclude Mid Nodes in ANSYS DPF Scripting’ is closed to new replies.
Innovation SpaceTrending discussionsTop Contributors-
6425
-
1906
-
1457
-
1308
-
1022
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.
