Newbie: face destroyed after transformation ?!?!?

The reason a new face is made is because the moving of the one vertex likely splits the quad face into 2 triangular faces.

You need to take an array snapshot of the collection of faces before, and then subtract it from a set of faces afterward (being sure to removed any invalid faces.)

ents = Sketchup.active_model.active_entities
before = ents.grep(Sketchup::Face)
# do the transform here
new_faces = ents.grep(Sketchup::Face) - before
new_faces.reject! { |face| !face.valid? }
# now pick through the new faces to find the one you need

You can use the methods that are added by the Enumerable module to search arrays and other collections in Ruby.


FYI … you are referencing the face object as "square" not naming it. (In Object Oriented Programming these are specifically reference identifiers.)

Faces do not have a name property, but some complex objects like groups, instances and component definitions do.


How to post code in the forums … [How to] Post correctly formatted and colorized code on the forum?

ADD: BTW, your snippet above does not show transforming a vertex.