I did f.pushpull and changed color on it
But It was applied to the lower face
Not upper face
I want to change the color of upper face after pushpull
I did f.pushpull and changed color on it
But It was applied to the lower face
Not upper face
I want to change the color of upper face after pushpull
You need to use a common coding pattern that takes an array “snapshot” of the entities before and then subtracts it from an array afterward. The result of the array subtraction is a subarray of only the newly added entities.
Something like this …
ents = face.parent.entities
before = ents.grep(Sketchup::Face)
face.pushpull(some_distance)
new_faces = ents.grep(Sketchup::Face) - before
# Now you need to search through new_faces for the one
# whose normal vector matches the one you want.
upper_face = new_faces.find {|f| f.normal == face.normal.reverse }
# Always test that the result is not nil which means not found:
unless upper_face.nil?
# upper_face was found, use it ...
upper_face.material = "Red"
end