Guest User

Untitled

a guest
Feb 14th, 2011
142
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mydir="./"
  2. outforcefile1 = mydir .. "ForceResults_up.txt"
  3. outforcefile2 = mydir .. "ForceResults_side.txt"
  4. open(mydir .. "Forcetest.fem")
  5.  
  6. mi_saveas(mydir .. "temp.fem") --make a temp file for the processing
  7.  
  8. -- the step size
  9. increment = 1
  10.  
  11. -- determines the total distance to move up
  12. distance = 50
  13.  
  14. -- calculates the amount of steps
  15. steps = distance/increment
  16.  
  17. -- this part empties an already exsting file.
  18. handle = openfile(outforcefile1,"w")
  19. write(handle, "")
  20. closefile(handle)
  21.  
  22. handle = openfile(outforcefile2,"w")
  23. write(handle, "")
  24. closefile(handle)
  25.    
  26.     -- loop that handles up motion
  27.     for n=0,steps do
  28.         mi_clearselected()
  29.         mi_selectgroup(1) --select the TT shape
  30.         mi_movetranslate(0, increment) --move up
  31.  
  32.         mi_analyze(1)
  33.         mi_loadsolution()
  34.         mo_groupselectblock(1)
  35.        
  36.         forceY = mo_blockintegral(19)
  37.         position = n
  38.        
  39.         handle = openfile(outforcefile1,"a")
  40.         write(handle, position, "\t", forceY, "\n")
  41.         closefile(handle)
  42.     end
  43.    
  44.     -- loop that handles side motion
  45.     for n=0,steps do
  46.         mi_clearselected()
  47.         mi_selectgroup(x) -- replace x by the needed group number
  48.         mi_movetranslate(-increment, 0) --negative sign is left movement, no sign is right movement
  49.  
  50.         mi_analyze(1)
  51.         mi_loadsolution()
  52.         mo_groupselectblock(1)
  53.        
  54.         forceY = mo_blockintegral(19)
  55.         position = n
  56.        
  57.         handle = openfile(outforcefile2,"a")
  58.         write(handle, position, "\t", forceY, "\n")
  59.         closefile(handle)
  60.     end
RAW Paste Data