Index: trunk/doc-rnd/gpmi/packages/layout.html =================================================================== --- trunk/doc-rnd/gpmi/packages/layout.html (revision 794) +++ trunk/doc-rnd/gpmi/packages/layout.html (revision 795) @@ -5,7 +5,7 @@ Layout package searches and manipulates the current layout. Dimension units are in nanometer unless otherwise mentioned. -

layout package - page

+

Page: board dimensions

Functions used to query or set width and height of the drawing: -

layer manipulation

+

Layer manipulation

Most functions perform operations similar to user commands affecting the current layer. The following few calls can change the current layer. Warning: this is the @@ -24,8 +24,9 @@
  • int layout_get_current_layer(): returns the number of the current layer
  • void layout_switch_to_layer(int layer): switch to layer (further actions will take place there) +

    -

    API reference - search layer(s) for objects

    +

    Object searches

    Search results are collected on lists identified by their name (search_ID). If a new search is done with the same name, old search results for that name are discarded. @@ -35,184 +36,19 @@ longer needed.

    TODO: validity of a list in time +

    +Once the search list is ready, the script can iterate over it and resolve +the object handle of each object found, using layout_search_get(). Having +an object handle, The layout_obj_*() functions may be used by the script +to access fields of an object structure. -

    - [todo] lists can be merged or copied. [todo] +

    Create new objects

    + The layour_create_*() calls are used to create new objects on the current + layer (set by layout_switch_to_layer()). -

    function int layout_search_box(const char *search_ID, multiple layout_object_mask_t obj_types, int x1, int y1, int x2, int y2);

    - Creates a new search and adds all objects that matches obj_types mask within the given rectangle on the current layer. - Arguments: -
      -
    1. search_ID: unique name of the search (overwrites existing search on the same name) -
    2. obj_types: on or more object types or'd -
    3. x1, y1, x2, y2: box the search is done within -
    - layout_object_mask_t is an enum with the following values: - - -

    function int layout_search_selected(const char *search_ID, multiple layout_object_mask_t obj_types)

    - Creates a new search and adds all selected objects. - Arguments: -
      -
    1. search_ID: unique name of the search (overwrites existing search on the same name) -
    2. obj_types: on or more object types or'd -
    - -

    function int layout_search_found(const char *search_ID, multiple layout_object_mask_t obj_types)

    - Creates a new search and adds all "found" objects (found objects are highlighted in green on the GUI). - Arguments: -
      -
    1. search_ID: unique name of the search (overwrites existing search on the same name) -
    2. obj_types: on or more object types or'd -
    - -

    function layout_object_t *layout_search_get(const char *search_ID, int n);

    - Returns the nth object of a search. - Arguments: -
      -
    1. search_ID: unique name of the search (requires an existing search) -
    2. n: number of the object; must be between 0 and (size of the list) - 1. -
    - Returns a pointer ot the object if the object is found or NULL if not. - Fields of the object structure can be accessed using the object - accessors (see below). - -

    function int layout_search_free(const char *search_ID)

    - Frees all memory related to a search. Returns 0 on success. - Argument: -
      -
    1. search_ID: unique name of the search (requires an existing search) -
    - -

    API reference - object accessors

    - The following functions may be used by the script to access fields of - an object structure. The object structure is most often obtained by - calling layout_search_get(). - -

    function int layout_obj_coord(layout_object_t *obj, layout_object_coord_t coord)

    - Return the requested coord of an object. - Arguments: -
      -
    1. obj: object pointer -
    2. coord: coordinate name -
    - - Coordinate names: - - Except for the bounding box coordinates, the meaning of coordinates are object-specific. - Point 1 and point 2 are usually endpoints of the object (line, arc), "the whole object" - coordinate is a central point (TODO: what's this?). - -

    function layout_object_mask_t layout_obj_type(layout_object_t *obj)

    - Return the type of an object (always a single value of layout_object_mask_t). - -

    function int layout_obj_move(layout_object_t *obj, layout_object_coord_t coord, int dx, int dy)

    - Change location of an object or parts of the object (like move endpoint - of a line); returns 0 on success. - Arguments: -
      -
    1. obj: object pointer -
    2. coord: coordinate name to drag -
    3. dx, dy: relative x and y coordinates the selected coordinate is displaced by -
    - - -

    function int layout_arc_angles(layout_object_t *obj, int relative, int start, int delta)

    - Change angles of an arc; start and delta are relative if relative is non-zero; - returns 0 on success. - - -

    API reference - create new objects

    - These calls are used to create new objects on the current layer. -

    function int layout_create_line(int x1, int y1, int x2, int y2, int thickness, int clearance, multiple layout_flag_t flags)

    - Creates a line. - Arguments: -
      -
    1. x1, y1, x2, y2: endpoints -
    2. thickness: thickness in 1/100 mil [todo?] -
    3. clearance: clearance in 1/100 mil [todo?] -
    4. flags: one or more of layout flags described below -
    - - Layout flags: - - -

    function int layout_create_via(int x, int y, int thickness, int clearance, int mask, int hole, const char *name, multiple layout_flag_t flags)

    - Create a named via. - Arguments: -
      -
    1. x, y: center coordinates -
    2. thickness: thickness in 1/100 mil [todo?] -
    3. clearance: clearance in 1/100 mil [todo?] -
    4. mask, hole: [TODO] -
    5. name: optional name (may be empty srting) -
    6. flags: one or more of layout flags -
    - - -

    function int layout_create_arc(int x, int y, int width, int height, int sa, int dir, int thickness, int clearance, multiple layout_flag_t flags);

    - Create a new arc. - Arguments: -
      -
    1. x, y: center coordinates -
    2. width, height: in mil [TODO?] -
    3. sa: start angle (in degrees, TODO: where is 0?) -
    4. dir: delta angle -
    5. thickness: thickness in 1/100 mil [todo?] -
    6. clearance: clearance in 1/100 mil [todo?] -
    7. flags: one or more of layout flags -
    -

    API reference - page, untis and coordinates

    +(angles are in radian) TODO

    API reference - debug draw

    Index: trunk/doc-rnd/gpmi/packages/layout_ref.html =================================================================== --- trunk/doc-rnd/gpmi/packages/layout_ref.html (nonexistent) +++ trunk/doc-rnd/gpmi/packages/layout_ref.html (revision 795) @@ -0,0 +1,305 @@ + + +

    PCB GPMI

    +

    Reference manual for package layout

    +Automatically generated from layout.h + +

    Enums

    +
    +

    Enum values should be passed on as strings. + +

    layout_object_mask_e

    +
    + Object type search mask bits 
    +
    + +
    value meaning +
    OM_LINE lines (traces, silk lines, not font) +
    OM_TEXT text written using the font +
    OM_POLYGON polygons, including rectangles +
    OM_ARC arcs, circles +
    OM_VIA vias and holes which are not part of a footprint +
    OM_PIN pins/pads of a footprint +
    OM_ANY shorthand for "find anything" +
    +
    +

    layout_object_coord_e

    +
    + Which coordinate of the object is referenced 
    +
    + +
    value meaning +
    OC_BX1 bounding box X1 +
    OC_BX2 bounding box X2 +
    OC_BY1 bounding box Y1 +
    OC_BY2 bounding box Y2 +
    OC_P1X point 1 X +
    OC_P2X point 2 X +
    OC_P1Y point 1 Y +
    OC_P2Y point 2 Y +
    OC_OBJ the whole object +
    OC_P1 point 1 is P1X +
    OC_P2 point 2 is P2X +
    +
    +

    layout_flag_e

    +
    + of layout_object_coord_t 
    +
    + +
    value meaning +
    FL_NONE <comment missing in the header> +
    FL_SHOWNUMBER <comment missing in the header> +
    FL_LOCALREF <comment missing in the header> +
    FL_CHECKPLANS <comment missing in the header> +
    FL_SHOWDRC <comment missing in the header> +
    FL_RUBBERBAND <comment missing in the header> +
    FL_DESCRIPTION <comment missing in the header> +
    FL_NAMEONPCB <comment missing in the header> +
    FL_AUTODRC <comment missing in the header> +
    FL_ALLDIRECTION <comment missing in the header> +
    FL_SWAPSTARTDIR <comment missing in the header> +
    FL_UNIQUENAME <comment missing in the header> +
    FL_CLEARNEW <comment missing in the header> +
    FL_SNAPPIN <comment missing in the header> +
    FL_SHOWMASK <comment missing in the header> +
    FL_THINDRAW <comment missing in the header> +
    FL_ORTHOMOVE <comment missing in the header> +
    FL_LIVEROUTE <comment missing in the header> +
    FL_THINDRAWPOLY <comment missing in the header> +
    FL_LOCKNAMES <comment missing in the header> +
    FL_ONLYNAMES <comment missing in the header> +
    FL_NEWFULLPOLY <comment missing in the header> +
    FL_HIDENAMES <comment missing in the header> +
    FL_THERMALSTYLE1 <comment missing in the header> +
    FL_THERMALSTYLE2 <comment missing in the header> +
    FL_THERMALSTYLE3 <comment missing in the header> +
    FL_THERMALSTYLE4 <comment missing in the header> +
    FL_THERMALSTYLE5 <comment missing in the header> +
    +
    +

    layer_field_e

    +
    + Field name of the layer structure 
    +
    + +
    value meaning +
    LFLD_NUM_LINES number of lines on the layer +
    LFLD_NUM_TEXTS number of texts on the layer +
    LFLD_NUM_POLYS number of polygons on the layer +
    LFLD_NUM_ARCS number of arcs on the layer +
    LFLD_VISIBLE non-zero if the layer is visible +
    LFLD_NODRC non-zero if the layer doesn't use DRC +
    +
    +

    Functions

    +
    +

    The following functions are registered in script context. + +

    int layout_search_box(const char* search_ID, layout_object_mask_t obj_types, int x1, int y1, int x2, int y2)

    +
    + creates a new search and adds all objects that matches obj_types mask within the given rectangle on the current layer
    +   Arguments:
    +     search_ID: unique name of the search (overwrites existing search on the same name)
    +     obj_types: on or more object types
    +     x1, y1, x2, y2: box the search is done within (PCB coords)
    +   Returns the number of object on the search list. 
    +
    +
    +

    int layout_search_selected(const char* search_ID, layout_object_mask_t obj_types)

    +
    + creates a new search and adds all selected objects
    +   Arguments:
    +     search_ID: unique name of the search (overwrites existing search on the same name)
    +     obj_types: on or more object types
    +   Returns the number of object on the search list. 
    +
    +
    +

    int layout_search_found(const char* search_ID, layout_object_mask_t obj_types)

    +
    + creates a new search and adds all found objects (the green highlight)
    +   Arguments:
    +     search_ID: unique name of the search (overwrites existing search on the same name)
    +     obj_types: on or more object types
    +   Returns the number of object on the search list. 
    +
    +
    +

    layout_object_t* layout_search_get(const char* search_ID, int n)

    +
    + Returns the nth object from a search list (or NULL pointer if n is beyond the list) 
    +
    +
    +

    int layout_search_free(const char* search_ID)

    +
    + Frees all memory related to a search. Returns 0 on success.
    +   Argument:
    +     search_ID: unique name of the search (requires an existing search) 
    +
    +
    +

    int layout_obj_coord(layout_object_t* obj, layout_object_coord_t coord)

    +
    + Return the requested coord of an object; except for the bounding box
    +    coordinates, the meaning of coordinates are object-specific.
    +    Point 1 and point 2 are usually endpoints of the object (line, arc),
    +    "the whole object" coordinate is a central point. 
    +
    +
    +

    layout_object_mask_t layout_obj_type(layout_object_t* obj)

    +
    + Return the type of an object (always a single bit) 
    +
    +
    +

    int layout_obj_move(layout_object_t* obj, layout_object_coord_t coord, int dx, int dy)

    +
    + Change location of an object or parts of the object (like move endpoint of a line);
    +   Arguments:
    +     obj: the object
    +     coord: which coordinate to drag (e.g. move only the endpoint)
    +     dx, dy: relative x and y coordinates the selected coordinate is displaced by
    +   Returns 0 on success 
    +
    +
    +

    int layout_arc_angles(layout_object_t* obj, int relative, int start, int delta)

    +
    + change angles of an arc; start and delate are relative if relative is non-zero; returns 0 on success 
    +
    +
    +

    int layout_create_line(int x1, int y1, int x2, int y2, int thickness, int clearance, layout_flag_t flags)

    +
    + create a line 
    +
    +
    +

    int layout_create_via(int x, int y, int thickness, int clearance, int mask, int hole, const char* name, layout_flag_t flags)

    +
    + create a named via 
    +
    +
    +

    int layout_create_arc(int x, int y, int width, int height, int sa, int dir, int thickness, int clearance, layout_flag_t flags)

    +
    + create a new arc; sa is start angle, dir is delta angle 
    +
    +
    +

    void layout_switch_to_layer(int layer)

    +
    + switch to layer (further layer-specific actions will take place there) 
    +
    +
    +

    int layout_get_current_layer()

    +
    + returns the number of the current layer 
    +
    +
    +

    int layout_resolve_layer(const char* name)

    +
    + resolve layer number by name (case sensitive); returns negative number if not found 
    +
    +
    +

    int layout_get_max_possible_layer()

    +
    + return the theoretical number of layers supported by PCB 
    +
    +
    +

    int layout_get_max_copper_layer()

    +
    + return the actual number of copper layers on the current design 
    +
    +
    +

    int layout_get_max_layer()

    +
    + return the actual number of layers on the current design 
    +
    +
    +

    const char* layout_layer_name(int layer)

    +
    + return the name of a layer 
    +
    +
    +

    const char* layout_layer_color(int layer)

    +
    + return the color of a layer 
    +
    +
    +

    int layout_layer_field(int layer, layer_field_t fld)

    +
    + return an integer field of a layer 
    +
    +
    +

    int layout_get_page_width()

    +
    + query or set width and height of the drawing 
    +
    +
    +

    int layout_get_page_height()

    +
    +<comment missing in the header>
    +
    +
    +

    void layout_set_page_size(int width, int height)

    +
    +<comment missing in the header>
    +
    +
    +

    double mil2pcb_multiplier()

    +
    + -- coordinate system -- (coord.c) 
    +
    +
    +

    double mm2pcb_multiplier()

    +
    +<comment missing in the header>
    +
    +
    +

    const char* current_grid_unit()

    +
    +<comment missing in the header>
    +
    +
    +

    int debug_draw_request(void)

    +
    + Initialize debug drawing; returns 1 if worked, 0 if denied 
    +
    +
    +

    void debug_draw_flush(void)

    +
    + Flush the drawing 
    +
    +
    +

    void debug_draw_finish(dctx_t* ctx)

    +
    + Finish (close) drawing 
    +
    +
    +

    dctx_t* debug_draw_dctx(void)

    +
    + Get the draw context of debug draw 
    +
    +
    +

    void draw_set_color(dctx_t* ctx, const char* name)

    +
    + Debug draw style: set drawing color 
    +
    +
    +

    void draw_set_line_width(dctx_t* ctx, int width)

    +
    + Debug draw style: set line width 
    +
    +
    +

    void draw_set_draw_xor(dctx_t* ctx, int xor)

    +
    + Debug draw style: set whether drawing should happen in xor 
    +
    +
    +

    void draw_set_draw_faded(dctx_t* ctx, int faded)

    +
    + Debug draw style: set whether drawing should happen in faded mode  
    +
    +
    +

    void draw_line(dctx_t* ctx, int x1_, int y1_, int x2_, int y2_)

    +
    + Debug draw: draw a line using the current style settings 
    +
    +
    + + + +