Bolt Pretension

This script finds all Bolt Pretension objects in Mechanical and assigns

Bolt Pre-Tension of F1 = 1000 [N] in Load Step 1

Bolt Pre-Tension of F2 = 19860 [N] in Load Step 2

Lock in Load Step 3.

Transparent Transparent

Script excecution time: 50 [ms]


import time
bps = ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.BoltPretension)	# get all Bolt Pretension objects
############################ F1 User Input!##############################
F1 = 1000
############################ F2 User Input!##############################
F2 = 19860
StartTime = time.time()
with Transaction():
    for i in bps:
        i.SetDefineBy(1,BoltLoadDefineBy.Load)  # set first step to Load
        i.Preload.Output.SetDiscreteValue(0,Quantity(F1, 'N')) # set preload to 10000 N in first step
        i.SetDefineBy(2,BoltLoadDefineBy.Load)  # set second step to Load
        i.Preload.Output.SetDiscreteValue(1,Quantity(F2, 'N'))    # set preload to 19860 N in second step
        for t in range(3,len(ExtAPI.DataModel.AnalysisList[0].StepsEndTime)+1): i.SetDefineBy(t,BoltLoadDefineBy.Lock)
print(str(time.time() - StartTime))