I've been wondering this also for a while, and after I read your question I decided to make it my goal to figure it out, and I think I've got something that works pretty well.
A little credit to Kris_Inv2013 on the AutoDesk forums at http://forums.autodesk.com/t5/Invent...e/td-p/4322149
He wrote his rule to set a specific scale based on being bigger or smaller than a certain size, but if you are like me, my part might be 3" long or 120" long, so a simple rule like that doesn't work.
So the code I wrote was
Code:
ActiveSheet.View("VIEW15").Scale=(1/(Parameter("Canopy.ipt.Full_Width")/3.5))
ActiveSheet.View("VIEW12").Scale=(1/(Parameter("Canopy.ipt.Full_Width")/3.5))
ActiveSheet.View("VIEW22").Scale=(1/(Parameter("Canopy.ipt.Full_Width")/3.5))
The way I came up with the 3.5 is that is roughly the size I want my part to be on the drawing after it is printed out. I took a measurement of my print window, came up with about 10.5" (we use legal paper), I divided it by 3 because I wanted the part to take up about half the space with room on both sides to fit 2 parts side by side.
So then I referenced the parameter from my part file that shows the overall width of my part, and divided it by 3.5 In this example it came out to about 10.25, because the part was 35.875" wide. I then took the reciprocal of this number (or 1 divided by the number) and that gives me the scale value. The code then sets the scale to this value and it worked perfect. I went back and changed my part to 60" wide, and it updated and fit perfect on the sheet, I had to move it left or right a little bit, but it still worked much better than having to "guess and check" before.
Hope this helped!
-Daniel