Jump to content

Script help - avg. vertex height


BrianKitts
 Share

Recommended Posts

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 by BrianKitts
Link to comment
Share on other sites

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 by molson
Link to comment
Share on other sites

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 by BrianKitts
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...