// // Jaap Stolk http://jwstolk.xs4all.nl/mill.htm jwstolk@gmail.com // // File : steel.pov // // Desciption: mechanics simulation of a steel construction (color test) // // all dimentions in meters !! // // Render instructions: // -------------------- // // First render as still with: -w160 -h120 -a -j +UA +FN // // Then as animation with: -w160 -h120 -a -j +UA +FN +kff500 // // Then as final image(es) with: -w800 -h600 +a0.3 -j +UA +FN +kff3 // // Then add black background. (I set my firefox background to black, load the image, then press print-screen...) // #version unofficial megapov 1; // (megaPov 1.2.1) #include "mechsim.inc" #declare scene_name = "steel"; // some material properties and different beam types: #declare E_steel = 200*1e9; // N/m^2 or pa //#declare E_aluminium = 70*1e9; // N/m^2 or pa //#declare A_box30x30x2 = ((30*30)-(26*26))*1e-6; // m^2 //#declare A_box40x40x3 = ((40*40)-(34*34))*1e-6; // m^2 //#declare A_box50x50x5 = ((50*50)-(40*40))*1e-6; // m^2 #declare A_U50x50x4 = ((50*50)-(42*46))*1e-6; // m^2 // choose a material and beam type: #declare E_beam = E_steel; // N/m^2 or pa #declare A_beam = A_U50x50x4; // m^2 // calculate stiffnes from elasticity and area: #declare stiffness_beam = E_beam*A_beam; // N/m #declare level0 = 45 / 1000.0; // bottom of frame #declare level1 = 405 / 1000.0; // top of frame #declare frameWidth = 770 / 1000.0; // top of frame #declare xSpacing0 = 0 / 1000.0; // center #declare xSpacing1 = 360 / 1000.0; #declare xSpacing2 = (360+360) / 1000.0; #declare xSpacing3 = (360+360+385)/ 1000.0; // end #declare damping_beam = stiffness_beam*0.01; // (i'm only interested in the static end result) #declare mass_load = 25; // kg global_settings { max_trace_level 10 assumed_gamma 1 mechsim { #if (clock_on) //-------------------------------------------- simulate mode: ---------------------------------------------------- gravity <0, 0, -9.81> method 1 step_count 10000 time_step 1/50000000 /* environment { // (I just fix 4 masses, instead of using an enviroment) object support_object stiffness 2400 damping 900 friction 0.01 method 1 } */ collision { off } topology { load_file concat(scene_name, "_", ".dat") save_file concat(scene_name, "_", ".dat") //str( current_frame , 0, 0) } #else //-------------------------------------------- generate mode: ---------------------------------------------------- topology { // front: // 0 --- 1 --- 2 --- 3 --- 4 --- 5 --- 6 // \ | / | \ | / | \ | / // \ | / | \ | / | \ | / // \ | / | \ | / | \ | / // 7 --- 8 --- 9 ---10 ---11 mass { < -xSpacing3, -frameWidth/2, level1 >, <0, 0, 0>, 0.02 mass 1 } // 0 mass { < -xSpacing2, -frameWidth/2, level1 >, <0, 0, 0>, 0.02 mass 1 } // 1 mass { < -xSpacing1, -frameWidth/2, level1 >, <0, 0, 0>, 0.02 mass 1 } // 2 mass { < xSpacing0, -frameWidth/2, level1 >, <0, 0, 0>, 0.06 mass mass_load } // 3 mass { < xSpacing1, -frameWidth/2, level1 >, <0, 0, 0>, 0.02 mass 1 } // 4 mass { < xSpacing2, -frameWidth/2, level1 >, <0, 0, 0>, 0.02 mass 1 } // 5 mass { < xSpacing3, -frameWidth/2, level1 >, <0, 0, 0>, 0.06 mass mass_load } // 6 mass { < -xSpacing2, -frameWidth/2, level0 >, <0, 0, 0>, 0.02 mass 1 } // 7 mass { < -xSpacing1, -frameWidth/2, level0 >, <0, 0, 0>, 0.02 mass 1 fixed true } // 8 mass { < xSpacing0, -frameWidth/2, level0 >, <0, 0, 0>, 0.02 mass 1 } // 9 mass { < xSpacing1, -frameWidth/2, level0 >, <0, 0, 0>, 0.02 mass 1 fixed true } // 10 mass { < xSpacing2, -frameWidth/2, level0 >, <0, 0, 0>, 0.02 mass 1 } // 11 // back: // 12---13 ---14 ---15 ---16 ---17 ---18 // \ | / | \ | / | \ | / // \ | / | \ | / | \ | / // \ | / | \ | / | \ | / // 19 ---20 ---21 ---22 ---23 mass { < -xSpacing3, frameWidth/2, level1 >, <0, 0, 0>, 0.02 mass 1 } // 12 mass { < -xSpacing2, frameWidth/2, level1 >, <0, 0, 0>, 0.02 mass 1 } // 13 mass { < -xSpacing1, frameWidth/2, level1 >, <0, 0, 0>, 0.02 mass 1 } // 14 mass { < xSpacing0, frameWidth/2, level1 >, <0, 0, 0>, 0.06 mass mass_load } // 15 mass { < xSpacing1, frameWidth/2, level1 >, <0, 0, 0>, 0.02 mass 1 } // 16 mass { < xSpacing2, frameWidth/2, level1 >, <0, 0, 0>, 0.02 mass 1 } // 17 mass { < xSpacing3, frameWidth/2, level1 >, <0, 0, 0>, 0.06 mass mass_load } // 18 mass { < -xSpacing2, frameWidth/2, level0 >, <0, 0, 0>, 0.02 mass 1 } // 19 mass { < -xSpacing1, frameWidth/2, level0 >, <0, 0, 0>, 0.02 mass 1 fixed true } // 20 mass { < xSpacing0, frameWidth/2, level0 >, <0, 0, 0>, 0.02 mass 1 } // 21 mass { < xSpacing1, frameWidth/2, level0 >, <0, 0, 0>, 0.02 mass 1 fixed true } // 22 mass { < xSpacing2, frameWidth/2, level0 >, <0, 0, 0>, 0.02 mass 1 } // 23 // front: // 0 --- 1 --- 2 --- 3 --- 4 --- 5 --- 6 // \ | / | \ | / | \ | / // \ | / | \ | / | \ | / // \ | / | \ | / | \ | / // 7 --- 8 --- 9 ---10 ---11 connection { 0, 1 stiffness stiffness_beam damping damping_beam } // top hor connection { 1, 2 stiffness stiffness_beam damping damping_beam } connection { 2, 3 stiffness stiffness_beam damping damping_beam } connection { 3, 4 stiffness stiffness_beam damping damping_beam } connection { 4, 5 stiffness stiffness_beam damping damping_beam } connection { 5, 6 stiffness stiffness_beam damping damping_beam } connection { 7, 8 stiffness stiffness_beam damping damping_beam } // bottom hor connection { 8, 9 stiffness stiffness_beam damping damping_beam } connection { 9, 10 stiffness stiffness_beam damping damping_beam } connection { 10, 11 stiffness stiffness_beam damping damping_beam } connection { 1, 7 stiffness stiffness_beam damping damping_beam } // vert connection { 2, 8 stiffness stiffness_beam damping damping_beam } connection { 3, 9 stiffness stiffness_beam damping damping_beam } connection { 4, 10 stiffness stiffness_beam damping damping_beam } connection { 5, 11 stiffness stiffness_beam damping damping_beam } connection { 0, 7 stiffness stiffness_beam damping damping_beam } // angled connection { 7, 2 stiffness stiffness_beam damping damping_beam } connection { 2, 9 stiffness stiffness_beam damping damping_beam } connection { 9, 4 stiffness stiffness_beam damping damping_beam } connection { 4, 11 stiffness stiffness_beam damping damping_beam } connection { 11, 6 stiffness stiffness_beam damping damping_beam } // back: // 12---13 ---14 ---15 ---16 ---17 ---18 // \ | / | \ | / | \ | / // \ | / | \ | / | \ | / // \ | / | \ | / | \ | / // 19 ---20 ---21 ---22 ---23 connection { 12, 13 stiffness stiffness_beam damping damping_beam } // top hor connection { 13, 14 stiffness stiffness_beam damping damping_beam } connection { 14, 15 stiffness stiffness_beam damping damping_beam } connection { 15, 16 stiffness stiffness_beam damping damping_beam } connection { 16, 17 stiffness stiffness_beam damping damping_beam } connection { 17, 18 stiffness stiffness_beam damping damping_beam } connection { 19, 20 stiffness stiffness_beam damping damping_beam } // bottom hor connection { 20, 21 stiffness stiffness_beam damping damping_beam } connection { 21, 22 stiffness stiffness_beam damping damping_beam } connection { 22, 23 stiffness stiffness_beam damping damping_beam } connection { 13, 19 stiffness stiffness_beam damping damping_beam } // vert connection { 14, 20 stiffness stiffness_beam damping damping_beam } connection { 15, 21 stiffness stiffness_beam damping damping_beam } connection { 16, 22 stiffness stiffness_beam damping damping_beam } connection { 17, 23 stiffness stiffness_beam damping damping_beam } connection { 12, 19 stiffness stiffness_beam damping damping_beam } // angled connection { 19, 14 stiffness stiffness_beam damping damping_beam } connection { 14, 21 stiffness stiffness_beam damping damping_beam } connection { 21, 16 stiffness stiffness_beam damping damping_beam } connection { 16, 23 stiffness stiffness_beam damping damping_beam } connection { 23, 18 stiffness stiffness_beam damping damping_beam } // front: // 0 --- 1 --- 2 --- 3 --- 4 --- 5 --- 6 // \ | / | \ | / | \ | / // \ | / | \ | / | \ | / // \ | / | \ | / | \ | / // 7 --- 8 --- 9 ---10 ---11 // back: // 12---13 ---14 ---15 ---16 ---17 ---18 // \ | / | \ | / | \ | / // \ | / | \ | / | \ | / // \ | / | \ | / | \ | / // 19 ---20 ---21 ---22 ---23 connection { 0, 12 stiffness stiffness_beam damping damping_beam } // connect front/back top connection { 1, 13 stiffness stiffness_beam damping damping_beam } connection { 2, 14 stiffness stiffness_beam damping damping_beam } connection { 3, 15 stiffness stiffness_beam damping damping_beam } connection { 4, 16 stiffness stiffness_beam damping damping_beam } connection { 5, 17 stiffness stiffness_beam damping damping_beam } connection { 6, 18 stiffness stiffness_beam damping damping_beam } connection { 7, 19 stiffness stiffness_beam damping damping_beam } // connect front/back bottom connection { 8, 20 stiffness stiffness_beam damping damping_beam } connection { 9, 21 stiffness stiffness_beam damping damping_beam } connection { 10, 22 stiffness stiffness_beam damping damping_beam } connection { 11, 23 stiffness stiffness_beam damping damping_beam } connection { 0, 13 stiffness stiffness_beam damping damping_beam } // connect front/back angled top connection { 1, 14 stiffness stiffness_beam damping damping_beam } connection { 2, 15 stiffness stiffness_beam damping damping_beam } connection { 3, 16 stiffness stiffness_beam damping damping_beam } connection { 4, 17 stiffness stiffness_beam damping damping_beam } connection { 5, 18 stiffness stiffness_beam damping damping_beam } connection { 8, 19 stiffness stiffness_beam damping damping_beam } // connect front/back angled bottom connection { 9, 20 stiffness stiffness_beam damping damping_beam } connection { 10, 21 stiffness stiffness_beam damping damping_beam } connection { 11, 22 stiffness stiffness_beam damping damping_beam } connection { 8, 14 stiffness stiffness_beam damping damping_beam } // prevent folding the tube connection { 10, 16 stiffness stiffness_beam damping damping_beam } save_file concat(scene_name, "_", ".dat") //str( current_frame , 0, 0) } #end //-------------------------------------------- end generate mode. ---------------------------------------------------- } } MechSim_Show_All_Objects(0.0075, false, 100000 , "") // stress texture the links //MechSim_Show_All_Objects(0.0075, false, -1 , "") // don't stress texture the links // print position data: text { ttf "timrom.ttf" "vertical position in mm:" 0.001, <0,0,0> rotate x*90 scale 0.06 translate <-1,0,0.8> texture { pigment { color rgb <0,1,0> } } } #declare mass_id = 0; #while(mass_id <= 6) text { ttf "timrom.ttf" concat( "mass ",str(mass_id,0,0)) 0.001, <0,0,0> rotate x*90 scale 0.06 translate mechsim:mass(mass_id):position+<-0.10,0,0.3> texture { pigment { color rgb <0,1,0> } } } text { ttf "timrom.ttf" str( (mechsim:mass(mass_id):position.z-level1)*1000,10,5) 0.001, <0,0,0> rotate x*90 scale 0.06 translate mechsim:mass(mass_id):position+<-0.15,0,0.25> texture { pigment { color rgb <0,1,0> } } } cylinder{ mechsim:mass(mass_id):position+<0,0,0.2>, mechsim:mass(mass_id):position, 0.003 texture { pigment { color rgb <0,1,0> } } } #set mass_id = mass_id + 1; #end camera { location <0, -5.5, 1.0> sky z up z right (4/3)*x look_at <0, 0, 0.3> angle 30 } light_source { <3.2, -1.0, 1.8>*100000 color rgb 2 } //background { color rgb <0,0,0> } sky_sphere { pigment { gradient z color_map { [0.00 rgb <0.8,0.9,1.0>] [0.10 rgb <0.6,0.7,1.0>] [0.25 rgb <0.2,0.3,0.8>] [0.26 rgb <0.8,0.9,1.0>] } } } #declare ground_patch = cylinder { <0,0,0>,<0,0,-0.001>,0.5 texture { pigment {cylindrical colour_map {[0, rgb 0][0.5, rgb <0,0.05,0> ]} rotate x*90 scale 0.5} finish { ambient 0 diffuse 1 specular 0 reflection 0} } } object { ground_patch scale <3,2,1> } // cone under fixed masses: union{ cone{ <-xSpacing1, -frameWidth/2, level0>,0,<-xSpacing1, -frameWidth/2, 0>,0.025 } cone{ < xSpacing1, -frameWidth/2, level0>,0,< xSpacing1, -frameWidth/2, 0>,0.025 } cone{ <-xSpacing1, frameWidth/2, level0>,0,<-xSpacing1, -frameWidth/2, 0>,0.025 } cone{ < xSpacing1, frameWidth/2, level0>,0,< xSpacing1, -frameWidth/2, 0>,0.025 } texture { pigment { color rgb <250/255, 210/255, 165/255>*1.5 } finish { ambient 0.05 diffuse 0.45 specular 0.2 } } } #declare stress_scale = union{ box{<0,0.001,0>,<1,0,0.05> texture { pigment { gradient x color_map { [ 0.00 color rgb<0.450, 0.750, 0.620> ] [ 0.25 color rgb<0.256, 0.430, 1.000> ] [ 0.50 color rgb<0.000, 0.000, 0.441> ] [ 0.75 color rgb<1.000, 0.456, 0.456> ] [ 1.00 color rgb<0.900, 0.800, 0.000> ] } } finish { ambient 0 diffuse 1 specular 0 reflection 0} } } text { ttf "timrom.ttf" "0" 0.001, <0,0,0> rotate x*90 scale 0.06 translate <0.5,0,0.06> texture { pigment { color rgb <0,1,0> } } } } object { stress_scale translate <-1.2,-0.8,0> }