Greeting to all,
I’ve noticed that if I create a face, then transform one of the face’s vertices to a new location, the transformation does indeed work, the face changes shape on the screen just as I would expect, BUT it seems that the original face is deleted and replaced by a new one - I can no longer reference the original face by the name that I originally gave it. The code is down below.
NOTE that I think the following thread refers to this issue…
Although the face is indeed successfully transformed on the screen, I’ve noticed that the new face is assigned a new entityID after the vertex is transformed. So my question is … how do I reference a transformed face if the original face and face name are destroyed after the transformation? Do I have to keep track of the entityIDs? How do most folks handle such a situation?
THANKS!
mod = Sketchup.active_model # Open model
ent = mod.entities # All entities in model
#Create the points of the square...
pt1 = [0,0,0]
pt2 = [5,0,0]
pt3 = [5,5,0]
pt4 = [0,5,0]
#Draw the face, and name it "square"...
square = ent.add_face pt1, pt2, pt3, pt4
#Do the transformation...
ptx = square.vertices[0]
t = Geom::Transformation.new([1,0,0])
ent.transform_entities(t, ptx)
#But then the following generates a "reference to deleted Face" error...
ptx = square.vertices[0]