How to flatten terrain?

Is there a way how to flatten the selected mesh? What I want to do is to bring the vertexes down to blue axis = 0 and/ or to remake the mash to 5x5 squares.

Edit:
I see there exists
Vertex Tools
but this one is payed. Is there something for free?

Copy and paste into Ruby Console and press Enter

mod = Sketchup.active_model
ent = mod.active_entities
sel = mod.selection
vrts=;vecs=
sel.grep(Sketchup::Edge).each{|e|vrts<<e.vertices}
vrts.flatten!;vrts.uniq!
puts “transforming vertices”
vrts.each{|v| vecs<<[0,0,-v.position.z]}
ent.transform_by_vectors(vrts,vecs)
puts “done”

1 Like

Thank you! Actually I tried to write this in Ruby, but I had problem to find out how to access the vertex. This is the answer. Gonna Try.

Why do you use
sel.grep(Sketchup::Edge).
insted sel.grep(Sketchup::Vertex).
? I thought it should be possible to filter the vertexes directly…

Edit:
I have pasted it line by line to Ruby console and it works fine!

Thank you

vrts=[];vecs=[];Sketchup.active_model.selection.grep(Sketchup::Edge).each{|e|vrts<<e.vertices};vrts.flatten!;vrts.uniq!
vrts.each{|v| vecs<<[0,0,-v.position.z]};Sketchup.active_model.active_entities.transform_by_vectors(vrts,vecs)

Up to SU2016 at least, Vertices are not directly addressable. Would be nice if they were.

Now I understand why we cannot access vertices. Because they are part of more complicated entities like edges and faces. If I would move a vertex directly (to write its coord) then it would effect the edge and face, angle and length of the face. That would break the rules and cause a lot problems. It makes sense that every edges has two vertices so when I want to change it, I need to change the edge and face together.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.