We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.

Ansys Learning Forum Forums Discuss Simulation General Mechanical User Defined Result Reply To: User Defined Result

Erik Kostson
Ansys Employee

 

 

 

The below is working – needs to be in this order:

model=ExtAPI.DataModel.Project.Model # refer to Model
analysis = model.Analyses[0]
solution = analysis.Solution
geometry = DataModel.GetObjectsByName(‘Solid.1’)[0]
path = DataModel.GetObjectsByName(‘Path’)[0]
res=solution.AddUserDefinedResult()
gId=geometry.GetGeoBody().Id
SlMn = ExtAPI.SelectionManager
SlMn.ClearSelection()
Sel = SlMn.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
Sel.Ids = [gId]
res.ScopingMethod=GeometryDefineByType.Path
res.Location=Sel
res.Location=path

res.Expression=’UX'

 

or if we are using a named selection (NS) say called Selection2:

model=ExtAPI.DataModel.Project.Model # refer to Model
analysis = model.Analyses[0]
solution = analysis.Solution
ns=DataModel.GetObjectsByName(‘Selection2’)[0] # change name of NS as needed
path = DataModel.GetObjectsByName(‘Path’)[0] # change name of path as needed
res=solution.AddUserDefinedResult()
res.ScopingMethod=GeometryDefineByType.Path
res.Location=ns
res.Location=path

res.Expression=’UZ'

both are working fine .




Still if for some reason it is not then read here for more info and alternative:

https://discuss.ansys.com/discussion/2491/how-to-set-path-and-geometry-scoping-when-defining-result-object-with-path-as-the-scoping-method

 

Â