Hello all,
When I was trying to use dpf.operators.scoping.on_named_selection() in my script in Mechanical, I encountered a problem while trying to access the named selection’s data. I have two named selections in my model:
1. ns_tree (created in model tree using Mechanical interface);
2. ns_apdl (created via APDL -script).
The both are present in solver components names and node id is accessible via APDL -script as well. Then, I try to get node Id via DPF-script:
import mech_dpf
import Ans.DataProcessing as dpf
import os
mech_dpf.setExtAPI(ExtAPI)
analyses = ExtAPI.DataModel.AnalysisList
analysis = analyses[0]
analysis_dir_path = analysis.WorkingDir
path = os.path.join(analysis_dir_path, 'file.rst')
dataSources = mech_dpf.GetDataSources()
op = dpf.operators.scoping.on_named_selection()
op.inputs.requested_location.Connect('Nodal')
op.inputs.named_selection_name.Connect('NS_TREE')
op.inputs.data_sources.Connect(dataSources)
my_mesh_scoping = op.outputs.mesh_scoping.GetData()
print(my_mesh_scoping)
The DPF-script works fine only for named selection, created via Mechanical interface, but not for named selection, created via APDL. In the case of named selection, created via APDL, I get the following error message:
scoping_provider_by_ns:0<-error: GetScoping -Failed to read the named selection or the named selection is empty-:line 22
Hence, for DPF, the named selection, created via APDL, is empty or not accessible! Is it a known issue? Is there a workaround?