BrianKitts Posted November 30, 2009 Share Posted November 30, 2009 (edited) I need to calculate the mean average for the elevation as it hits a building we are working on. I don't have the time to really stop what I'm doing today and dig through syntax to get this worked out so if anyone knows off hand what I'm thinking I'd appreciate the help.... Process I'm thinking of.... 1. create a terrain mesh from the civil site info 2. cutout the building footprint from the terrain mesh 3. select the border of the cutout and create a spline from the open edge segments. 4. run this new script that will count the vertices in the spline, loop through the verts adding all of their Z heights values into a temp variable, then output that average of total Z heights divided by total verts. seems logical, anyone have a better solution? thanks in advance.... Edited November 30, 2009 by BrianKitts Link to comment Share on other sites More sharing options...
molson Posted November 30, 2009 Share Posted November 30, 2009 (edited) select the object type the following into the max script listener selection.center press shift -enter to execute Is that what you needed? Nope, i don't think thats what you need I need to calculate the mean average for the elevation as it hits a building we are working on. I don't have the time to really stop what I'm doing today and dig through syntax to get this worked out so if anyone knows off hand what I'm thinking I'd appreciate the help.... Process I'm thinking of.... 1. create a terrain mesh from the civil site info 2. cutout the building footprint from the terrain mesh 3. select the border of the cutout and create a spline from the open edge segments. 4. run this new script that will count the vertices in the spline, loop through the verts adding all of their Z heights values into a temp variable, then output that average of total Z heights divided by total verts. seems logical, anyone have a better solution? thanks in advance.... Edited November 30, 2009 by molson Link to comment Share on other sites More sharing options...
molson Posted November 30, 2009 Share Posted November 30, 2009 Select your object. this assumes your spline has one line in it. then run this script: ( local obj = selection[1] local allZ = 0 for v in 1 to numknots obj do ( local vpos = getKnotPoint obj 1 v allZ += vpos.z ) allZ / numknots obj ) Link to comment Share on other sites More sharing options...
BrianKitts Posted November 30, 2009 Author Share Posted November 30, 2009 (edited) Awesome, I made just a tiny tweak so that my answer gets converted to feet, but it worked perfect....thanks for the quick reply!! allZ / numknots obj / 12 sidenote: there is a limit on the vertex count that this works with (around 30)....but I was able to simplify my spline down to the major elevation change points to get a close enough answer for what I was after. Edited November 30, 2009 by BrianKitts Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now