I have a function to create a face then use face.followme to build a model. The function is called several times. The all entities of the active model are deleted in each time before the function is invoked. It works well in the first, and second times calling. But Sketchup crashes when calling the function in the third, or the fourth time.
entities = Sketchup.active_model.entities.clear!
face = Sketchup.active_model.entities.add_face(face_points)
if face
start = edges[0].start.position
p1 = Geom::Point3d.new(start.x, start.y, start.z)
p2 = Geom::Point3d.new(start.x, start.y, start.z + height)
edge1 = Sketchup.active_model.entities.add_line(p1, p2)
wall_group = Sketchup.active_model.entities.add_group(face)
face.followme([edge1]) # Sketchup will not crash if comment out this line.
edge1.hidden = true if !edge1.deleted?
end
If commenting out “face.followme([edge1])”, Sketchup does not crash even calling the function many times. So I guess that the followme method makes Sketchup crashed. What wrong with my code?