Index: doc-rnd/gpmi/rosetta/35_export_drill/index.html =================================================================== --- doc-rnd/gpmi/rosetta/35_export_drill/index.html (nonexistent) +++ doc-rnd/gpmi/rosetta/35_export_drill/index.html (revision 2253) @@ -0,0 +1,71 @@ +
+ +<-- back to the index of Rosetta examples +An exporter is sort of a drawing backend: pcb-rnd sets up graphic contexts (gc for short) and draws on them. The first gc set up should open the output file, the last gc closed should flush/close the file. +
+
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.