DrawAction problem

I am try to use the Drawaction command but I can't figure out how to do what I need.

I would like to cancel a line drawn in a Graph and substitute it with another line

Here part of the code I wrote:

here it draw the line:

SetDrawEnv gstart,gname= name
SetDrawEnv/W=$namegraph linefgc= (65280,0,0)
SetDrawEnv/W=$namegraph xcoord= bottom,ycoord= left
DrawLine/W=$namegraph 0,a1,a
SetDrawEnv gstop

here to cancel the line and substitute it (this is the part that does not work)

Drawaction/W=$namegraph getgroup=lineasoglia, delete, begininsert
SetDrawEnv gstart,gname= name
SetDrawEnv/W=$namegraph linefgc= (65280,0,0)
SetDrawEnv/W=$namegraph xcoord= bottom,ycoord= left
DrawLine/W=$nomegraph 0,a,1,a
SetDrawEnv gstop
DrawAction endinsert

What is the problem?
Thanks
Is the name of the group you are deleting really "lineasoglia", or is it really just "name".

From the extract of code you posted it is hard to tell, so posting the entire experiment or procedure file is better.

You also should provide the version of Igor you are using.

Also, you don't say exactly what isn't working.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.
Thanks for the reply ,
I found the error just after posting the question
In the first drawing was missing the name of the window...