################################################################################################### # # Muscle extension script for Tyrannosaurus model # Lautenschlager (2015) Estimating cranial muscoloskeletal constraints in theropod dinosaurs # ################################################################################################### ### Definition of muscle cylinder objects mAMES1 = bpy.data.objects['Cylinder.052'] mAMES2 = bpy.data.objects['Cylinder.053'] mAMEM1 = bpy.data.objects['Cylinder.054'] mAMEM2 = bpy.data.objects['Cylinder.055'] mAMEP1 = bpy.data.objects['Cylinder.056'] mAMEP2 = bpy.data.objects['Cylinder.057'] mPSTs1 = bpy.data.objects['Cylinder.058'] mPSTp1 = bpy.data.objects['Cylinder.059'] mAMP1 = bpy.data.objects['Cylinder.060'] mAMP2 = bpy.data.objects['Cylinder.061'] mPTd1 = bpy.data.objects['Cylinder.062'] mPTd2 = bpy.data.objects['Cylinder.063'] mPTv2 = bpy.data.objects['Cylinder.065'] mPTv1 = bpy.data.objects['Cylinder.066'] ### Definition of text object for display of gape angle Text = bpy.data.objects['Text'] ### Definition of statistics bar objects representing each muscle bar_mAMES1 = bpy.data.objects['Cube'] bar_mAMES2 = bpy.data.objects['Cube.001'] bar_mAMEM1 = bpy.data.objects['Cube.003'] bar_mAMEM2 = bpy.data.objects['Cube.002'] bar_mAMEP1 = bpy.data.objects['Cube.007'] bar_mAMEP2 = bpy.data.objects['Cube.006'] bar_mPSTs1 = bpy.data.objects['Cube.004'] bar_mPSTp1 = bpy.data.objects['Cube.005'] bar_mAMP1 = bpy.data.objects['Cube.016'] bar_mAMP2 = bpy.data.objects['Cube.014'] bar_mPTd1 = bpy.data.objects['Cube.015'] bar_mPTd2 = bpy.data.objects['Cube.009'] bar_mPTv1 = bpy.data.objects['Cube.010'] bar_mPTv2 = bpy.data.objects['Cube.012'] ### Calculation of resting length of muscle cylinders orig_dim_mAMES1 = sqrt(mAMES1.dimensions.z**2 + mAMES1.dimensions.y**2 + mAMES1.dimensions.x**2) orig_dim_mAMES2 = sqrt(mAMES2.dimensions.z**2 + mAMES2.dimensions.y**2 + mAMES2.dimensions.x**2) orig_dim_mAMEM1 = sqrt(mAMEM1.dimensions.z**2 + mAMEM1.dimensions.y**2 + mAMEM1.dimensions.x**2) orig_dim_mAMEM2 = sqrt(mAMEM2.dimensions.z**2 + mAMEM2.dimensions.y**2 + mAMEM2.dimensions.x**2) orig_dim_mAMEP1 = sqrt(mAMEP1.dimensions.z**2 + mAMEP1.dimensions.y**2 + mAMEP1.dimensions.x**2) orig_dim_mAMEP2 = sqrt(mAMEP2.dimensions.z**2 + mAMEP2.dimensions.y**2 + mAMEP2.dimensions.x**2) orig_dim_mPSTs1 = sqrt(mPSTs1.dimensions.z**2 + mPSTs1.dimensions.y**2 + mPSTs1.dimensions.x**2) orig_dim_mPSTp1 = sqrt(mPSTp1.dimensions.z**2 + mPSTp1.dimensions.y**2 + mPSTp1.dimensions.x**2) orig_dim_mAMP1 = sqrt(mAMP1.dimensions.z**2 + mAMP1.dimensions.y**2 + mAMP1.dimensions.x**2) orig_dim_mAMP2 = sqrt(mAMP2.dimensions.z**2 + mAMP2.dimensions.y**2 + mAMP2.dimensions.x**2) orig_dim_mPTd1 = sqrt(mPTd1.dimensions.z**2 + mPTd1.dimensions.y**2 + mPTd1.dimensions.x**2) orig_dim_mPTd2 = sqrt(mPTd2.dimensions.z**2 + mPTd2.dimensions.y**2 + mPTd2.dimensions.x**2) orig_dim_mPTv1 = sqrt(mPTv1.dimensions.z**2 + mPTv1.dimensions.y**2 + mPTv1.dimensions.x**2) orig_dim_mPTv2 = sqrt(mPTv2.dimensions.z**2 + mPTv2.dimensions.y**2 + mPTv2.dimensions.x**2) ### Header information for output file header = 'Gape; mAMEMS1; mAMEMS2; mAMEM1; mAMEM2; mAMEP1; mAMEP2; mPSTs1; mPSTp1; mAMP1; mAMP2; mPTd1; mPTd2; mPTv1; mPTv2 \n' ### Output file path; insert correct file path here! output_file = open('C:\\...\\...\\Tyrannosaurus_output.txt', 'w') output_file.write(header) output_file.close() ### Definition of specific stretch factors stretch_factor1 = 1.0 stretch_factor2 = 1.3 stretch_factor3 = 1.7 ### Definition of resting lengths for each muscle rest_length_mAMES1 = 0 rest_length_mAMES2 = 0 rest_length_mAMEM1 = 0 rest_length_mAMEM2 = 0 rest_length_mAMEP1 = 0 rest_length_mAMEP2 = 0 rest_length_mPSTs1 = 0 rest_length_mPSTp1 = 0 rest_length_mAMP1 = 0 rest_length_mAMP2 = 0 rest_length_mPTd1 = 0 rest_length_mPTd2 = 0 rest_length_mPTv1 = 0 rest_length_mPTv2 = 0 ### Definition of start and stop variables resting_gape = 3 ### gape at muscle resting length gape = 0 gape_max = 80 start = 1 end = 160 counter = 1 counter = start ### Definition of material colours for muscle cylinders and statistics bars material_colour_mAMES1 = bpy.data.materials['t_mAMES1_mat'] material_colour_mAMES1.diffuse_color = (0.0, 0.0, 0.0) material_colour_mAMES2 = bpy.data.materials['t_mAMES2_mat'] material_colour_mAMES2.diffuse_color = (0.0, 0.0, 0.0) material_colour_mAMEM1 = bpy.data.materials['t_mAMEM1_mat'] material_colour_mAMEM1.diffuse_color = (0.0, 0.0, 0.0) material_colour_mAMEM2 = bpy.data.materials['t_mAMEM2_mat'] material_colour_mAMEM2.diffuse_color = (0.0, 0.0, 0.0) material_colour_mAMEP1 = bpy.data.materials['t_mAMEP1_mat'] material_colour_mAMEP1.diffuse_color = (0.0, 0.0, 0.0) material_colour_mAMEP2 = bpy.data.materials['t_mAMEP2_mat'] material_colour_mAMEP2.diffuse_color = (0.0, 0.0, 0.0) material_colour_mPSTs1 = bpy.data.materials['t_mPSTs1_mat'] material_colour_mPSTs1.diffuse_color = (0.0, 0.0, 0.0) material_colour_mPSTp1 = bpy.data.materials['t_mPSTp1_mat'] material_colour_mPSTp1.diffuse_color = (0.0, 0.0, 0.0) material_colour_mAMP1 = bpy.data.materials['t_mAMP1_mat'] material_colour_mAMP1.diffuse_color = (0.0, 0.0, 0.0) material_colour_mAMP2 = bpy.data.materials['t_mAMP2_mat'] material_colour_mAMP2.diffuse_color = (0.0, 0.0, 0.0) material_colour_mPTd1 = bpy.data.materials['t_mPTd1_mat'] material_colour_mPTd1.diffuse_color = (0.0, 0.0, 0.0) material_colour_mPTd2 = bpy.data.materials['t_mPTd2_mat'] material_colour_mPTd2.diffuse_color = (0.0, 0.0, 0.0) material_colour_mPTv1 = bpy.data.materials['t_mPTv1_mat'] material_colour_mPTv1.diffuse_color = (0.0, 0.0, 0.0) material_colour_mPTv2 = bpy.data.materials['t_mPTv2_mat'] material_colour_mPTv2.diffuse_color = (0.0, 0.0, 0.0) material_colour_bar_mAMES1 = bpy.data.materials['bar1_mat'] material_colour_bar_mAMES2 = bpy.data.materials['bar2_mat'] material_colour_bar_mAMEM1 = bpy.data.materials['bar3_mat'] material_colour_bar_mAMEM2 = bpy.data.materials['bar4_mat'] material_colour_bar_mAMEP1 = bpy.data.materials['bar5_mat'] material_colour_bar_mAMEP2 = bpy.data.materials['bar6_mat'] material_colour_bar_mPSTs1 = bpy.data.materials['bar7_mat'] material_colour_bar_mPSTp1 = bpy.data.materials['bar8_mat'] material_colour_bar_mAMP1 = bpy.data.materials['bar9_mat'] material_colour_bar_mAMP2 = bpy.data.materials['bar10_mat'] material_colour_bar_mPTd1 = bpy.data.materials['bar11_mat'] material_colour_bar_mPTd2 = bpy.data.materials['bar12_mat'] material_colour_bar_mPTv1 = bpy.data.materials['bar13_mat'] material_colour_bar_mPTv2 = bpy.data.materials['bar14_mat'] ### Loop running till maximum gape iset by user is reached while counter < (end + 1): bpy.context.scene.frame_set(counter) file_path = 'C:\\...\\...\\Tyrannosaurus_graphics_output' ### File path for still images, insert correct file path here! file_name = file_path + str(counter) + 'jpg' ### Definition of file extension gape = (gape_max / end) * counter ### Calculation of gape angle Text.data.body = ' Gape angle: ' + str(gape) + '°' counter = counter + 1 ### Calculation of current extension length curr_dim_mAMES1 = sqrt(mAMES1.dimensions.z**2 + mAMES1.dimensions.y**2 + mAMES1.dimensions.x**2) curr_dim_mAMES2 = sqrt(mAMES2.dimensions.z**2 + mAMES2.dimensions.y**2 + mAMES2.dimensions.x**2) curr_dim_mAMEM1 = sqrt(mAMEM1.dimensions.z**2 + mAMEM1.dimensions.y**2 + mAMEM1.dimensions.x**2) curr_dim_mAMEM2 = sqrt(mAMEM2.dimensions.z**2 + mAMEM2.dimensions.y**2 + mAMEM2.dimensions.x**2) curr_dim_mAMEP1 = sqrt(mAMEP1.dimensions.z**2 + mAMEP1.dimensions.y**2 + mAMEP1.dimensions.x**2) curr_dim_mAMEP2 = sqrt(mAMEP2.dimensions.z**2 + mAMEP2.dimensions.y**2 + mAMEP2.dimensions.x**2) curr_dim_mPSTs1 = sqrt(mPSTs1.dimensions.z**2 + mPSTs1.dimensions.y**2 + mPSTs1.dimensions.x**2) curr_dim_mPSTp1 = sqrt(mPSTp1.dimensions.z**2 + mPSTp1.dimensions.y**2 + mPSTp1.dimensions.x**2) curr_dim_mAMP1 = sqrt(mAMP1.dimensions.z**2 + mAMP1.dimensions.y**2 + mAMP1.dimensions.x**2) curr_dim_mAMP2 = sqrt(mAMP2.dimensions.z**2 + mAMP2.dimensions.y**2 + mAMP2.dimensions.x**2) curr_dim_mPTd1 = sqrt(mPTd1.dimensions.z**2 + mPTd1.dimensions.y**2 + mPTd1.dimensions.x**2) curr_dim_mPTd2 = sqrt(mPTd2.dimensions.z**2 + mPTd2.dimensions.y**2 + mPTd2.dimensions.x**2) curr_dim_mPTv1 = sqrt(mPTv1.dimensions.z**2 + mPTv1.dimensions.y**2 + mPTv1.dimensions.x**2) curr_dim_mPTv2 = sqrt(mPTv2.dimensions.z**2 + mPTv2.dimensions.y**2 + mPTv2.dimensions.x**2) ### Output file path; insert correct file path here! output_file = open('C:\\..\\..\\Tyrannosaurus_output.txt', 'a') ### statistics bar height = 0 if gape smaller than gape of resting length if(gape < resting_gape): bar_mAMES1.dimensions.z = 0 bar_mAMES2.dimensions.z = 0 bar_mAMEM1.dimensions.z = 0 bar_mAMEM2.dimensions.z = 0 bar_mAMEP1.dimensions.z = 0 bar_mAMEP2.dimensions.z = 0 bar_mPSTs1.dimensions.z = 0 bar_mPSTp1.dimensions.z = 0 bar_mAMP1.dimensions.z = 0 bar_mAMP2.dimensions.z = 0 bar_mPTd1.dimensions.z = 0 bar_mPTd2.dimensions.z = 0 bar_mPTv1.dimensions.z = 0 bar_mPTv2.dimensions.z = 0 if(gape == resting_gape): rest_length_mAMES1 = curr_dim_mAMES1 rest_length_mAMES2 = curr_dim_mAMES2 rest_length_mAMEM1 = curr_dim_mAMEM1 rest_length_mAMEM2 = curr_dim_mAMEM2 rest_length_mAMEP1 = curr_dim_mAMEP1 rest_length_mAMEP2 = curr_dim_mAMEP2 rest_length_mPSTs1 = curr_dim_mPSTs1 rest_length_mPSTp1 = curr_dim_mPSTp1 rest_length_mAMP1 = curr_dim_mAMP1 rest_length_mAMP2 = curr_dim_mAMP2 rest_length_mPTd1 = curr_dim_mPTd1 rest_length_mPTd2 = curr_dim_mPTd2 rest_length_mPTv1 = curr_dim_mPTv1 rest_length_mPTv2 = curr_dim_mPTv2 ### Preparing output line with calculated extension ratios if(gape >= resting_gape): text = 'Nr. ' + str(gape) + ';' + str(curr_dim_mAMES1 / rest_length_mAMES1 * 100) + ';' + str(curr_dim_mAMES2 / rest_length_mAMES2 * 100) + ';' + str(curr_dim_mAMEM1 / rest_length_mAMEM1 * 100) + ';' + str(curr_dim_mAMEM2 / rest_length_mAMEM2 * 100) + ';' + str(curr_dim_mAMEP1 / rest_length_mAMEP1 * 100) + ';' + str(curr_dim_mAMEP2 / rest_length_mAMEP2 * 100) + ';' + str(curr_dim_mPSTs1 / rest_length_mPSTs1 * 100) + ';' + str(curr_dim_mPSTp1 / rest_length_mPSTp1 * 100) + ';' + str(curr_dim_mAMP1 / rest_length_mAMP1 * 100) + ';' + str(curr_dim_mAMP2 / rest_length_mAMP2 * 100) + ';' + str(curr_dim_mPTd1 / rest_length_mPTd1 * 100) + ';' + str(curr_dim_mPTd2 / rest_length_mPTd2 * 100) + ';' + str(curr_dim_mPTv1 / rest_length_mPTv1 * 100) + ';' + str(curr_dim_mPTv2 / rest_length_mPTv2 * 100) + '\n' output_file.write(text) ### Change colour if specific stretch factors are reached if curr_dim_mAMES1 >= (stretch_factor1 * rest_length_mAMES1): material_colour_mAMES1.diffuse_color = material_colour_bar_mAMES1.diffuse_color = (0.0, 1.0, 0.0) if curr_dim_mAMES1 >= (stretch_factor2 * rest_length_mAMES1): material_colour_mAMES1.diffuse_color = material_colour_bar_mAMES1.diffuse_color = (1.0, 0.75, 0.0) if curr_dim_mAMES1 >= (stretch_factor3 * rest_length_mAMES1): material_colour_mAMES1.diffuse_color = material_colour_bar_mAMES1.diffuse_color = (1.0, 0.0, 0.0) if curr_dim_mAMES2 >= (stretch_factor1 * rest_length_mAMES2): material_colour_mAMES2.diffuse_color = material_colour_bar_mAMES2.diffuse_color = (0.0, 1.0, 0.0) if curr_dim_mAMES2 >= (stretch_factor2 * rest_length_mAMES2): material_colour_mAMES2.diffuse_color = material_colour_bar_mAMES2.diffuse_color = (1.0, 0.75, 0.0) if curr_dim_mAMES2 >= (stretch_factor3 * rest_length_mAMES2): material_colour_mAMES2.diffuse_color = material_colour_bar_mAMES2.diffuse_color = (1.0, 0.0, 0.0) if curr_dim_mAMEM1 >= (stretch_factor1 * rest_length_mAMEM1): material_colour_mAMEM1.diffuse_color = material_colour_bar_mAMEM1.diffuse_color = (0.0, 1.0, 0.0) if curr_dim_mAMEM1 >= (stretch_factor2 * rest_length_mAMEM1): material_colour_mAMEM1.diffuse_color = material_colour_bar_mAMEM1.diffuse_color = (1.0, 0.75, 0.0) if curr_dim_mAMEM1 >= (stretch_factor3 * rest_length_mAMEM1): material_colour_mAMEM1.diffuse_color = material_colour_bar_mAMEM1.diffuse_color = (1.0, 0.0, 0.0) if curr_dim_mAMEM2 >= (stretch_factor1 * rest_length_mAMEM2): material_colour_mAMEM2.diffuse_color = material_colour_bar_mAMEM2.diffuse_color = (0.0, 1.0, 0.0) if curr_dim_mAMEM2 >= (stretch_factor2 * rest_length_mAMEM2): material_colour_mAMEM2.diffuse_color = material_colour_bar_mAMEM2.diffuse_color = (1.0, 0.75, 0.0) if curr_dim_mAMEM2 >= (stretch_factor3 * rest_length_mAMEM2): material_colour_mAMEM2.diffuse_color = material_colour_bar_mAMEM2.diffuse_color = (1.0, 0.0, 0.0) if curr_dim_mAMEP1 >= (stretch_factor1 * rest_length_mAMEP1): material_colour_mAMEP1.diffuse_color = material_colour_bar_mAMEP1.diffuse_color = (0.0, 1.0, 0.0) if curr_dim_mAMEP1 >= (stretch_factor2 * rest_length_mAMEP1): material_colour_mAMEP1.diffuse_color = material_colour_bar_mAMEP1.diffuse_color = (1.0, 0.75, 0.0) if curr_dim_mAMEP1 >= (stretch_factor3 * rest_length_mAMEP1): material_colour_mAMEP1.diffuse_color = material_colour_bar_mAMEP1.diffuse_color = (1.0, 0.0, 0.0) if curr_dim_mAMEP2 >= (stretch_factor1 * rest_length_mAMEP2): material_colour_mAMEP2.diffuse_color = material_colour_bar_mAMEP2.diffuse_color = (0.0, 1.0, 0.0) if curr_dim_mAMEP2 >= (stretch_factor2 * rest_length_mAMEP2): material_colour_mAMEP2.diffuse_color = material_colour_bar_mAMEP2.diffuse_color = (1.0, 0.75, 0.0) if curr_dim_mAMEP2 >= (stretch_factor3 * rest_length_mAMEP2): material_colour_mAMEP2.diffuse_color = material_colour_bar_mAMEP2.diffuse_color = (1.0, 0.0, 0.0) if curr_dim_mPSTs1 >= (stretch_factor1 * rest_length_mPSTs1): material_colour_mPSTs1.diffuse_color = material_colour_bar_mPSTs1.diffuse_color = (0.0, 1.0, 0.0) if curr_dim_mPSTs1 >= (stretch_factor2 * rest_length_mPSTs1): material_colour_mPSTs1.diffuse_color = material_colour_bar_mPSTs1.diffuse_color = (1.0, 0.75, 0.0) if curr_dim_mPSTs1 >= (stretch_factor3 * rest_length_mPSTs1): material_colour_mPSTs1.diffuse_color = material_colour_bar_mPSTs1.diffuse_color = (1.0, 0.0, 0.0) if curr_dim_mPSTp1 >= (stretch_factor1 * rest_length_mPSTp1): material_colour_mPSTp1.diffuse_color = material_colour_bar_mPSTp1.diffuse_color = (0.0, 1.0, 0.0) if curr_dim_mPSTp1 >= (stretch_factor2 * rest_length_mPSTp1): material_colour_mPSTp1.diffuse_color = material_colour_bar_mPSTp1.diffuse_color = (1.0, 0.75, 0.0) if curr_dim_mPSTp1 >= (stretch_factor3 * rest_length_mPSTp1): material_colour_mPSTp1.diffuse_color = material_colour_bar_mPSTp1.diffuse_color = (1.0, 0.0, 0.0) if curr_dim_mAMP1 >= (stretch_factor1 * rest_length_mAMP1): material_colour_mAMP1.diffuse_color = material_colour_bar_mAMP1.diffuse_color = (0.0, 1.0, 0.0) if curr_dim_mAMP1 >= (stretch_factor2 * rest_length_mAMP1): material_colour_mAMP1.diffuse_color = material_colour_bar_mAMP1.diffuse_color = (1.0, 0.75, 0.0) if curr_dim_mAMP1 >= (stretch_factor3 * rest_length_mAMP1): material_colour_mAMP1.diffuse_color = material_colour_bar_mAMP1.diffuse_color = (1.0, 0.0, 0.0) if curr_dim_mAMP2 >= (stretch_factor1 * rest_length_mAMP2): material_colour_mAMP2.diffuse_color = material_colour_bar_mAMP2.diffuse_color = (0.0, 1.0, 0.0) if curr_dim_mAMP2 >= (stretch_factor2 * rest_length_mAMP2): material_colour_mAMP2.diffuse_color = material_colour_bar_mAMP2.diffuse_color = (1.0, 0.75, 0.0) if curr_dim_mAMP2 >= (stretch_factor3 * rest_length_mAMP2): material_colour_mAMP2.diffuse_color = material_colour_bar_mAMP2.diffuse_color = (1.0, 0.0, 0.0) if curr_dim_mPTd1 >= (stretch_factor1 * rest_length_mPTd1): material_colour_mPTd1.diffuse_color = material_colour_bar_mPTd1.diffuse_color = (0.0, 1.0, 0.0) if curr_dim_mPTd1 >= (stretch_factor2 * rest_length_mPTd1): material_colour_mPTd1.diffuse_color = material_colour_bar_mPTd1.diffuse_color = (1.0, 0.75, 0.0) if curr_dim_mPTd1 >= (stretch_factor3 * rest_length_mPTd1): material_colour_mPTd1.diffuse_color = material_colour_bar_mPTd1.diffuse_color = (1.0, 0.0, 0.0) if curr_dim_mPTd2 >= (stretch_factor1 * rest_length_mPTd2): material_colour_mPTd2.diffuse_color = material_colour_bar_mPTd2.diffuse_color = (0.0, 1.0, 0.0) if curr_dim_mPTd2 >= (stretch_factor2 * rest_length_mPTd2): material_colour_mPTd2.diffuse_color = material_colour_bar_mPTd2.diffuse_color = (1.0, 0.75, 0.0) if curr_dim_mPTd2 >= (stretch_factor3 * rest_length_mPTd2): material_colour_mPTd2.diffuse_color = material_colour_bar_mPTd2.diffuse_color = (1.0, 0.0, 0.0) if curr_dim_mPTv1 >= (stretch_factor1 * rest_length_mPTv1): material_colour_mPTv1.diffuse_color = material_colour_bar_mPTv1.diffuse_color = (0.0, 1.0, 0.0) if curr_dim_mPTv1 >= (stretch_factor2 * rest_length_mPTv1): material_colour_mPTv1.diffuse_color = material_colour_bar_mPTv1.diffuse_color = (1.0, 0.75, 0.0) if curr_dim_mPTv1 >= (stretch_factor3 * rest_length_mPTv1): material_colour_mPTv1.diffuse_color = material_colour_bar_mPTv1.diffuse_color = (1.0, 0.0, 0.0) if curr_dim_mPTv2 >= (stretch_factor1 * rest_length_mPTv2): material_colour_mPTv2.diffuse_color = material_colour_bar_mPTv2.diffuse_color = (0.0, 1.0, 0.0) if curr_dim_mPTv2 >= (stretch_factor2 * rest_length_mPTv2): material_colour_mPTv2.diffuse_color = material_colour_bar_mPTv2.diffuse_color = (1.0, 0.75, 0.0) if curr_dim_mPTv2 >= (stretch_factor3 * rest_length_mPTv2): material_colour_mPTv2.diffuse_color = material_colour_bar_mPTv2.diffuse_color = (1.0, 0.0, 0.0) ### Calculation of statistics bar height according to extension factor. 3.74 equals 2005, defined by modelling setup bar_mAMES1.dimensions.z = 3.74 * ((curr_dim_mAMES1/rest_length_mAMES1) - 1.0) bar_mAMES2.dimensions.z = 3.74 * ((curr_dim_mAMES2/rest_length_mAMES2) - 1.0) bar_mAMEM1.dimensions.z = 3.74 * ((curr_dim_mAMEM1/rest_length_mAMEM1) - 1.0) bar_mAMEM2.dimensions.z = 3.74 * ((curr_dim_mAMEM2/rest_length_mAMEM2) - 1.0) bar_mAMEP1.dimensions.z = 3.74 * ((curr_dim_mAMEP1/rest_length_mAMEP1) - 1.0) bar_mAMEP2.dimensions.z = 3.74 * ((curr_dim_mAMEP2/rest_length_mAMEP2) - 1.0) bar_mPSTs1.dimensions.z = 3.74 * ((curr_dim_mPSTs1/rest_length_mPSTs1) - 1.0) bar_mPSTp1.dimensions.z = 3.74 * ((curr_dim_mPSTp1/rest_length_mPSTp1) - 1.0) bar_mAMP1.dimensions.z = 3.74 * ((curr_dim_mAMP1/rest_length_mAMP1) - 1.0) bar_mAMP2.dimensions.z = 3.74 * ((curr_dim_mAMP2/rest_length_mAMP2) - 1.0) bar_mPTd1.dimensions.z = 3.74 * ((curr_dim_mPTd1/rest_length_mPTd1) - 1.0) bar_mPTd2.dimensions.z = 3.74 * ((curr_dim_mPTd2/rest_length_mPTd2) - 1.0) bar_mPTv1.dimensions.z = 3.74 * ((curr_dim_mPTv1/rest_length_mPTv1) - 1.0) bar_mPTv2.dimensions.z = 3.74 * ((curr_dim_mPTv2/rest_length_mPTv2) - 1.0) output_file.close() ### Render current scene bpy.data.scenes['Scene'].render.filepath = file_name bpy.ops.render.render(animation=False, write_still=True, use_viewport=True)