Index: trunk/doc/user/06_feature/gpmi/rosetta/90_clock/ex.html =================================================================== --- trunk/doc/user/06_feature/gpmi/rosetta/90_clock/ex.html (nonexistent) +++ trunk/doc/user/06_feature/gpmi/rosetta/90_clock/ex.html (revision 8730) @@ -0,0 +1,49 @@ +Animated clock on an UI layer. +

+


+ +

Theory of operation

+ + +

Implementation

+Load packages the script depends on: + +

+Set up an exporter hid, storing the handle of each object created in +a global variable: +

+

+Set up global state variables: +

+

+Define a make_gc callback. It is called when a new graphic +context is created (e.g. for layers). An exporter is sort of a drawing +backend: pcb-rnd sets up gc's and draws on them. The first gc set up +should open the output file, the last gc closed should flush/close the file. +Define a destroy_gc callback for the latter. GCs are +destroyed at the end of the export process. Use global variable channel +to make sure the file is open/close only once (see TODO script context). +

+Define a set_layer callback that sets green_light to true if +layer name is "topasssembly", false otherwise. +

+Callback fill_circle is the workhorse: check if we have the green +light to emit lines, then convert coordinates and diameter to mm and +decide what format to use for printing a line for each filled circle. +

+Finally, bind all four callbacks to exporter events. + + Index: trunk/doc/user/06_feature/gpmi/rosetta/90_clock/index.html =================================================================== --- trunk/doc/user/06_feature/gpmi/rosetta/90_clock/index.html (nonexistent) +++ trunk/doc/user/06_feature/gpmi/rosetta/90_clock/index.html (revision 8730) @@ -0,0 +1,61 @@ + + +<-- back to the index of Rosetta examples +

animated clock on a UI layer

+Create and animate an analog clock on a dedicated UI layer. +

Example implementations

+awk +

Explanation, step by step

+Animated clock on an UI layer. +

+


+

Theory of operation

+ +

Implementation

+ Load packages the script depends on: + + +

Set up an exporter hid, storing the handle of each object created in a global variable: +

+ +

Set up global state variables: +

+ +

Define a +make_gc + callback. It is called when a new graphic context is created (e.g. for layers). An exporter is sort of a drawing backend: pcb-rnd sets up gc's and draws on them. The first gc set up should open the output file, the last gc closed should flush/close the file. Define a +destroy_gc + callback for the latter. GCs are destroyed at the end of the export process. Use global variable +channel + to make sure the file is open/close only once (see TODO +script context +). +

Define a +set_layer + callback that sets green_light to true if layer name is "topasssembly", false otherwise. +

Callback +fill_circle + is the workhorse: check if we have the green light to emit lines, then convert coordinates and diameter to mm and decide what format to use for printing a line for each filled circle. +

Finally, bind all four callbacks to exporter events.