Open
Description
Before submitting the issue
- I have checked for Compatibility issues
- I have searched among the existing issues
- I am using a Python virtual environment
Description of the bug
I am trying to export a face name selection to a stl using mechdpf in a python code object.
Getting the scoping is super problematic and there are issues there that could be causing the problem. But when all is said and done, I have a scoping on a group of nodes from the face name selection (from Mechanical).
But the export .stl only contains:
solid default_output
endsolid default_output
But if I use a python code object and activate my result (scoped to the named selection) I can export a .stl, so it is not a stl format issue.
Steps To Reproduce
Create a simple block model, set one face to a name selection and solve. Then try to create/export an .stl file using:
import mech_dpf
import Ans.DataProcessing as dpf
import os
analysis = ExtAPI.DataModel.Project.Model.Analyses[0]
named_selection = 'STL_EXPORT_FACE'
mech_dpf.setExtAPI(ExtAPI)
dataSource = dpf.DataSources(analysis.ResultFileName)
model = dpf.Model(dataSource)
meh_org = model.Mesh
wd = analysis.WorkingDir
save_name = 'result.stl'
save_path = os.path.join(wd,save_name)
#Scoping on named selection
scoping_on_ns = dpf.operators.scoping.on_named_selection()
scoping_on_ns.inputs.requested_location.Connect('Nodal')
scoping_on_ns.inputs.named_selection_name.Connect(named_selection)
scoping_on_ns.inputs.data_sources.Connect(dataSource)
my_mesh_scoping = scoping_on_ns.outputs.mesh_scoping.GetData()
op = dpf.operators.mesh.from_scoping() # operator instantiation
op.inputs.scoping.Connect(my_mesh_scoping)
op.inputs.mesh.Connect(meh_org)
op.inputs.nodes_only.Connect(True)
my_mesh = op.outputs.mesh.GetData()
op = dpf.operators.mesh.stl_export() # operator instantiation
op.inputs.mesh.Connect(my_mesh)
op.inputs.file_path.Connect(save_path)
op.Run()
ExtAPI.Log.WriteMessage('File %s written to %s'%(save_path,wd))
Which Operating System causes the issue?
Windows
Which DPF/Ansys version are you using?
Ansys 2024 R1
Which Python version causes the issue?
3.7
Installed packages
mech dpf in mechanical