Equal Scale Replicate

This python script can be run to equalise the scaling of replicated objects. First you replicate an object in the usual way in Vue (Using Edit -> Replicate) and then you run this script. If you applied a scale to any of the dimensions it will alter the way they are scaled. Vue’s normal scaling for replicate is to scale each object by applying the scale factor to the previous object created. This script sets the scaling to be uniform from one object to the next. This allows stepped pyramids and other similar structures to be quickly created.

  1. ######################################################################################################
  2. # Equally stepped scalling for objects produced using Vue's replicate feature
  3. #
  4. # - equalreplicate.py
  5. # - By Mark Caldwell
  6. # - Version 0.1.0
  7. # - 7th January 2008
  8. # - Copyright Mark Caldwell 2008
  9. # - Tested with Vue 6 Infinite on a PC
  10. #
  11. # How to use in 3 easy steps
  12. #
  13. # 1. Download and unzip this file onto your computer
  14. #
  15. # 2. Replicate an object in Vue
  16. #
  17. # 3. With the replicated objects still selected run this script
  18. #
  19. ######################################################################################################
  20.  
  21. count=CountSelectedObjects() # Count the number of objects selected
  22.  
  23. if count>2: # Check there are more than 2 objects so the script will do something
  24.  
  25. # Use 2nd and 3rd objects replicated as scale return from first object can be missleading
  26.  
  27. object=GetSelectedObjectByIndex(1) # Get the second object
  28. xyz1=object.GetScale() # Get the scale of the second object
  29. object=GetSelectedObjectByIndex(2) # Get the third object
  30. xyz2=object.GetScale() # Get the scale of the third object
  31.  
  32. sfx=xyz1[0]/xyz2[0] # Scale factor for x to restore to full size
  33. sfy=xyz1[1]/xyz2[1] # Scale factor for y to restore to full size
  34. sfz=xyz1[2]/xyz2[2] # Scale factor for z to restore to full size
  35.  
  36. stepx=1-(1/sfx) # Calculate the step scale for equal steps in x
  37. stepy=1-(1/sfy) # Calculate the step scale for equal steps in y
  38. stepz=1-(1/sfz) # Calculate the step scale for equal steps in z
  39.  
  40. for i in range(1,count): # Loop through the selected objects
  41. object=GetSelectedObjectByIndex(i) # Get the object
  42. object.ResizeAxis(sfx**(i+1),sfy**(i+1),sfz**(i+1)) # Scale it to unscaled size
  43. object.ResizeAxis(1-stepx*i,1-stepy*i,1-stepz*i) # Apply scaling for step
  44.  
  45. Refresh() # Refresh the display to show the effect of script running

impworks © Copyright Mark Caldwell 1996 - 2017