grrover
grrover

Reputation: 13

How do I delete turtle pen lines in netlogo?

I want to delete only turtle pen lines from a halfway point in a model run. The "clear-drawing" primitive seems to achieve that, but my problem is that I can't run it directly from an agent, or use "ask observer [clear-drawing]". Is there a way to trigger this observer command from an agent context (I expect not), or is there another way of erasing turtle pen lines? My solution to re-draw using pens having the background color is rubbish.

Upvotes: 1

Views: 2024

Answers (1)

Seth Tisue
Seth Tisue

Reputation: 30498

Instead of redrawing using the background color, use pen-erase. If that's equally “rubbish”, perhaps you want something more like the answers here? NetLogo turtles leaving a trail that fades with time

About clear-drawing being observer-only though, that seems like it shouldn't be too hard to work around, something like:

to go
  let clear? false
  ask turtles [
    ...
    if ... [
      set clear? true
    ]
    ...
  ]
  if clear? [ clear-drawing ]
  tick
end

Upvotes: 2

Related Questions