Say we have a model which includes line bodies. How can we automatically create an axial force result for each and every unsuppressed line body present in the model, using scripting?
Below is one way of doing this:
assm=DataModel.GeoData.Assemblies solution=Model.Analyses[0].Solution for my_assm in assm: for part in my_assm.AllParts: for body in part.Bodies: if body.Suppressed==False and str(body.BodyType)=="GeoBodyWire": my_selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities) my_selection.Ids = [body.Id] resfx=solution.AddDirectionalAxialForce() resfx.Location=my_selection ExtAPI.SelectionManager.ClearSelection()