# Deleting vertices of a polygon that is dynamically added with RigidPolygon() command

Hm... where to start? ;-)

So, in short: a have a polygon (named "plocica") which I dynamically duplicate using RigidPolygon() command. Here's a GeoGebra code (On Click):

[code]

index=index+1; --> a number for tracking the number of dynamically added tiles

ploca=RigidPolygon(plocica, 3, 0);

SetLayer(ploca, 1);

SetColor( ploca, 1, 0, 0);

SetLineThickness( ploca, 2);

SetFilling( ploca, 0.75);

Rename(Vertex(ploca, 1),"P_"+CopyFreeObject(index));

Rename(Vertex(ploca, 2),"R_"+CopyFreeObject(index));

Rename(Vertex(ploca, 3),"S_"+CopyFreeObject(index));

Rename(Vertex(ploca, 4),"T_"+CopyFreeObject(index));

Rename(ploca,"ploca"+CopyFreeObject(index));

[/code]

When you make a copy this way, a new polygon is added to construction, four polygon vertices and four polygon sides as well. If I delete a polygon, the sides are automatically deleted, but this is not the case with the vertices. Since I don't know the names that will GeoGebra automatically give to the new vertices...

I've tried to reach them with the Vertex() command. But now I have 8 point for each new added polygon!!! :‑( See pic in attachment.

I want to be able to delete all added objects and the polygon vertices as well. I want to do it with GeoGebra scripting, not using JavaScript.

Basically, I don't have a clue at the moment how to reach the new added polygon's vertices names to be able to delete them afterwards.

Thanks in advance

Best regards

Aleksandra-Maria Vuković

Hi,

I have one solution (see ggb attached) but the type of command like : SetColor( ploca, 1, 0, 0); does not work.

Alain.

I think that's possible (robustly) only with JavaScript, eg http://dev.geogebra.org/exa...

puedes crear una copia de los vertices del poligono y entonces usar rigidpolygon(point..........point)

cuando necesites borrar el poligono rigido te basta con borrar los puntos, de los cuales, ahora, sí sabes el nombre

Loading...Comments have been locked on this page!