diff --git a/LoadCase/LoadsAndBCs.py b/LoadCase/LoadsAndBCs.py index 5e72d4a7f4b5f61ee96f29d1b0f51231512e7782..17fdf4ebc9953ae27a9ef03d05bf5005f04ea5cd 100644 --- a/LoadCase/LoadsAndBCs.py +++ b/LoadCase/LoadsAndBCs.py @@ -27,8 +27,13 @@ def create_load(data, **kwargs): # Iterate through unique ipMT names mt_names = [sublist[0] for sublist in data] mt_names = set(mt_names) - i = 0 + # Specify that the load is negative for all ipMTs that have even numbers and positive otherwise for mtname in mt_names: + if int(mtname[-1]) % 2 == 0: + load = -LoadVal + else: + load = LoadVal + # Locate the points to which loads are to be applied for sublist in data: if mtname == sublist[0]: connector_end = sublist[3] @@ -40,10 +45,7 @@ def create_load(data, **kwargs): loadName = 'Load-' + connector_name + '-' + str(connector_end) loadRegion = a.Set(vertices=loadPoint, name=loadName) - if i % 2 == 0: - load = -LoadVal - else: - load = LoadVal + # Apply loads mdb.models[modelname].ConcentratedForce(name=loadName, createStepName=StepName, region=loadRegion, @@ -51,7 +53,6 @@ def create_load(data, **kwargs): distributionType=UNIFORM, field='', localCsys=None) - i += 1 # ipMTnames = kwargs['ipMTnames'] # StepName = kwargs['StepName']