Sg2.9
Annotator Thread
Recent RSS
Annotator Thread
From:  Terry
Date:  19. November 2006, 12:16

Hi guys! Great plugin.

I'm trying to get Annotators to work. There is a complex interaction between Illustrator and the Annotators. The process is not very clear.

If you get it wrong you end up with stale copies of previous annotations being left on the screen.

Below are two simple scripts which are an example of the problem. The second draws a large triangle in a fixed position. The colo(u)r cycles every draw operation. Try to scroll around, especially with a mouse-scroll-wheel!

The first is to clear the annotations so that you can remove the effects being redrawn

  • --

//1. CleanAnnotations.js
Annotator.disposeAll();

//----
//2. Annotate.js
//-----------------------
print("About to register annotator");

var annotator = new Annotator();
var count=0;

var drawHook = function drawHookFun(drawer,view){
var myBounds=drawer.getBoundsRect();

var point = drawer.getOrigin();

++count;

print(":::DRAW::: Count: "+count);

print("My bounds: "+myBounds);

print("Update rect: " +drawer.getUpdateRect());
print("Clip rect: " +drawer.getClipRect());

var knownBounds = new Rectangle(400,100,500,500);

var artworkBounds= view.getBounds();

if((count %2)==0) {
print("Clear");
drawer.setColor(13);
drawer.drawUpArrow(400,100,500,500);
}
else {
print("Fill");
drawer.setColor(0);

drawer.drawUpArrow(400,100,500,500);
}

print("Done draw().");
};

var invalidateHook = function invalidateHookFun(){
print(":::INVALIDATE::: Called");

print(":::INVALIDATE::: Finished");
};

annotator.setOnDraw(drawHook);

annotator.setOnInvalidate(invalidateHook);

annotator.setActive(true);
print("Set annotator active");

Re: Annotator Thread
From:  Terry
Date:  19. November 2006, 12:54

P.S. I was appealing for anyone else out there to let the thread know the invalidate/cleanup process.

Thx, Terry.

Re: Annotator Thread
From:  Terry
Date:  19. November 2006, 17:24

Watch this space --> Invalidate() and sADMDialog->InvalidateRect()
[2] http://msdn2.microsoft.com/en-us/library/ms534893.aspx
[3] http://oehive.org/book/export/html/391 - see How to force a repaint?

Re: Annotator Thread
From:  Jürg Lehni
Date:  19. November 2006, 21:24

Hi Terry,

Great to see that someone dares to play around with this undocumented feature.

I will have to explore it more on Windows. The problems you are experiencing might be due to the fact that I am actually abusing a ADM Drawer for drawing into a AI Document. Normally, an annotator just gives you a platform dependent viewport handle. I figured out that constructing an ADM Drawer around this actually seems to be working on both platforms, but it might be that there are problems on Windows linked to this "hack"...

I will look into this in more detail soon.

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Sketchy Structures 04.11.10