Hi,
I create a code in order the create joint results (force and moment) for each joint in the model. All the results are store in the same group.
def def_JointExport(analysis,nom="Liaisons",temps=[]):
numberAnalysis=Tree.GetPathToFirstActiveObject()
nameAnalysis=numberAnalysis[numberAnalysis.find('[')+1:numberAnalysis.find(']')]
solution = ExtAPI.DataModel.Project.Model.Analyses[int(nameAnalysis)].Solution
connections = ExtAPI.DataModel.Project.Model.Connections
strForceUnit = ExtAPI.DataModel.CurrentUnitFromQuantityName("Force")
strMomentUnit = ExtAPI.DataModel.CurrentUnitFromQuantityName("Moment")
strLengthUnit = ExtAPI.DataModel.CurrentUnitFromQuantityName("Length")
strVelocityUnit = ExtAPI.DataModel.CurrentUnitFromQuantityName("Velocity")
joints_temp = connections.GetChildren(DataModelObjectCategory.Joint,True)
joints = [joint for joint in joints_temp if joint.Suppressed == False and len(joint.MobileLocation.Ids) != 0 and len(joint.ReferenceLocation.Ids) != 0]
liste_dossier = solution.GetChildren(DataModelObjectCategory.TreeGroupingFolder, True)
if len(temps) == 0:
temps = analysis.StepsEndTime
# Suppresion du dossier DDC si deja existant
for dossier in liste_dossier:
if dossier.Name == "{}".format(nom):
dossier.DeleteTreeGroupAndChildren()
# Create a joint probe for each joint not already having a result probe
resgr=[]
cpt = 0
with Transaction(suspendClicks=True):
for joint in joints:
if joint.Suppressed == False:
cpt = cpt + 1
joint_probe = solution.AddJointProbe()
joint_probe.BoundaryConditionSelection = joint
joint_probe.Name = "Liaison_Pdt{}_F_{}_{}".format(str(temps[0]),str(joint.Type), joint.Name)
joint_probe.DisplayTime = Quantity(str(temps[0]) + ' [sec]')
#joint_probe.RenameBasedOnDefinition()
resgr.append(joint_probe)
joint_probe = solution.AddJointProbe()
joint_probe.BoundaryConditionSelection = joint
try:
joint_probe.ResultType = ProbeResultType.MomentReaction
joint_probe.Name = "Liaison_Pdt{}_M_{}_{}".format(str(temps[0]),str(joint.Type), joint.Name)
joint_probe.DisplayTime = Quantity(str(temps[0]) + ' [sec]')
#joint_probe.RenameBasedOnDefinition()
resgr.append(joint_probe)
except:
joint_probe.ResultType = ProbeResultType.FrictionMomentProbe
joint_probe.Name = "Liaison_Pdt{}_M_{}_{}".format(str(temps[0]),str(joint.Type), joint.Name)
joint_probe.DisplayTime = Quantity(str(temps[0]) + ' [sec]')
#joint_probe.RenameBasedOnDefinition()
resgr.append(joint_probe)
joint_probe = solution.AddJointProbe()
joint_probe.BoundaryConditionSelection = joint
joint_probe.ResultType = ProbeResultType.RotationProbe
joint_probe.Name = "Liaison_Pdt{}_M_{}_{}".format(str(temps[0]),str(joint.Type), joint.Name)
joint_probe.DisplayTime = Quantity(str(temps[0]) + ' [sec]')
#joint_probe.RenameBasedOnDefinition()
resgr.append(joint_probe)
ExtAPI.DataModel.Tree.Refresh()
if cpt != 0:
dossier_joints = ExtAPI.DataModel.Tree.Group(resgr)
dossier_joints.Name = "{}".format(nom)
solution.EvaluateAllResults()
For now, I only get one folder with all results inside.
But in case I have multiple folders in the connection definition, is there a way to group joint results in the same groups ?
Here an example of folders :

Regards,
Jean