[prev in list] [next in list] [prev in thread] [next in thread]
List: python-cpp-sig
Subject: [C++-sig] Accessing pointer properties with boost-python ?
From: Vivien Henry <vivh.29 () hotmail ! fr>
Date: 2015-11-01 17:25:01
Message-ID: DUB119-W43AC71BA804F2591E7CC669E2D0 () phx ! gbl
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hello everyone,
I am new on this mailing-list, so; first,
My name is Vivien Henry, working as Electrical Engineer in France
I am currently trying to wrap a CAD software, gerbv (http://gerbv.geda-project.org/), \
which is designed to handle Gerber files. (They also provide it as a library)
the file wrapper.cpp is generated through a personal script
The script is still a work in progress.
The generated code compiles, creating objects looks ok, accessing their attributes \
(numbers.. enums) as well.
BUT, the problem is when i want to access a property which is actually a pointer...
For instance, with this script:
> > > from gerbv import *
> > >
> > >
> > >
> > > i = gerbv_instruction_t()
> > > i
<gerbv.gerbv_instruction_t object at 0x7f655abe6788>
> > > i.opcode
gerbv.gerbv_opcodes_t.GERBV_OPCODE_NOP
> > > a = gerbv_amacro_t()
> > > a
<gerbv.gerbv_amacro_t object at 0x7f655abe67e0>
> > > a.program
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
Boost.Python.ArgumentError: Python argument types in
None.None(gerbv_amacro_t)
did not match C++ signature:
None(amacro {lvalue})
> > >
I can't figure out what is happening here !
(you ll see that i am creating a proxy to access string and char array...)
Any help is welcome :D
Thanks a lot,
Vivien Henry
here the specific code for this error, which is in the file wrapper.cpp
class gerbv_amacro_t_proxy: public gerbv_amacro_t{
public:
std::string get_name(){
std::string s(name);
return s;
}
void set_name(std::string s){
name = (gchar*)s.c_str();
}
gerbv_amacro_t_proxy() {
}
};
// in boost_python macro... l655
class_<gerbv_amacro_t_proxy, boost::shared_ptr<gerbv_amacro_t_proxy> \
>("gerbv_amacro_t") //Methods
//Properties
.add_property("name", &gerbv_amacro_t_proxy::get_name, \
&gerbv_amacro_t_proxy::set_name)
.add_property("program", make_getter(&gerbv_amacro_t_proxy::program, \
return_internal_reference<>()), make_setter(&gerbv_amacro_t_proxy::program, \
return_internal_reference<>()))
.def_readwrite("nuf_push", &gerbv_amacro_t_proxy::nuf_push)
.add_property("next", make_getter(&gerbv_amacro_t_proxy::next, \
return_internal_reference<>()), make_setter(&gerbv_amacro_t_proxy::next, \
return_internal_reference<>())) ;
// in boost python macro l918
class_<gerbv_instruction_t, boost::shared_ptr<gerbv_instruction_t> \
>("gerbv_instruction_t") //Methods
//Properties
.def_readwrite("opcode", &gerbv_instruction_t::opcode)
.def_readwrite("data", &gerbv_instruction_t::data)
.add_property("next", make_getter(&gerbv_instruction_t::next, \
return_internal_reference<>()), make_setter(&gerbv_instruction_t::next, \
return_internal_reference<>())) ;
[Attachment #5 (text/html)]
<html>
<head>
</head>
<body class='hmmessage'><div dir='ltr'>
<div dir="ltr">
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
<div dir="ltr">Hello everyone,<br>I am new on this mailing-list, so; first, <br>My \
name is Vivien Henry, working as Electrical Engineer in France<br><br>I am currently \
trying to wrap a CAD software, gerbv (http://gerbv.geda-project.org/), which is \
designed to handle Gerber files. (They also provide it as a library)<br><br>the file \
wrapper.cpp is generated through a personal script<br><br>The script is still a work \
in progress.<br>The generated code compiles, creating objects looks ok, accessing \
their attributes (numbers.. enums) as well.<br><br>BUT, the problem is when i want to \
access a property which is actually a pointer...<br><br>For instance, with this \
script:<br><br>>>> from gerbv import *<br>>>> <br>>>> \
<br>>>> <br>>>> i = gerbv_instruction_t()<br>>>> \
i<br><gerbv.gerbv_instruction_t object at 0x7f655abe6788><br>>>> \
i.opcode<br>gerbv.gerbv_opcodes_t.GERBV_OPCODE_NOP<br>>>> a = \
gerbv_amacro_t()<br>>>> a<br><gerbv.gerbv_amacro_t object at \
0x7f655abe67e0><br>>>> a.program<br>Traceback (most recent call \
last):<br> File "<stdin>", line 1, in \
<module><br>Boost.Python.ArgumentError: Python argument types \
in<br> None.None(gerbv_amacro_t)<br>did not match C++ \
signature:<br> None(amacro {lvalue})<br>>>> <br><br><br>I \
can't figure out what is happening here !<br><br>(you ll see that i am creating a \
proxy to access string and char array...)<br><br>Any help is welcome :D<br>Thanks a \
lot, <br><br><br>Vivien Henry<br><br><br>here the specific code for this error, which \
is in the file wrapper.cpp<br><br>class gerbv_amacro_t_proxy: public \
gerbv_amacro_t{<br> \
public:<br><br><br><br> std::string \
get_name(){<br> \
std::string s(name);<br> \
return s;<br> \
}<br><br> void set_name(std::string \
s){<br> name = \
(gchar*)s.c_str();<br> \
}<br><br><br> gerbv_amacro_t_proxy() \
{<br><br> \
}<br><br><br>};<br><br><br><br><br>// in boost_python macro... \
l655<br><br>class_<gerbv_amacro_t_proxy, \
boost::shared_ptr<gerbv_amacro_t_proxy> \
>("gerbv_amacro_t")<br> \
//Methods<br> \
//Properties<br> .add_property("name", \
&gerbv_amacro_t_proxy::get_name, \
&gerbv_amacro_t_proxy::set_name)<br> \
.add_property("program", make_getter(&gerbv_amacro_t_proxy::program, \
return_internal_reference<>()), make_setter(&gerbv_amacro_t_proxy::program, \
return_internal_reference<>()))<br> \
.def_readwrite("nuf_push", \
&gerbv_amacro_t_proxy::nuf_push)<br> \
.add_property("next", make_getter(&gerbv_amacro_t_proxy::next, \
return_internal_reference<>()), make_setter(&gerbv_amacro_t_proxy::next, \
return_internal_reference<>()))<br> \
;<br><br><br>// in boost python macro l918<br>class_<gerbv_instruction_t, \
boost::shared_ptr<gerbv_instruction_t> \
>("gerbv_instruction_t")<br> \
//Methods<br> \
//Properties<br> .def_readwrite("opcode", \
&gerbv_instruction_t::opcode)<br> \
.def_readwrite("data", \
&gerbv_instruction_t::data)<br> \
.add_property("next", make_getter(&gerbv_instruction_t::next, \
return_internal_reference<>()), make_setter(&gerbv_instruction_t::next, \
return_internal_reference<>()))<br> \
;<br><br></div> </div>
</div></body>
</html>
["wrapper.cpp" (text/x-c)]
// Module:
// Generate by py-autowraper
#include "boost/python.hpp"
#include <string>
#include "gerbv.h"
using namespace boost::python;
class gerbv_amacro_t_proxy: public gerbv_amacro_t{
public:
std::string get_name(){
std::string s(name);
return s;
}
void set_name(std::string s){
name = (gchar*)s.c_str();
}
gerbv_amacro_t_proxy() {
}
};
class gerbv_HID_Attr_Val_proxy: public gerbv_HID_Attr_Val{
public:
std::string get_str_value(){
std::string s(str_value);
return s;
}
void set_str_value(std::string s){
str_value = (gchar*)s.c_str();
}
gerbv_HID_Attr_Val_proxy() {
}
};
class gerbv_drill_stats_t_proxy: public gerbv_drill_stats_t{
public:
std::string get_detect(){
std::string s(detect);
return s;
}
void set_detect(std::string s){
detect = (gchar*)s.c_str();
}
gerbv_drill_stats_t_proxy() {
}
};
class gerbv_project_t_proxy: public gerbv_project_t{
public:
std::string get_path(){
std::string s(path);
return s;
}
void set_path(std::string s){
path = (gchar*)s.c_str();
}
std::string get_execpath(){
std::string s(execpath);
return s;
}
void set_execpath(std::string s){
execpath = (gchar*)s.c_str();
}
std::string get_execname(){
std::string s(execname);
return s;
}
void set_execname(std::string s){
execname = (gchar*)s.c_str();
}
std::string get_project(){
std::string s(project);
return s;
}
void set_project(std::string s){
project = (gchar*)s.c_str();
}
gerbv_project_t_proxy() {
}
};
class gerbv_drill_list_t_proxy: public gerbv_drill_list_t{
public:
std::string get_drill_unit(){
std::string s(drill_unit);
return s;
}
void set_drill_unit(std::string s){
drill_unit = (gchar*)s.c_str();
}
gerbv_drill_list_t_proxy() {
}
};
class gerbv_layer_t_proxy: public gerbv_layer_t{
public:
std::string get_name(){
std::string s(name);
return s;
}
void set_name(std::string s){
name = (gchar*)s.c_str();
}
gerbv_layer_t_proxy() {
}
};
class gerbv_aperture_t_proxy: public gerbv_aperture_t{
public:
class parameter_proxy{
public:
void init(double *ptr, int size){
mPtr = ptr;
mSize = size;
}
int len(){
return mSize;
}
double get_item(int item){
if(item < 0 || item >= mSize)
throw std::out_of_range("index out-of-range");
return mPtr[item];
}
void set_item(int item, double value){
if(item < 0 || item >= mSize)
throw std::out_of_range("index out-of-range");
mPtr[item] = value;
}
static void define_python_class(){
class_<parameter_proxy>("gerbv_aperture_t_parameter_proxy")
.def("__len__", ¶meter_proxy::len)
.def("__getitem__", ¶meter_proxy::get_item)
.def("__setitem__", ¶meter_proxy::set_item)
//.def("__str__", ¶meter_proxy::str)
;
}
private:
double *mPtr;
int mSize;
};
gerbv_aperture_t_proxy() {
parameter_p.init(parameter, APERTURE_PARAMETERS_MAX);
}
parameter_proxy parameter_p;
};
class gerbv_image_info_t_proxy: public gerbv_image_info_t{
public:
std::string get_name(){
std::string s(name);
return s;
}
void set_name(std::string s){
name = (gchar*)s.c_str();
}
std::string get_plotterFilm(){
std::string s(plotterFilm);
return s;
}
void set_plotterFilm(std::string s){
plotterFilm = (gchar*)s.c_str();
}
std::string get_type(){
std::string s(type);
return s;
}
void set_type(std::string s){
type = (gchar*)s.c_str();
}
gerbv_image_info_t_proxy() {
}
};
class gerbv_HID_Attribute_proxy: public gerbv_HID_Attribute{
public:
std::string get_name(){
std::string s(name);
return s;
}
void set_name(std::string s){
name = (gchar*)s.c_str();
}
std::string get_help_text(){
std::string s(help_text);
return s;
}
void set_help_text(std::string s){
help_text = (gchar*)s.c_str();
}
gerbv_HID_Attribute_proxy() {
}
};
class gerbv_simplified_amacro_t_proxy: public gerbv_simplified_amacro_t{
public:
class parameter_proxy{
public:
void init(double *ptr, int size){
mPtr = ptr;
mSize = size;
}
int len(){
return mSize;
}
double get_item(int item){
if(item < 0 || item >= mSize)
throw std::out_of_range("index out-of-range");
return mPtr[item];
}
void set_item(int item, double value){
if(item < 0 || item >= mSize)
throw std::out_of_range("index out-of-range");
mPtr[item] = value;
}
static void define_python_class(){
class_<parameter_proxy>("gerbv_simplified_amacro_t_parameter_proxy")
.def("__len__", ¶meter_proxy::len)
.def("__getitem__", ¶meter_proxy::get_item)
.def("__setitem__", ¶meter_proxy::set_item)
//.def("__str__", ¶meter_proxy::str)
;
}
private:
double *mPtr;
int mSize;
};
gerbv_simplified_amacro_t_proxy() {
parameter_p.init(parameter, APERTURE_PARAMETERS_MAX);
}
parameter_proxy parameter_p;
};
class gerbv_aperture_list_t_proxy: public gerbv_aperture_list_t{
public:
class parameter_proxy{
public:
void init(double *ptr, int size){
mPtr = ptr;
mSize = size;
}
int len(){
return mSize;
}
double get_item(int item){
if(item < 0 || item >= mSize)
throw std::out_of_range("index out-of-range");
return mPtr[item];
}
void set_item(int item, double value){
if(item < 0 || item >= mSize)
throw std::out_of_range("index out-of-range");
mPtr[item] = value;
}
static void define_python_class(){
class_<parameter_proxy>("gerbv_aperture_list_t_parameter_proxy")
.def("__len__", ¶meter_proxy::len)
.def("__getitem__", ¶meter_proxy::get_item)
.def("__setitem__", ¶meter_proxy::set_item)
//.def("__str__", ¶meter_proxy::str)
;
}
private:
double *mPtr;
int mSize;
};
gerbv_aperture_list_t_proxy() {
parameter_p.init(parameter, 5);
}
parameter_proxy parameter_p;
};
class gerbv_fileinfo_t_proxy: public gerbv_fileinfo_t{
public:
std::string get_fullPathname(){
std::string s(fullPathname);
return s;
}
void set_fullPathname(std::string s){
fullPathname = (gchar*)s.c_str();
}
std::string get_name(){
std::string s(name);
return s;
}
void set_name(std::string s){
name = (gchar*)s.c_str();
}
gerbv_fileinfo_t_proxy() {
}
};
class gerbv_error_list_t_proxy: public gerbv_error_list_t{
public:
std::string get_error_text(){
std::string s(error_text);
return s;
}
void set_error_text(std::string s){
error_text = (gchar*)s.c_str();
}
gerbv_error_list_t_proxy() {
}
};
class gerbv_image_t_proxy: public gerbv_image_t{
public:
class aperture_proxy{
public:
void init(gerbv_aperture_t * *ptr, int size){
mPtr = ptr;
mSize = size;
}
int len(){
return mSize;
}
gerbv_aperture_t * get_item(int item){
if(item < 0 || item >= mSize)
throw std::out_of_range("index out-of-range");
return mPtr[item];
}
void set_item(int item, gerbv_aperture_t * value){
if(item < 0 || item >= mSize)
throw std::out_of_range("index out-of-range");
mPtr[item] = value;
}
static void define_python_class(){
class_<aperture_proxy>("gerbv_image_t_aperture_proxy")
.def("__len__", &aperture_proxy::len)
.def("__getitem__", &aperture_proxy::get_item, \
return_internal_reference<>())
.def("__setitem__", &aperture_proxy::set_item, \
return_internal_reference<>()) //.def("__str__", &aperture_proxy::str)
;
}
private:
gerbv_aperture_t * *mPtr;
int mSize;
};
gerbv_image_t_proxy() {
aperture_p.init(aperture, APERTURE_MAX);
}
aperture_proxy aperture_p;
};
BOOST_PYTHON_MODULE(gerbv){
enum_<gerbv_opcodes_t>("gerbv_opcodes_t")
.value("GERBV_OPCODE_NOP", GERBV_OPCODE_NOP)
.value("GERBV_OPCODE_PUSH", GERBV_OPCODE_PUSH)
.value("GERBV_OPCODE_PPUSH", GERBV_OPCODE_PPUSH)
.value("GERBV_OPCODE_PPOP", GERBV_OPCODE_PPOP)
.value("GERBV_OPCODE_ADD", GERBV_OPCODE_ADD)
.value("GERBV_OPCODE_SUB", GERBV_OPCODE_SUB)
.value("GERBV_OPCODE_MUL", GERBV_OPCODE_MUL)
.value("GERBV_OPCODE_DIV", GERBV_OPCODE_DIV)
.value("GERBV_OPCODE_PRIM", GERBV_OPCODE_PRIM)
;
enum_<gerbv_message_type_t>("gerbv_message_type_t")
.value("GERBV_MESSAGE_FATAL", GERBV_MESSAGE_FATAL)
.value("GERBV_MESSAGE_ERROR", GERBV_MESSAGE_ERROR)
.value("GERBV_MESSAGE_WARNING", GERBV_MESSAGE_WARNING)
.value("GERBV_MESSAGE_NOTE", GERBV_MESSAGE_NOTE)
;
enum_<gerbv_aperture_type_t>("gerbv_aperture_type_t")
.value("GERBV_APTYPE_NONE", GERBV_APTYPE_NONE)
.value("GERBV_APTYPE_CIRCLE", GERBV_APTYPE_CIRCLE)
.value("GERBV_APTYPE_RECTANGLE", GERBV_APTYPE_RECTANGLE)
.value("GERBV_APTYPE_OVAL", GERBV_APTYPE_OVAL)
.value("GERBV_APTYPE_POLYGON", GERBV_APTYPE_POLYGON)
.value("GERBV_APTYPE_MACRO", GERBV_APTYPE_MACRO)
.value("GERBV_APTYPE_MACRO_CIRCLE", GERBV_APTYPE_MACRO_CIRCLE)
.value("GERBV_APTYPE_MACRO_OUTLINE", GERBV_APTYPE_MACRO_OUTLINE)
.value("GERBV_APTYPE_MACRO_POLYGON", GERBV_APTYPE_MACRO_POLYGON)
.value("GERBV_APTYPE_MACRO_MOIRE", GERBV_APTYPE_MACRO_MOIRE)
.value("GERBV_APTYPE_MACRO_THERMAL", GERBV_APTYPE_MACRO_THERMAL)
.value("GERBV_APTYPE_MACRO_LINE20", GERBV_APTYPE_MACRO_LINE20)
.value("GERBV_APTYPE_MACRO_LINE21", GERBV_APTYPE_MACRO_LINE21)
.value("GERBV_APTYPE_MACRO_LINE22", GERBV_APTYPE_MACRO_LINE22)
;
enum_<gerbv_aperture_state_t>("gerbv_aperture_state_t")
.value("GERBV_APERTURE_STATE_OFF", GERBV_APERTURE_STATE_OFF)
.value("GERBV_APERTURE_STATE_ON", GERBV_APERTURE_STATE_ON)
.value("GERBV_APERTURE_STATE_FLASH", GERBV_APERTURE_STATE_FLASH)
;
enum_<gerbv_unit_t>("gerbv_unit_t")
.value("GERBV_UNIT_INCH", GERBV_UNIT_INCH)
.value("GERBV_UNIT_MM", GERBV_UNIT_MM)
.value("GERBV_UNIT_UNSPECIFIED", GERBV_UNIT_UNSPECIFIED)
;
enum_<gerbv_polarity_t>("gerbv_polarity_t")
.value("GERBV_POLARITY_POSITIVE", GERBV_POLARITY_POSITIVE)
.value("GERBV_POLARITY_NEGATIVE", GERBV_POLARITY_NEGATIVE)
.value("GERBV_POLARITY_DARK", GERBV_POLARITY_DARK)
.value("GERBV_POLARITY_CLEAR", GERBV_POLARITY_CLEAR)
;
enum_<gerbv_omit_zeros_t>("gerbv_omit_zeros_t")
.value("GERBV_OMIT_ZEROS_LEADING", GERBV_OMIT_ZEROS_LEADING)
.value("GERBV_OMIT_ZEROS_TRAILING", GERBV_OMIT_ZEROS_TRAILING)
.value("GERBV_OMIT_ZEROS_EXPLICIT", GERBV_OMIT_ZEROS_EXPLICIT)
.value("GERBV_OMIT_ZEROS_UNSPECIFIED", GERBV_OMIT_ZEROS_UNSPECIFIED)
;
enum_<gerbv_coordinate_t>("gerbv_coordinate_t")
.value("GERBV_COORDINATE_ABSOLUTE", GERBV_COORDINATE_ABSOLUTE)
.value("GERBV_COORDINATE_INCREMENTAL", GERBV_COORDINATE_INCREMENTAL)
;
enum_<gerbv_interpolation_t>("gerbv_interpolation_t")
.value("GERBV_INTERPOLATION_LINEARx1", GERBV_INTERPOLATION_LINEARx1)
.value("GERBV_INTERPOLATION_x10", GERBV_INTERPOLATION_x10)
.value("GERBV_INTERPOLATION_LINEARx01", GERBV_INTERPOLATION_LINEARx01)
.value("GERBV_INTERPOLATION_LINEARx001", GERBV_INTERPOLATION_LINEARx001)
.value("GERBV_INTERPOLATION_CW_CIRCULAR", GERBV_INTERPOLATION_CW_CIRCULAR)
.value("GERBV_INTERPOLATION_CCW_CIRCULAR", GERBV_INTERPOLATION_CCW_CIRCULAR)
.value("GERBV_INTERPOLATION_PAREA_START", GERBV_INTERPOLATION_PAREA_START)
.value("GERBV_INTERPOLATION_PAREA_END", GERBV_INTERPOLATION_PAREA_END)
.value("GERBV_INTERPOLATION_DELETED", GERBV_INTERPOLATION_DELETED)
;
enum_<gerbv_encoding_t>("gerbv_encoding_t")
.value("GERBV_ENCODING_NONE", GERBV_ENCODING_NONE)
.value("GERBV_ENCODING_ASCII", GERBV_ENCODING_ASCII)
.value("GERBV_ENCODING_EBCDIC", GERBV_ENCODING_EBCDIC)
.value("GERBV_ENCODING_BCD", GERBV_ENCODING_BCD)
.value("GERBV_ENCODING_ISO_ASCII", GERBV_ENCODING_ISO_ASCII)
.value("GERBV_ENCODING_EIA", GERBV_ENCODING_EIA)
;
enum_<gerbv_layertype_t>("gerbv_layertype_t")
.value("GERBV_LAYERTYPE_RS274X", GERBV_LAYERTYPE_RS274X)
.value("GERBV_LAYERTYPE_DRILL", GERBV_LAYERTYPE_DRILL)
.value("GERBV_LAYERTYPE_PICKANDPLACE", GERBV_LAYERTYPE_PICKANDPLACE)
;
enum_<gerbv_knockout_type_t>("gerbv_knockout_type_t")
.value("GERBV_KNOCKOUT_TYPE_NOKNOCKOUT", GERBV_KNOCKOUT_TYPE_NOKNOCKOUT)
.value("GERBV_KNOCKOUT_TYPE_FIXEDKNOCK", GERBV_KNOCKOUT_TYPE_FIXEDKNOCK)
.value("GERBV_KNOCKOUT_TYPE_BORDER", GERBV_KNOCKOUT_TYPE_BORDER)
;
enum_<gerbv_mirror_state_t>("gerbv_mirror_state_t")
.value("GERBV_MIRROR_STATE_NOMIRROR", GERBV_MIRROR_STATE_NOMIRROR)
.value("GERBV_MIRROR_STATE_FLIPA", GERBV_MIRROR_STATE_FLIPA)
.value("GERBV_MIRROR_STATE_FLIPB", GERBV_MIRROR_STATE_FLIPB)
.value("GERBV_MIRROR_STATE_FLIPAB", GERBV_MIRROR_STATE_FLIPAB)
;
enum_<gerbv_axis_select_t>("gerbv_axis_select_t")
.value("GERBV_AXIS_SELECT_NOSELECT", GERBV_AXIS_SELECT_NOSELECT)
.value("GERBV_AXIS_SELECT_SWAPAB", GERBV_AXIS_SELECT_SWAPAB)
;
enum_<gerbv_image_justify_type_t>("gerbv_image_justify_type_t")
.value("GERBV_JUSTIFY_NOJUSTIFY", GERBV_JUSTIFY_NOJUSTIFY)
.value("GERBV_JUSTIFY_LOWERLEFT", GERBV_JUSTIFY_LOWERLEFT)
.value("GERBV_JUSTIFY_CENTERJUSTIFY", GERBV_JUSTIFY_CENTERJUSTIFY)
;
enum_<gerbv_selection_t>("gerbv_selection_t")
.value("GERBV_SELECTION_EMPTY", GERBV_SELECTION_EMPTY)
.value("GERBV_SELECTION_POINT_CLICK", GERBV_SELECTION_POINT_CLICK)
.value("GERBV_SELECTION_DRAG_BOX", GERBV_SELECTION_DRAG_BOX)
;
enum_<gerbv_render_types_t>("gerbv_render_types_t")
.value("GERBV_RENDER_TYPE_GDK", GERBV_RENDER_TYPE_GDK)
.value("GERBV_RENDER_TYPE_GDK_XOR", GERBV_RENDER_TYPE_GDK_XOR)
.value("GERBV_RENDER_TYPE_CAIRO_NORMAL", GERBV_RENDER_TYPE_CAIRO_NORMAL)
.value("GERBV_RENDER_TYPE_CAIRO_HIGH_QUALITY", \
GERBV_RENDER_TYPE_CAIRO_HIGH_QUALITY)
.value("GERBV_RENDER_TYPE_MAX", GERBV_RENDER_TYPE_MAX)
;
class_<gerbv_selection_info_t, boost::shared_ptr<gerbv_selection_info_t> \
>("gerbv_selection_info_t") //Methods
//Properties
.def_readwrite("type", &gerbv_selection_info_t::type)
.def_readwrite("lowerLeftX", &gerbv_selection_info_t::lowerLeftX)
.def_readwrite("lowerLeftY", &gerbv_selection_info_t::lowerLeftY)
.def_readwrite("upperRightX", &gerbv_selection_info_t::upperRightX)
.def_readwrite("upperRightY", &gerbv_selection_info_t::upperRightY)
.add_property("selectedNodeArray", \
make_getter(&gerbv_selection_info_t::selectedNodeArray, \
return_internal_reference<>()), \
make_setter(&gerbv_selection_info_t::selectedNodeArray, \
return_internal_reference<>())) ;
class_<gerbv_amacro_t_proxy, boost::shared_ptr<gerbv_amacro_t_proxy> \
>("gerbv_amacro_t") //Methods
//Properties
.add_property("name", &gerbv_amacro_t_proxy::get_name, \
&gerbv_amacro_t_proxy::set_name)
.add_property("program", make_getter(&gerbv_amacro_t_proxy::program, \
return_internal_reference<>()), make_setter(&gerbv_amacro_t_proxy::program, \
return_internal_reference<>()))
.def_readwrite("nuf_push", &gerbv_amacro_t_proxy::nuf_push)
.add_property("next", make_getter(&gerbv_amacro_t_proxy::next, \
return_internal_reference<>()), make_setter(&gerbv_amacro_t_proxy::next, \
return_internal_reference<>())) ;
class_<gerbv_cirseg_t, boost::shared_ptr<gerbv_cirseg_t> >("gerbv_cirseg_t")
//Methods
//Properties
.def_readwrite("cp_x", &gerbv_cirseg_t::cp_x)
.def_readwrite("cp_y", &gerbv_cirseg_t::cp_y)
.def_readwrite("width", &gerbv_cirseg_t::width)
.def_readwrite("height", &gerbv_cirseg_t::height)
.def_readwrite("angle1", &gerbv_cirseg_t::angle1)
.def_readwrite("angle2", &gerbv_cirseg_t::angle2)
;
class_<gerbv_user_transformation_t, \
boost::shared_ptr<gerbv_user_transformation_t> >("gerbv_user_transformation_t") \
//Methods //Properties
.def_readwrite("translateX", &gerbv_user_transformation_t::translateX)
.def_readwrite("translateY", &gerbv_user_transformation_t::translateY)
.def_readwrite("scaleX", &gerbv_user_transformation_t::scaleX)
.def_readwrite("scaleY", &gerbv_user_transformation_t::scaleY)
.def_readwrite("rotation", &gerbv_user_transformation_t::rotation)
.def_readwrite("mirrorAroundX", &gerbv_user_transformation_t::mirrorAroundX)
.def_readwrite("mirrorAroundY", &gerbv_user_transformation_t::mirrorAroundY)
.def_readwrite("inverted", &gerbv_user_transformation_t::inverted)
;
class_<gerbv_format_t, boost::shared_ptr<gerbv_format_t> >("gerbv_format_t")
//Methods
//Properties
.def_readwrite("omit_zeros", &gerbv_format_t::omit_zeros)
.def_readwrite("coordinate", &gerbv_format_t::coordinate)
.def_readwrite("x_int", &gerbv_format_t::x_int)
.def_readwrite("x_dec", &gerbv_format_t::x_dec)
.def_readwrite("y_int", &gerbv_format_t::y_int)
.def_readwrite("y_dec", &gerbv_format_t::y_dec)
.def_readwrite("lim_seqno", &gerbv_format_t::lim_seqno)
.def_readwrite("lim_gf", &gerbv_format_t::lim_gf)
.def_readwrite("lim_pf", &gerbv_format_t::lim_pf)
.def_readwrite("lim_mf", &gerbv_format_t::lim_mf)
;
class_<gerbv_HID_Attr_Val_proxy, boost::shared_ptr<gerbv_HID_Attr_Val_proxy> \
>("gerbv_HID_Attr_Val") //Methods
//Properties
.def_readwrite("int_value", &gerbv_HID_Attr_Val_proxy::int_value)
.add_property("str_value", &gerbv_HID_Attr_Val_proxy::get_str_value, \
&gerbv_HID_Attr_Val_proxy::set_str_value)
.def_readwrite("real_value", &gerbv_HID_Attr_Val_proxy::real_value)
;
class_<gerbv_drill_stats_t_proxy, boost::shared_ptr<gerbv_drill_stats_t_proxy> \
>("gerbv_drill_stats_t") //Methods
//Properties
.def_readwrite("layer_count", &gerbv_drill_stats_t_proxy::layer_count)
.add_property("error_list", \
make_getter(&gerbv_drill_stats_t_proxy::error_list, return_internal_reference<>()), \
make_setter(&gerbv_drill_stats_t_proxy::error_list, \
return_internal_reference<>()))
.add_property("drill_list", \
make_getter(&gerbv_drill_stats_t_proxy::drill_list, return_internal_reference<>()), \
make_setter(&gerbv_drill_stats_t_proxy::drill_list, \
return_internal_reference<>()))
.def_readwrite("comment", &gerbv_drill_stats_t_proxy::comment)
.def_readwrite("F", &gerbv_drill_stats_t_proxy::F)
.def_readwrite("G00", &gerbv_drill_stats_t_proxy::G00)
.def_readwrite("G01", &gerbv_drill_stats_t_proxy::G01)
.def_readwrite("G02", &gerbv_drill_stats_t_proxy::G02)
.def_readwrite("G03", &gerbv_drill_stats_t_proxy::G03)
.def_readwrite("G04", &gerbv_drill_stats_t_proxy::G04)
.def_readwrite("G05", &gerbv_drill_stats_t_proxy::G05)
.def_readwrite("G90", &gerbv_drill_stats_t_proxy::G90)
.def_readwrite("G91", &gerbv_drill_stats_t_proxy::G91)
.def_readwrite("G93", &gerbv_drill_stats_t_proxy::G93)
.def_readwrite("G_unknown", &gerbv_drill_stats_t_proxy::G_unknown)
.def_readwrite("M00", &gerbv_drill_stats_t_proxy::M00)
.def_readwrite("M01", &gerbv_drill_stats_t_proxy::M01)
.def_readwrite("M18", &gerbv_drill_stats_t_proxy::M18)
.def_readwrite("M25", &gerbv_drill_stats_t_proxy::M25)
.def_readwrite("M30", &gerbv_drill_stats_t_proxy::M30)
.def_readwrite("M31", &gerbv_drill_stats_t_proxy::M31)
.def_readwrite("M45", &gerbv_drill_stats_t_proxy::M45)
.def_readwrite("M47", &gerbv_drill_stats_t_proxy::M47)
.def_readwrite("M48", &gerbv_drill_stats_t_proxy::M48)
.def_readwrite("M71", &gerbv_drill_stats_t_proxy::M71)
.def_readwrite("M72", &gerbv_drill_stats_t_proxy::M72)
.def_readwrite("M95", &gerbv_drill_stats_t_proxy::M95)
.def_readwrite("M97", &gerbv_drill_stats_t_proxy::M97)
.def_readwrite("M98", &gerbv_drill_stats_t_proxy::M98)
.def_readwrite("M_unknown", &gerbv_drill_stats_t_proxy::M_unknown)
.def_readwrite("R", &gerbv_drill_stats_t_proxy::R)
.def_readwrite("unknown", &gerbv_drill_stats_t_proxy::unknown)
.def_readwrite("total_count", &gerbv_drill_stats_t_proxy::total_count)
.add_property("detect", &gerbv_drill_stats_t_proxy::get_detect, \
&gerbv_drill_stats_t_proxy::set_detect) ;
class_<gerbv_knockout_t, boost::shared_ptr<gerbv_knockout_t> \
>("gerbv_knockout_t") //Methods
//Properties
.def_readwrite("firstInstance", &gerbv_knockout_t::firstInstance)
.def_readwrite("type", &gerbv_knockout_t::type)
.def_readwrite("polarity", &gerbv_knockout_t::polarity)
.def_readwrite("lowerLeftX", &gerbv_knockout_t::lowerLeftX)
.def_readwrite("lowerLeftY", &gerbv_knockout_t::lowerLeftY)
.def_readwrite("width", &gerbv_knockout_t::width)
.def_readwrite("height", &gerbv_knockout_t::height)
.def_readwrite("border", &gerbv_knockout_t::border)
;
class_<gerbv_project_t_proxy, boost::shared_ptr<gerbv_project_t_proxy> \
>("gerbv_project_t") //Methods
//Properties
.def_readwrite("background", &gerbv_project_t_proxy::background)
.def_readwrite("max_files", &gerbv_project_t_proxy::max_files)
.def_readwrite("file", &gerbv_project_t_proxy::file)
.def_readwrite("curr_index", &gerbv_project_t_proxy::curr_index)
.def_readwrite("last_loaded", &gerbv_project_t_proxy::last_loaded)
.def_readwrite("renderType", &gerbv_project_t_proxy::renderType)
.def_readwrite("check_before_delete", \
&gerbv_project_t_proxy::check_before_delete)
.add_property("path", &gerbv_project_t_proxy::get_path, \
&gerbv_project_t_proxy::set_path)
.add_property("execpath", &gerbv_project_t_proxy::get_execpath, \
&gerbv_project_t_proxy::set_execpath)
.add_property("execname", &gerbv_project_t_proxy::get_execname, \
&gerbv_project_t_proxy::set_execname)
.add_property("project", &gerbv_project_t_proxy::get_project, \
&gerbv_project_t_proxy::set_project) ;
class_<gerbv_drill_list_t_proxy, boost::shared_ptr<gerbv_drill_list_t_proxy> \
>("gerbv_drill_list_t") //Methods
//Properties
.def_readwrite("drill_num", &gerbv_drill_list_t_proxy::drill_num)
.def_readwrite("drill_size", &gerbv_drill_list_t_proxy::drill_size)
.add_property("drill_unit", &gerbv_drill_list_t_proxy::get_drill_unit, \
&gerbv_drill_list_t_proxy::set_drill_unit)
.def_readwrite("drill_count", &gerbv_drill_list_t_proxy::drill_count)
.add_property("next", make_getter(&gerbv_drill_list_t_proxy::next, \
return_internal_reference<>()), make_setter(&gerbv_drill_list_t_proxy::next, \
return_internal_reference<>())) ;
class_<gerbv_bbox_t, boost::shared_ptr<gerbv_bbox_t> >("gerbv_bbox_t")
//Methods
//Properties
.def_readwrite("x1", &gerbv_bbox_t::x1)
.def_readwrite("y1", &gerbv_bbox_t::y1)
.def_readwrite("x2", &gerbv_bbox_t::x2)
.def_readwrite("y2", &gerbv_bbox_t::y2)
;
class_<gerbv_layer_t_proxy, boost::shared_ptr<gerbv_layer_t_proxy> \
>("gerbv_layer_t") //Methods
//Properties
.def_readwrite("stepAndRepeat", &gerbv_layer_t_proxy::stepAndRepeat)
.def_readwrite("knockout", &gerbv_layer_t_proxy::knockout)
.def_readwrite("rotation", &gerbv_layer_t_proxy::rotation)
.def_readwrite("polarity", &gerbv_layer_t_proxy::polarity)
.add_property("name", &gerbv_layer_t_proxy::get_name, \
&gerbv_layer_t_proxy::set_name)
.def_readwrite("next", &gerbv_layer_t_proxy::next)
;
gerbv_aperture_t_proxy::parameter_proxy::define_python_class();
class_<gerbv_aperture_t_proxy, boost::shared_ptr<gerbv_aperture_t_proxy> \
>("gerbv_aperture_t") //Methods
//Properties
.def_readwrite("type", &gerbv_aperture_t_proxy::type)
.add_property("amacro", make_getter(&gerbv_aperture_t_proxy::amacro, \
return_internal_reference<>()), make_setter(&gerbv_aperture_t_proxy::amacro, \
return_internal_reference<>()))
.add_property("simplified", make_getter(&gerbv_aperture_t_proxy::simplified, \
return_internal_reference<>()), make_setter(&gerbv_aperture_t_proxy::simplified, \
return_internal_reference<>()))
.def_readwrite("parameter", &gerbv_aperture_t_proxy::parameter_p)
.def_readwrite("nuf_parameters", &gerbv_aperture_t_proxy::nuf_parameters)
.def_readwrite("unit", &gerbv_aperture_t_proxy::unit)
;
class_<gerbv_layer_color, boost::shared_ptr<gerbv_layer_color> \
>("gerbv_layer_color") //Methods
//Properties
.def_readwrite("red", &gerbv_layer_color::red)
.def_readwrite("green", &gerbv_layer_color::green)
.def_readwrite("blue", &gerbv_layer_color::blue)
.def_readwrite("alpha", &gerbv_layer_color::alpha)
;
class_<gerbv_render_info_t, boost::shared_ptr<gerbv_render_info_t> \
>("gerbv_render_info_t") //Methods
//Properties
.def_readwrite("scaleFactorX", &gerbv_render_info_t::scaleFactorX)
.def_readwrite("scaleFactorY", &gerbv_render_info_t::scaleFactorY)
.def_readwrite("lowerLeftX", &gerbv_render_info_t::lowerLeftX)
.def_readwrite("lowerLeftY", &gerbv_render_info_t::lowerLeftY)
.def_readwrite("renderType", &gerbv_render_info_t::renderType)
.def_readwrite("displayWidth", &gerbv_render_info_t::displayWidth)
.def_readwrite("displayHeight", &gerbv_render_info_t::displayHeight)
;
class_<gerbv_selection_item_t, boost::shared_ptr<gerbv_selection_item_t> \
>("gerbv_selection_item_t") //Methods
//Properties
.def_readwrite("image", &gerbv_selection_item_t::image)
.def_readwrite("net", &gerbv_selection_item_t::net)
;
class_<gerbv_step_and_repeat_t, boost::shared_ptr<gerbv_step_and_repeat_t> \
>("gerbv_step_and_repeat_t") //Methods
//Properties
.def_readwrite("X", &gerbv_step_and_repeat_t::X)
.def_readwrite("Y", &gerbv_step_and_repeat_t::Y)
.def_readwrite("dist_X", &gerbv_step_and_repeat_t::dist_X)
.def_readwrite("dist_Y", &gerbv_step_and_repeat_t::dist_Y)
;
class_<gerbv_image_info_t_proxy, boost::shared_ptr<gerbv_image_info_t_proxy> \
>("gerbv_image_info_t") //Methods
//Properties
.add_property("name", &gerbv_image_info_t_proxy::get_name, \
&gerbv_image_info_t_proxy::set_name)
.def_readwrite("polarity", &gerbv_image_info_t_proxy::polarity)
.def_readwrite("min_x", &gerbv_image_info_t_proxy::min_x)
.def_readwrite("min_y", &gerbv_image_info_t_proxy::min_y)
.def_readwrite("max_x", &gerbv_image_info_t_proxy::max_x)
.def_readwrite("max_y", &gerbv_image_info_t_proxy::max_y)
.def_readwrite("offsetA", &gerbv_image_info_t_proxy::offsetA)
.def_readwrite("offsetB", &gerbv_image_info_t_proxy::offsetB)
.def_readwrite("encoding", &gerbv_image_info_t_proxy::encoding)
.def_readwrite("imageRotation", &gerbv_image_info_t_proxy::imageRotation)
.def_readwrite("imageJustifyTypeA", \
&gerbv_image_info_t_proxy::imageJustifyTypeA)
.def_readwrite("imageJustifyTypeB", \
&gerbv_image_info_t_proxy::imageJustifyTypeB)
.def_readwrite("imageJustifyOffsetA", \
&gerbv_image_info_t_proxy::imageJustifyOffsetA)
.def_readwrite("imageJustifyOffsetB", \
&gerbv_image_info_t_proxy::imageJustifyOffsetB)
.def_readwrite("imageJustifyOffsetActualA", \
&gerbv_image_info_t_proxy::imageJustifyOffsetActualA)
.def_readwrite("imageJustifyOffsetActualB", \
&gerbv_image_info_t_proxy::imageJustifyOffsetActualB)
.add_property("plotterFilm", &gerbv_image_info_t_proxy::get_plotterFilm, \
&gerbv_image_info_t_proxy::set_plotterFilm)
.add_property("type", &gerbv_image_info_t_proxy::get_type, \
&gerbv_image_info_t_proxy::set_type)
.add_property("attr_list", make_getter(&gerbv_image_info_t_proxy::attr_list, \
return_internal_reference<>()), make_setter(&gerbv_image_info_t_proxy::attr_list, \
return_internal_reference<>()))
.def_readwrite("n_attr", &gerbv_image_info_t_proxy::n_attr)
;
class_<gerbv_HID_Attribute_proxy, boost::shared_ptr<gerbv_HID_Attribute_proxy> \
>("gerbv_HID_Attribute") //Methods
//Properties
.add_property("name", &gerbv_HID_Attribute_proxy::get_name, \
&gerbv_HID_Attribute_proxy::set_name)
.add_property("help_text", &gerbv_HID_Attribute_proxy::get_help_text, \
&gerbv_HID_Attribute_proxy::set_help_text)
.def_readwrite("type", &gerbv_HID_Attribute_proxy::type)
.def_readwrite("min_val", &gerbv_HID_Attribute_proxy::min_val)
.def_readwrite("max_val", &gerbv_HID_Attribute_proxy::max_val)
.def_readwrite("default_val", &gerbv_HID_Attribute_proxy::default_val)
.def_readwrite("enumerations", &gerbv_HID_Attribute_proxy::enumerations)
// .add_property("value", make_getter(&gerbv_HID_Attribute_proxy::value, \
return_internal_reference<>()), make_setter(&gerbv_HID_Attribute_proxy::value, \
return_internal_reference<>()))
.def_readwrite("hash", &gerbv_HID_Attribute_proxy::hash)
;
gerbv_simplified_amacro_t_proxy::parameter_proxy::define_python_class();
class_<gerbv_simplified_amacro_t_proxy, \
boost::shared_ptr<gerbv_simplified_amacro_t_proxy> >("gerbv_simplified_amacro_t") \
//Methods //Properties
.def_readwrite("type", &gerbv_simplified_amacro_t_proxy::type)
.def_readwrite("parameter", &gerbv_simplified_amacro_t_proxy::parameter_p)
.add_property("next", make_getter(&gerbv_simplified_amacro_t_proxy::next, \
return_internal_reference<>()), make_setter(&gerbv_simplified_amacro_t_proxy::next, \
return_internal_reference<>())) ;
gerbv_aperture_list_t_proxy::parameter_proxy::define_python_class();
class_<gerbv_aperture_list_t_proxy, \
boost::shared_ptr<gerbv_aperture_list_t_proxy> >("gerbv_aperture_list_t") //Methods
//Properties
.def_readwrite("number", &gerbv_aperture_list_t_proxy::number)
.def_readwrite("layer", &gerbv_aperture_list_t_proxy::layer)
.def_readwrite("count", &gerbv_aperture_list_t_proxy::count)
.def_readwrite("type", &gerbv_aperture_list_t_proxy::type)
.def_readwrite("parameter", &gerbv_aperture_list_t_proxy::parameter_p)
.add_property("next", make_getter(&gerbv_aperture_list_t_proxy::next, \
return_internal_reference<>()), make_setter(&gerbv_aperture_list_t_proxy::next, \
return_internal_reference<>())) ;
class_<gerbv_instruction_t, boost::shared_ptr<gerbv_instruction_t> \
>("gerbv_instruction_t") //Methods
//Properties
.def_readwrite("opcode", &gerbv_instruction_t::opcode)
.def_readwrite("data", &gerbv_instruction_t::data)
.add_property("next", make_getter(&gerbv_instruction_t::next, \
return_internal_reference<>()), make_setter(&gerbv_instruction_t::next, \
return_internal_reference<>())) ;
class_<gerbv_stats_t, boost::shared_ptr<gerbv_stats_t> >("gerbv_stats_t")
//Methods
//Properties
.add_property("error_list", make_getter(&gerbv_stats_t::error_list, \
return_internal_reference<>()), make_setter(&gerbv_stats_t::error_list, \
return_internal_reference<>()))
.add_property("aperture_list", make_getter(&gerbv_stats_t::aperture_list, \
return_internal_reference<>()), make_setter(&gerbv_stats_t::aperture_list, \
return_internal_reference<>()))
.add_property("D_code_list", make_getter(&gerbv_stats_t::D_code_list, \
return_internal_reference<>()), make_setter(&gerbv_stats_t::D_code_list, \
return_internal_reference<>()))
.def_readwrite("layer_count", &gerbv_stats_t::layer_count)
.def_readwrite("G0", &gerbv_stats_t::G0)
.def_readwrite("G1", &gerbv_stats_t::G1)
.def_readwrite("G2", &gerbv_stats_t::G2)
.def_readwrite("G3", &gerbv_stats_t::G3)
.def_readwrite("G4", &gerbv_stats_t::G4)
.def_readwrite("G10", &gerbv_stats_t::G10)
.def_readwrite("G11", &gerbv_stats_t::G11)
.def_readwrite("G12", &gerbv_stats_t::G12)
.def_readwrite("G36", &gerbv_stats_t::G36)
.def_readwrite("G37", &gerbv_stats_t::G37)
.def_readwrite("G54", &gerbv_stats_t::G54)
.def_readwrite("G55", &gerbv_stats_t::G55)
.def_readwrite("G70", &gerbv_stats_t::G70)
.def_readwrite("G71", &gerbv_stats_t::G71)
.def_readwrite("G74", &gerbv_stats_t::G74)
.def_readwrite("G75", &gerbv_stats_t::G75)
.def_readwrite("G90", &gerbv_stats_t::G90)
.def_readwrite("G91", &gerbv_stats_t::G91)
.def_readwrite("G_unknown", &gerbv_stats_t::G_unknown)
.def_readwrite("D1", &gerbv_stats_t::D1)
.def_readwrite("D2", &gerbv_stats_t::D2)
.def_readwrite("D3", &gerbv_stats_t::D3)
.def_readwrite("D_unknown", &gerbv_stats_t::D_unknown)
.def_readwrite("D_error", &gerbv_stats_t::D_error)
.def_readwrite("M0", &gerbv_stats_t::M0)
.def_readwrite("M1", &gerbv_stats_t::M1)
.def_readwrite("M2", &gerbv_stats_t::M2)
.def_readwrite("M_unknown", &gerbv_stats_t::M_unknown)
.def_readwrite("X", &gerbv_stats_t::X)
.def_readwrite("Y", &gerbv_stats_t::Y)
.def_readwrite("I", &gerbv_stats_t::I)
.def_readwrite("J", &gerbv_stats_t::J)
.def_readwrite("star", &gerbv_stats_t::star)
.def_readwrite("unknown", &gerbv_stats_t::unknown)
;
class_<gerbv_fileinfo_t_proxy, boost::shared_ptr<gerbv_fileinfo_t_proxy> \
>("gerbv_fileinfo_t") //Methods
//Properties
.add_property("image", make_getter(&gerbv_fileinfo_t_proxy::image, \
return_internal_reference<>()), make_setter(&gerbv_fileinfo_t_proxy::image, \
return_internal_reference<>()))
.def_readwrite("color", &gerbv_fileinfo_t_proxy::color)
.def_readwrite("alpha", &gerbv_fileinfo_t_proxy::alpha)
.def_readwrite("isVisible", &gerbv_fileinfo_t_proxy::isVisible)
.def_readwrite("privateRenderData", \
&gerbv_fileinfo_t_proxy::privateRenderData)
.add_property("fullPathname", &gerbv_fileinfo_t_proxy::get_fullPathname, \
&gerbv_fileinfo_t_proxy::set_fullPathname)
.add_property("name", &gerbv_fileinfo_t_proxy::get_name, \
&gerbv_fileinfo_t_proxy::set_name)
.def_readwrite("transform", &gerbv_fileinfo_t_proxy::transform)
.def_readwrite("layer_dirty", &gerbv_fileinfo_t_proxy::layer_dirty)
;
class_<gerbv_render_size_t, boost::shared_ptr<gerbv_render_size_t> \
>("gerbv_render_size_t") //Methods
//Properties
.def_readwrite("left", &gerbv_render_size_t::left)
.def_readwrite("right", &gerbv_render_size_t::right)
.def_readwrite("bottom", &gerbv_render_size_t::bottom)
.def_readwrite("top", &gerbv_render_size_t::top)
;
class_<gerbv_error_list_t_proxy, boost::shared_ptr<gerbv_error_list_t_proxy> \
>("gerbv_error_list_t") //Methods
//Properties
.def_readwrite("layer", &gerbv_error_list_t_proxy::layer)
.add_property("error_text", &gerbv_error_list_t_proxy::get_error_text, \
&gerbv_error_list_t_proxy::set_error_text)
.def_readwrite("type", &gerbv_error_list_t_proxy::type)
.add_property("next", make_getter(&gerbv_error_list_t_proxy::next, \
return_internal_reference<>()), make_setter(&gerbv_error_list_t_proxy::next, \
return_internal_reference<>())) ;
class_<gerbv_netstate_t, boost::shared_ptr<gerbv_netstate_t> \
>("gerbv_netstate_t") //Methods
//Properties
.def_readwrite("axisSelect", &gerbv_netstate_t::axisSelect)
.def_readwrite("mirrorState", &gerbv_netstate_t::mirrorState)
.def_readwrite("unit", &gerbv_netstate_t::unit)
.def_readwrite("offsetA", &gerbv_netstate_t::offsetA)
.def_readwrite("offsetB", &gerbv_netstate_t::offsetB)
.def_readwrite("scaleA", &gerbv_netstate_t::scaleA)
.def_readwrite("scaleB", &gerbv_netstate_t::scaleB)
.def_readwrite("next", &gerbv_netstate_t::next)
;
class_<gerbv_net_t, boost::shared_ptr<gerbv_net_t> >("gerbv_net_t")
//Methods
//Properties
.def_readwrite("start_x", &gerbv_net_t::start_x)
.def_readwrite("start_y", &gerbv_net_t::start_y)
.def_readwrite("stop_x", &gerbv_net_t::stop_x)
.def_readwrite("stop_y", &gerbv_net_t::stop_y)
.def_readwrite("boundingBox", &gerbv_net_t::boundingBox)
.def_readwrite("aperture", &gerbv_net_t::aperture)
.def_readwrite("aperture_state", &gerbv_net_t::aperture_state)
.def_readwrite("interpolation", &gerbv_net_t::interpolation)
.add_property("cirseg", make_getter(&gerbv_net_t::cirseg, \
return_internal_reference<>()), make_setter(&gerbv_net_t::cirseg, \
return_internal_reference<>()))
.add_property("next", make_getter(&gerbv_net_t::next, \
return_internal_reference<>()), make_setter(&gerbv_net_t::next, \
return_internal_reference<>()))
.add_property("label", make_getter(&gerbv_net_t::label, \
return_internal_reference<>()), make_setter(&gerbv_net_t::label, \
return_internal_reference<>()))
.add_property("layer", make_getter(&gerbv_net_t::layer, \
return_internal_reference<>()), make_setter(&gerbv_net_t::layer, \
return_internal_reference<>()))
.add_property("state", make_getter(&gerbv_net_t::state, \
return_internal_reference<>()), make_setter(&gerbv_net_t::state, \
return_internal_reference<>())) ;
gerbv_image_t_proxy::aperture_proxy::define_python_class();
class_<gerbv_image_t_proxy, boost::shared_ptr<gerbv_image_t_proxy> \
>("gerbv_image_t") //Methods
//Properties
.def_readwrite("layertype", &gerbv_image_t_proxy::layertype)
.def_readwrite("aperture", &gerbv_image_t_proxy::aperture_p)
.add_property("layers", make_getter(&gerbv_image_t_proxy::layers, \
return_internal_reference<>()), make_setter(&gerbv_image_t_proxy::layers, \
return_internal_reference<>()))
.add_property("states", make_getter(&gerbv_image_t_proxy::states, \
return_internal_reference<>()), make_setter(&gerbv_image_t_proxy::states, \
return_internal_reference<>()))
.add_property("amacro", make_getter(&gerbv_image_t_proxy::amacro, \
return_internal_reference<>()), make_setter(&gerbv_image_t_proxy::amacro, \
return_internal_reference<>()))
.add_property("format", make_getter(&gerbv_image_t_proxy::format, \
return_internal_reference<>()), make_setter(&gerbv_image_t_proxy::format, \
return_internal_reference<>()))
.add_property("info", make_getter(&gerbv_image_t_proxy::info, \
return_internal_reference<>()), make_setter(&gerbv_image_t_proxy::info, \
return_internal_reference<>()))
.add_property("netlist", make_getter(&gerbv_image_t_proxy::netlist, \
return_internal_reference<>()), make_setter(&gerbv_image_t_proxy::netlist, \
return_internal_reference<>()))
.add_property("gerbv_stats", make_getter(&gerbv_image_t_proxy::gerbv_stats, \
return_internal_reference<>()), make_setter(&gerbv_image_t_proxy::gerbv_stats, \
return_internal_reference<>()))
.add_property("drill_stats", make_getter(&gerbv_image_t_proxy::drill_stats, \
return_internal_reference<>()), make_setter(&gerbv_image_t_proxy::drill_stats, \
return_internal_reference<>())) ;
/*def("gerbv_create_image", gerbv_create_image);
def("gerbv_destroy_image", gerbv_destroy_image);
def("gerbv_image_copy_image", gerbv_image_copy_image);
def("gerbv_image_duplicate_image", gerbv_image_duplicate_image);
def("gerbv_image_delete_net", gerbv_image_delete_net);
def("gerbv_image_delete_selected_nets", gerbv_image_delete_selected_nets);
def("gerbv_image_reduce_area_of_selected_objects", \
gerbv_image_reduce_area_of_selected_objects);
def("gerbv_image_move_selected_objects", gerbv_image_move_selected_objects);
def("gerbv_image_return_next_renderable_object", \
gerbv_image_return_next_renderable_object);
def("gerbv_create_project", gerbv_create_project);
def("gerbv_destroy_project", gerbv_destroy_project);
def("gerbv_open_layer_from_filename", gerbv_open_layer_from_filename);
def("gerbv_open_layer_from_filename_with_color", \
gerbv_open_layer_from_filename_with_color);
def("gerbv_destroy_fileinfo", gerbv_destroy_fileinfo);
def("gerbv_save_layer_from_index", gerbv_save_layer_from_index);
def("gerbv_revert_file", gerbv_revert_file);
def("gerbv_revert_all_files", gerbv_revert_all_files);
def("gerbv_unload_layer", gerbv_unload_layer);
def("gerbv_unload_all_layers", gerbv_unload_all_layers);
def("gerbv_change_layer_order", gerbv_change_layer_order);
def("gerbv_add_parsed_image_to_project", gerbv_add_parsed_image_to_project);
def("gerbv_open_image", gerbv_open_image);
def("gerbv_render_get_boundingbox", gerbv_render_get_boundingbox);
def("gerbv_render_zoom_to_fit_display", gerbv_render_zoom_to_fit_display);
def("gerbv_render_translate_to_fit_display", \
gerbv_render_translate_to_fit_display);
def("gerbv_render_to_pixmap_using_gdk", gerbv_render_to_pixmap_using_gdk);
def("gerbv_render_all_layers_to_cairo_target_for_vector_output", \
gerbv_render_all_layers_to_cairo_target_for_vector_output);
def("gerbv_render_all_layers_to_cairo_target", \
gerbv_render_all_layers_to_cairo_target);
def("gerbv_render_layer_to_cairo_target", gerbv_render_layer_to_cairo_target);
def("gerbv_render_cairo_set_scale_and_translation", \
gerbv_render_cairo_set_scale_and_translation);
def("gerbv_render_layer_to_cairo_target_without_transforming", \
gerbv_render_layer_to_cairo_target_without_transforming);
def("gerbv_get_tool_diameter", gerbv_get_tool_diameter);
def("gerbv_process_tools_file", gerbv_process_tools_file);
def("gerbv_export_png_file_from_project_autoscaled", \
gerbv_export_png_file_from_project_autoscaled);
def("gerbv_export_png_file_from_project", gerbv_export_png_file_from_project);
def("gerbv_export_pdf_file_from_project_autoscaled", \
gerbv_export_pdf_file_from_project_autoscaled);
def("gerbv_export_pdf_file_from_project", gerbv_export_pdf_file_from_project);
def("gerbv_export_postscript_file_from_project_autoscaled", \
gerbv_export_postscript_file_from_project_autoscaled);
def("gerbv_export_postscript_file_from_project", \
gerbv_export_postscript_file_from_project);
def("gerbv_export_svg_file_from_project_autoscaled", \
gerbv_export_svg_file_from_project_autoscaled);
def("gerbv_export_svg_file_from_project", gerbv_export_svg_file_from_project);
def("gerbv_create_rs274x_image_from_filename", \
gerbv_create_rs274x_image_from_filename);
def("gerbv_export_rs274x_file_from_image", gerbv_export_rs274x_file_from_image);
def("gerbv_export_drill_file_from_image", gerbv_export_drill_file_from_image);
def("gerbv_image_create_line_object", gerbv_image_create_line_object);
def("gerbv_image_create_arc_object", gerbv_image_create_arc_object);
def("gerbv_image_create_rectangle_object", gerbv_image_create_rectangle_object);
def("gerbv_image_create_dummy_apertures", gerbv_image_create_dummy_apertures);
def("gerbv_drill_stats_new", gerbv_drill_stats_new);
def("gerbv_drill_stats_destroy", gerbv_drill_stats_destroy);
def("gerbv_drill_stats_add_layer", gerbv_drill_stats_add_layer);
def("gerbv_stats_new", gerbv_stats_new);
def("gerbv_stats_destroy", gerbv_stats_destroy);
def("gerbv_stats_add_layer", gerbv_stats_add_layer);
def("gerbv_attribute_destroy_HID_attribute", \
gerbv_attribute_destroy_HID_attribute);
def("gerbv_attribute_dup", gerbv_attribute_dup);*/
}
// end of file
["gerbv.h" (text/plain)]
/*
* gEDA - GNU Electronic Design Automation
* This file is a part of gerbv.
*
* Copyright (C) 2000-2003 Stefan Petersen (spe@stacken.kth.se)
*
* $Id$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
*/
//! \example example1.c
//! \example example2.c
//! \example example3.c
//! \example example4.c
//! \example example5.c
//! \example example6.c
//! \defgroup libgerbv libgerbv
//! \defgroup gerbv Gerbv
/** \file gerbv.h
\brief The main header file for the libgerbv library
\ingroup libgerbv
*/
/**
\mainpage Gerbv/libgerbv Index Page
\section intro_sec Introduction
Gerbv is a program which can display, edit, export, and do other manipulation of
file formats used in PCB design (RS274X, Excellon drill, and pick-and-place). The \
core library (libgerbv) is available as a separate library, allowing other software \
to easily incorporate advanced Gerber functionality.
This code documentation is mainly intended to help explain the libgerbv API to \
developers wishing to use libgerbv in his/her own projects. The easiest way to learn \
to use libgerbv is by reading through and compiling the example source files (click \
on "Examples" in the navigation tree in the left pane, or look in the \
doc/example-code/ directory in CVS).
For help with using the standalone Gerbv software, please refer to the man page \
(using the command "man gerbv") or go to the Gerbv homepage for documentation \
(http://gerbv.sourceforge.net).
*/
#ifndef __GERBV_H__
#define __GERBV_H__
#if defined(__cplusplus)
extern "C" {
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <glib.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
#ifndef RENDER_USING_GDK
#include <cairo.h>
#endif
#define APERTURE_MIN 10
#define APERTURE_MAX 9999
/*
* Maximum number of aperture parameters is set by the outline aperture
* macro. There (p. 28) is defined up to 50 points in polygon.
* So 50 points with x and y plus two for holding extra data gives...
*/
#define APERTURE_PARAMETERS_MAX 102
#define INITIAL_SCALE 200
#define MAX_ERRMSGLEN 25
#define MAX_COORDLEN 28
#define MAX_DISTLEN 90
#define MAX_STATUSMSGLEN (MAX_ERRMSGLEN+MAX_COORDLEN+MAX_DISTLEN)
/* Macros to convert between unscaled gerber coordinates and other units */
/* XXX NOTE: Currently unscaled units are assumed as inch, this is not
XXX necessarily true for all files */
#define COORD2MILS(c) ((c)*1000.0)
#define COORD2MMS(c) ((c)*25.4)
#define GERB_FATAL_ERROR(t...) g_log(NULL, G_LOG_LEVEL_ERROR, ##t);
#define GERB_COMPILE_ERROR(t...) g_log(NULL, G_LOG_LEVEL_CRITICAL, ##t);
#define GERB_COMPILE_WARNING(t...) g_log(NULL, G_LOG_LEVEL_WARNING, ##t);
#define GERB_MESSAGE(t...) g_log(NULL, G_LOG_LEVEL_MESSAGE, ##t);
/*! The aperture macro commands */
typedef enum {GERBV_OPCODE_NOP, /*!< no operation */
GERBV_OPCODE_PUSH, /*!< push the instruction onto the stack */
GERBV_OPCODE_PPUSH, /*!< push parameter onto stack */
GERBV_OPCODE_PPOP, /*!< pop parameter from stack */
GERBV_OPCODE_ADD, /*!< mathmatical add operation */
GERBV_OPCODE_SUB, /*!< mathmatical subtract operation */
GERBV_OPCODE_MUL, /*!< mathmatical multiply operation */
GERBV_OPCODE_DIV, /*!< mathmatical divide operation */
GERBV_OPCODE_PRIM /*!< draw macro primative */
} gerbv_opcodes_t;
/*! The different message types used in libgerbv */
typedef enum {GERBV_MESSAGE_FATAL, /*!< processing cannot continue */
GERBV_MESSAGE_ERROR, /*!< something went wrong, but processing can still continue \
*/ GERBV_MESSAGE_WARNING, /*!< something was encountered that may provide the wrong \
output */ GERBV_MESSAGE_NOTE /*!< an irregularity was encountered, but needs no \
intervention */ } gerbv_message_type_t;
/*! The different aperture types available
* Please keep these in sync with the aperture names defined by
* ap_names in callbacks.c */
typedef enum {GERBV_APTYPE_NONE, /*!< no aperture used */
GERBV_APTYPE_CIRCLE, /*!< a round aperture */
GERBV_APTYPE_RECTANGLE, /*!< a rectangular aperture */
GERBV_APTYPE_OVAL, /*!< an ovular (obround) aperture */
GERBV_APTYPE_POLYGON, /*!< a polygon aperture */
GERBV_APTYPE_MACRO, /*!< a RS274X macro */
GERBV_APTYPE_MACRO_CIRCLE, /*!< a RS274X circle macro */
GERBV_APTYPE_MACRO_OUTLINE, /*!< a RS274X outline macro */
GERBV_APTYPE_MACRO_POLYGON, /*!< a RS274X polygon macro */
GERBV_APTYPE_MACRO_MOIRE, /*!< a RS274X moire macro */
GERBV_APTYPE_MACRO_THERMAL, /*!< a RS274X thermal macro */
GERBV_APTYPE_MACRO_LINE20, /*!< a RS274X line (code 20) macro */
GERBV_APTYPE_MACRO_LINE21, /*!< a RS274X line (code 21) macro */
GERBV_APTYPE_MACRO_LINE22 /*!< a RS274X line (code 22) macro */
} gerbv_aperture_type_t;
/*! the current state of the aperture drawing tool */
typedef enum {GERBV_APERTURE_STATE_OFF, /*!< tool drawing is off, and nothing will be \
drawn */ GERBV_APERTURE_STATE_ON, /*!< tool drawing is on, and something will be \
drawn */ GERBV_APERTURE_STATE_FLASH /*!< tool is flashing, and will draw a single \
aperture */ } gerbv_aperture_state_t;
/*! the current unit used */
typedef enum {GERBV_UNIT_INCH, /*!< inches */
GERBV_UNIT_MM, /*!< mm */
GERBV_UNIT_UNSPECIFIED /*!< use default units */
} gerbv_unit_t;
/*! the different drawing polarities available */
typedef enum {GERBV_POLARITY_POSITIVE, /*!< draw "positive", using the current \
layer's polarity */ GERBV_POLARITY_NEGATIVE, /*!< draw "negative", reversing the \
current layer's polarity */ GERBV_POLARITY_DARK, /*!< add to the current rendering \
*/ GERBV_POLARITY_CLEAR /*!< subtract from the current rendering */
} gerbv_polarity_t;
/*! the decimal point parsing style used */
typedef enum {GERBV_OMIT_ZEROS_LEADING, /*!< omit extra zeros before the decimal \
point */ GERBV_OMIT_ZEROS_TRAILING, /*!< omit extra zeros after the decimal point */
GERBV_OMIT_ZEROS_EXPLICIT, /*!< explicitly specify how many decimal places are used \
*/ GERBV_OMIT_ZEROS_UNSPECIFIED /*!< use the default parsing style */
} gerbv_omit_zeros_t;
/*! the coordinate system used */
typedef enum {GERBV_COORDINATE_ABSOLUTE, /*!< all coordinates are absolute from a \
common origin */ GERBV_COORDINATE_INCREMENTAL /*!< all coordinates are relative to \
the previous coordinate */ } gerbv_coordinate_t;
/*! the interpolation methods available */
typedef enum {GERBV_INTERPOLATION_LINEARx1, /*!< draw a line */
GERBV_INTERPOLATION_x10, /*!< draw a line */
GERBV_INTERPOLATION_LINEARx01, /*!< draw a line */
GERBV_INTERPOLATION_LINEARx001, /*!< draw a line */
GERBV_INTERPOLATION_CW_CIRCULAR, /*!< draw an arc in the clockwise direction */
GERBV_INTERPOLATION_CCW_CIRCULAR, /*!< draw an arc in the counter-clockwise \
direction */ GERBV_INTERPOLATION_PAREA_START, /*!< start a polygon draw */
GERBV_INTERPOLATION_PAREA_END, /*!< end a polygon draw */
GERBV_INTERPOLATION_DELETED /*!< the net has been deleted by the user, and will not \
be drawn */ } gerbv_interpolation_t;
typedef enum {GERBV_ENCODING_NONE,
GERBV_ENCODING_ASCII,
GERBV_ENCODING_EBCDIC,
GERBV_ENCODING_BCD,
GERBV_ENCODING_ISO_ASCII,
GERBV_ENCODING_EIA
} gerbv_encoding_t;
/*! The different layer types used */
typedef enum {GERBV_LAYERTYPE_RS274X, /*!< the file is a RS274X file */
GERBV_LAYERTYPE_DRILL, /*!< the file is an Excellon drill file */
GERBV_LAYERTYPE_PICKANDPLACE /*!< the file is a CSV pick and place file */
} gerbv_layertype_t;
typedef enum {GERBV_KNOCKOUT_TYPE_NOKNOCKOUT,
GERBV_KNOCKOUT_TYPE_FIXEDKNOCK,
GERBV_KNOCKOUT_TYPE_BORDER
} gerbv_knockout_type_t;
typedef enum {GERBV_MIRROR_STATE_NOMIRROR,
GERBV_MIRROR_STATE_FLIPA,
GERBV_MIRROR_STATE_FLIPB,
GERBV_MIRROR_STATE_FLIPAB
} gerbv_mirror_state_t;
typedef enum {GERBV_AXIS_SELECT_NOSELECT,
GERBV_AXIS_SELECT_SWAPAB
} gerbv_axis_select_t;
typedef enum {GERBV_JUSTIFY_NOJUSTIFY,
GERBV_JUSTIFY_LOWERLEFT,
GERBV_JUSTIFY_CENTERJUSTIFY
} gerbv_image_justify_type_t;
/*! The different selection modes available */
typedef enum {GERBV_SELECTION_EMPTY, /*!< the selection buffer is empty */
GERBV_SELECTION_POINT_CLICK, /*!< the user clicked on a single point */
GERBV_SELECTION_DRAG_BOX /*!< the user dragged a box to encompass one or more \
objects */ } gerbv_selection_t;
/*! The different rendering modes available to libgerbv */
typedef enum {GERBV_RENDER_TYPE_GDK, /*!< render using normal GDK drawing functions \
*/ GERBV_RENDER_TYPE_GDK_XOR, /*!< use the GDK_XOR mask to draw a pseudo-transparent \
scene */ GERBV_RENDER_TYPE_CAIRO_NORMAL, /*!< use the cairo library */
GERBV_RENDER_TYPE_CAIRO_HIGH_QUALITY, /*!< use the cairo library with the smoothest \
edges */ GERBV_RENDER_TYPE_MAX /*!< End-of-enum indicator */
} gerbv_render_types_t;
/*
* The following typedef's are taken directly from src/hid.h in the
* pcb project. The names are kept the same to make it easier to
* compare to pcb's sources.
*/
/* Used for HID attributes (exporting and printing, mostly).
HA_boolean uses int_value, HA_enum sets int_value to the index and
str_value to the enumeration string. HID_Label just shows the
default str_value. HID_Mixed is a real_value followed by an enum,
like 0.5in or 100mm.
*/
typedef struct {
int int_value;
char *str_value;
double real_value;
} gerbv_HID_Attr_Val;
typedef struct {
char *name;
char *help_text;
enum
{ HID_Label, HID_Integer, HID_Real, HID_String,
HID_Boolean, HID_Enum, HID_Mixed, HID_Path
} type;
int min_val, max_val; /* for integer and real */
gerbv_HID_Attr_Val default_val; /* Also actual value for global attributes. */
const char **enumerations;
/* If set, this is used for global attributes (i.e. those set
statically with REGISTER_ATTRIBUTES below) instead of changing
the default_val. Note that a HID_Mixed attribute must specify a
pointer to gerbv_HID_Attr_Val here, and HID_Boolean assumes this is
"char *" so the value should be initialized to zero, and may be
set to non-zero (not always one). */
void *value;
int hash; /* for detecting changes. */
} gerbv_HID_Attribute;
/* end of HID attributes from PCB */
/*! A linked list of errors found in the files */
typedef struct error_list {
int layer;
gchar *error_text;
gerbv_message_type_t type;
struct error_list *next;
} gerbv_error_list_t;
typedef struct instruction {
gerbv_opcodes_t opcode;
union {
int ival;
float fval;
} data;
struct instruction *next;
} gerbv_instruction_t;
typedef struct amacro {
gchar *name;
gerbv_instruction_t *program;
unsigned int nuf_push; /* Nuf pushes in program to estimate stack size */
struct amacro *next;
} gerbv_amacro_t;
typedef struct gerbv_simplified_amacro {
gerbv_aperture_type_t type;
double parameter[APERTURE_PARAMETERS_MAX];
struct gerbv_simplified_amacro *next;
} gerbv_simplified_amacro_t;
typedef struct gerbv_aperture {
gerbv_aperture_type_t type;
gerbv_amacro_t *amacro;
gerbv_simplified_amacro_t *simplified;
double parameter[APERTURE_PARAMETERS_MAX];
int nuf_parameters;
gerbv_unit_t unit;
} gerbv_aperture_t;
/* the gerb_aperture_list is used to keep track of
* apertures used in stats reporting */
typedef struct gerbv_aperture_list {
int number;
int layer;
int count;
gerbv_aperture_type_t type;
double parameter[5];
struct gerbv_aperture_list *next;
} gerbv_aperture_list_t;
/*! Contains statistics on the various codes used in a RS274X file */
typedef struct {
gerbv_error_list_t *error_list;
gerbv_aperture_list_t *aperture_list;
gerbv_aperture_list_t *D_code_list;
int layer_count;
int G0;
int G1;
int G2;
int G3;
int G4;
int G10;
int G11;
int G12;
int G36;
int G37;
int G54;
int G55;
int G70;
int G71;
int G74;
int G75;
int G90;
int G91;
int G_unknown;
int D1;
int D2;
int D3;
/* GHashTable *D_user_defined; */
int D_unknown;
int D_error;
int M0;
int M1;
int M2;
int M_unknown;
int X;
int Y;
int I;
int J;
/* Must include % RS-274 codes */
int star;
int unknown;
} gerbv_stats_t;
/*! Linked list of drills found in active layers. Used in reporting statistics */
typedef struct drill_list {
int drill_num;
double drill_size;
gchar *drill_unit;
int drill_count;
struct drill_list *next;
} gerbv_drill_list_t;
/*! Struct holding statistics of drill commands used. Used in reporting statistics \
*/ typedef struct {
int layer_count;
gerbv_error_list_t *error_list;
gerbv_drill_list_t *drill_list;
int comment;
int F;
int G00;
int G01;
int G02;
int G03;
int G04;
int G05;
int G90;
int G91;
int G93;
int G_unknown;
int M00;
int M01;
int M18;
int M25;
int M30;
int M31;
int M45;
int M47;
int M48;
int M71;
int M72;
int M95;
int M97;
int M98;
int M_unknown;
int R;
int unknown;
/* used to total up the drill count across all layers/sizes */
int total_count;
char *detect;
} gerbv_drill_stats_t;
typedef struct {
gpointer image;
gpointer net;
} gerbv_selection_item_t;
/*! Struct holding info about the last selection */
typedef struct {
gerbv_selection_t type;
gdouble lowerLeftX;
gdouble lowerLeftY;
gdouble upperRightX;
gdouble upperRightY;
GArray *selectedNodeArray;
} gerbv_selection_info_t;
/*! Stores image transformation information, used to modify the rendered
position/scale/etc of an image. */
typedef struct {
gdouble translateX; /*!< the X translation (in inches) */
gdouble translateY; /*!< the Y translation (in inches) */
gdouble scaleX; /*!< the X scale factor (1.0 is default) */
gdouble scaleY; /*!< the Y scale factor (1.0 is default) */
gdouble rotation; /*!< the rotation of the layer around the origin (in radians) \
*/ gboolean mirrorAroundX; /*!< TRUE if the layer is mirrored around the X axis \
(vertical flip) */ gboolean mirrorAroundY; /*!< TRUE if the layer is mirrored \
around the Y axis (vertical flip) */ gboolean inverted; /*!< TRUE if the image \
should be rendered "inverted" (light is dark and vice versa) */ } \
gerbv_user_transformation_t;
/*! This defines a box location and size (used to rendering logic) */
typedef struct {
double left; /*!< the X coordinate of the left side */
double right; /*!< the X coordinate of the right side */
double bottom; /*!< the Y coordinate of the bottom side */
double top; /*!< the Y coordinate of the top side */
} gerbv_render_size_t;
typedef struct gerbv_cirseg {
double cp_x;
double cp_y;
double width; /* of oval */
double height; /* of oval */
double angle1;
double angle2;
} gerbv_cirseg_t;
typedef struct gerbv_step_and_repeat { /* SR parameters */
int X;
int Y;
double dist_X;
double dist_Y;
} gerbv_step_and_repeat_t;
typedef struct {
gboolean firstInstance;
gerbv_knockout_type_t type;
gerbv_polarity_t polarity;
gdouble lowerLeftX;
gdouble lowerLeftY;
gdouble width;
gdouble height;
gdouble border;
} gerbv_knockout_t;
/*! The structure used to keep track of RS274X layer groups */
typedef struct {
gerbv_step_and_repeat_t stepAndRepeat; /*!< the current step and repeat group \
(refer to RS274X spec) */ gerbv_knockout_t knockout; /*!< the current knockout group \
(refer to RS274X spec) */ gdouble rotation; /*!< the current rotation around the \
origin */ gerbv_polarity_t polarity; /*!< the polarity of this layer */
gchar *name; /*!< the layer name (NULL for none) */
gpointer next; /*!< the next layer group in the array */
} gerbv_layer_t;
/*! The structure used to keep track of RS274X state groups */
typedef struct {
gerbv_axis_select_t axisSelect; /*!< the AB to XY coordinate mapping (refer to \
RS274X spec) */ gerbv_mirror_state_t mirrorState; /*!< any mirroring around the X or \
Y axis */ gerbv_unit_t unit; /*!< the current length unit */
gdouble offsetA; /*!< the offset along the A axis (usually this is the X axis) */
gdouble offsetB; /*!< the offset along the B axis (usually this is the Y axis) */
gdouble scaleA; /*!< the scale factor in the A axis (usually this is the X axis) \
*/ gdouble scaleB; /*!< the scale factor in the B axis (usually this is the Y axis) \
*/ gpointer next; /*!< the next state group in the array */
} gerbv_netstate_t;
/*! The structure used to hold a geometric entity (line/polygon/etc)*/
typedef struct gerbv_net {
double start_x; /*!< the X coordinate of the start point */
double start_y; /*!< the Y coordinate of the start point */
double stop_x; /*!< the X coordinate of the end point */
double stop_y; /*!< the Y coordinate of the end point */
gerbv_render_size_t boundingBox; /*!< the bounding box containing this net (used \
for rendering optimizations) */ int aperture; /*!< the index of the aperture used \
for this entity */ gerbv_aperture_state_t aperture_state; /*!< the state of the \
aperture tool (on/off/etc) */ gerbv_interpolation_t interpolation; /*!< the path \
interpolation method (linear/etc) */ gerbv_cirseg_t *cirseg; /*!< information for \
arc nets */ struct gerbv_net *next; /*!< the next net in the array */
GString *label; /*!< a label string for this net */
gerbv_layer_t *layer; /*!< the RS274X layer this net belongs to */
gerbv_netstate_t *state; /*!< the RS274X state this net belongs to */
} gerbv_net_t;
/*! Struct holding info about interpreting the Gerber files read
* e.g. leading zeros, etc. */
typedef struct gerbv_format {
gerbv_omit_zeros_t omit_zeros;
gerbv_coordinate_t coordinate;
int x_int;
int x_dec;
int y_int;
int y_dec;
int lim_seqno; /* Length limit for codes of sequence number */
int lim_gf; /* Length limit for codes of general function */
int lim_pf; /* Length limit for codes of plot function */
int lim_mf; /* Length limit for codes of miscellaneous function */
} gerbv_format_t;
/*! Struct holding info about a particular image */
typedef struct gerbv_image_info {
char *name;
gerbv_polarity_t polarity;
double min_x; /* Always in inches */
double min_y;
double max_x;
double max_y;
double offsetA;
double offsetB;
gerbv_encoding_t encoding;
double imageRotation;
gerbv_image_justify_type_t imageJustifyTypeA;
gerbv_image_justify_type_t imageJustifyTypeB;
gdouble imageJustifyOffsetA;
gdouble imageJustifyOffsetB;
gdouble imageJustifyOffsetActualA;
gdouble imageJustifyOffsetActualB;
gchar *plotterFilm;
/* Descriptive string for the type of file (rs274-x, drill, etc)
* that this is
*/
gchar *type;
/* Attribute list that is used to hold all sorts of information
* about how the layer is to be parsed.
*/
gerbv_HID_Attribute *attr_list;
int n_attr;
} gerbv_image_info_t;
/*! The structure used to hold a layer (RS274X, drill, or pick-and-place data) */
typedef struct {
gerbv_layertype_t layertype; /*!< the type of layer (RS274X, drill, or \
pick-and-place) */ gerbv_aperture_t *aperture[APERTURE_MAX]; /*!< an array with all \
apertures used */ gerbv_layer_t *layers; /*!< an array of all RS274X layers used \
(only used in RS274X types) */ gerbv_netstate_t *states; /*!< an array of all RS274X \
states used (only used in RS274X types) */ gerbv_amacro_t *amacro; /*!< an array of \
all macros used (only used in RS274X types) */ gerbv_format_t *format; /*!< \
formatting info */ gerbv_image_info_t *info; /*!< miscellaneous info regarding the \
layer such as overall size, etc */ gerbv_net_t *netlist; /*!< an array of all \
geometric entities in the layer */ gerbv_stats_t *gerbv_stats; /*!< RS274X \
statistics for the layer */ gerbv_drill_stats_t *drill_stats; /*!< Excellon drill \
statistics for the layer */ } gerbv_image_t;
/*! Holds information related to an individual layer that is part of a project */
typedef struct {
gerbv_image_t *image; /*!< the image holding all the geometry of the layer */
GdkColor color; /*!< the color to render this layer with */
guint16 alpha; /*!< the transparency to render this layer with */
gboolean isVisible; /*!< TRUE if this layer should be rendered with the project */
gpointer privateRenderData; /*!< private data holder for the rendering backend */
gchar *fullPathname; /*!< this full pathname to the file */
gchar *name; /*!< the name used when referring to this layer (e.g. in a layer \
selection menu) */ gerbv_user_transformation_t transform; /*!< user-specified \
transformation for this layer (mirroring, translating, etc) */ gboolean layer_dirty; \
/*!< True if layer has been modified since last save */ } gerbv_fileinfo_t;
typedef struct {
double x1, y1;
double x2, y2;
} gerbv_bbox_t;
/*! The top-level structure used in libgerbv. A gerbv_project_t groups together
any number of layers, while keeping track of other basic paramters needed for \
rendering */ typedef struct {
GdkColor background; /*!< the background color used for rendering */
int max_files; /*!< the current number of fileinfos in the file array */
gerbv_fileinfo_t **file; /*!< the array for holding the child fileinfos */
int curr_index; /*!< the index of the currently active fileinfo */
int last_loaded; /*!< the number of fileinfos currently in the project */
int renderType; /*!< the type of renderer to use */
gboolean check_before_delete; /*!< TRUE to ask before deleting objects */
gchar *path; /*!< the default path to load new files from */
gchar *execpath; /*!< the path to executed version of gerbv */
gchar *execname; /*!< the path plus executible name for gerbv */
gchar *project; /*!< the default name for the private project file */
} gerbv_project_t;
/*! Color of layer */
typedef struct{
unsigned char red;
unsigned char green;
unsigned char blue;
unsigned char alpha;
}gerbv_layer_color;
/*! This contains the rendering info for a scene */
typedef struct {
gdouble scaleFactorX; /*!< the X direction scale factor */
gdouble scaleFactorY; /*!< the Y direction scale factor */
gdouble lowerLeftX; /*!< the X coordinate of the lower left corner (in real world \
coordinates, in inches) */ gdouble lowerLeftY; /*!< the Y coordinate of the lower \
left corner (in real world coordinates, in inches) */ gerbv_render_types_t \
renderType; /*!< the type of rendering to use */ gint displayWidth; /*!< the width \
of the scene (in pixels, or points depending on the surface type) */ gint \
displayHeight; /*!< the height of the scene (in pixels, or points depending on the \
surface type) */ } gerbv_render_info_t;
//! Allocate a new gerbv_image structure
//! \return the newly created image
gerbv_image_t *gerbv_create_image(gerbv_image_t *image, /*!< the old image to free or \
NULL */ const gchar *type /*!< the type of image to create */
);
//! Free an image structure
void gerbv_destroy_image(gerbv_image_t *image /*!< the image to free */
);
//! Copy an image into an existing image, effectively merging the two together
void
gerbv_image_copy_image (gerbv_image_t *sourceImage, /*!< the source image */
gerbv_user_transformation_t *transform, /*!< the transformation to apply to the new \
image, or NULL for none */ gerbv_image_t *destinationImage /*!< the destination \
image to copy to */ );
//! Duplicate an existing image and return the new copy
//! \return the newly created image
gerbv_image_t *
gerbv_image_duplicate_image (gerbv_image_t *sourceImage, /*!< the source image */
gerbv_user_transformation_t *transform /*!< the transformation to apply to the new \
image, or NULL for none */ );
//! Delete a net in an existing image
void
gerbv_image_delete_net (gerbv_net_t *currentNet /*!< the net to delete */
);
void
gerbv_image_delete_selected_nets (gerbv_image_t *sourceImage, GArray \
*selectedNodeArray);
gboolean
gerbv_image_reduce_area_of_selected_objects (GArray *selectionArray, gdouble \
areaReduction, gint paneRows, gint paneColumns, gdouble paneSeparation);
gboolean
gerbv_image_move_selected_objects (GArray *selectionArray, gdouble translationX,
gdouble translationY);
//! Return the next net entry which corresponds to a unique visible object
gerbv_net_t *
gerbv_image_return_next_renderable_object (gerbv_net_t *oldNet);
//! Create a new project structure and initialize some important variables
gerbv_project_t *
gerbv_create_project (void);
//! Free a project and all related variables
void
gerbv_destroy_project (gerbv_project_t *gerbvProject /*!< the project to destroy */
);
//! Open a file, parse the contents, and add a new layer to an existing project
void
gerbv_open_layer_from_filename (
gerbv_project_t *gerbvProject, /*!< the existing project to add the new layer to */
gchar *filename /*!< the full pathname of the file to be parsed */
);
//! Open a file, parse the contents, and add a new layer to an existing project while \
setting the color of the layer void
gerbv_open_layer_from_filename_with_color(gerbv_project_t *gerbvProject, /*!< the \
existing project to add the new layer to */ gchar *filename, /*!< the full pathname \
of the file to be parsed */ guint16 red, /*!< the value for the red color component \
*/ guint16 green, /*!< the value for the green color component */
guint16 blue, /*!< the value for the blue color component */
guint16 alpha /*!< the value for the alpha color component */
);
//! Free a fileinfo structure
void
gerbv_destroy_fileinfo (gerbv_fileinfo_t *fileInfo /*!< the fileinfo to free */
);
gboolean
gerbv_save_layer_from_index(gerbv_project_t *gerbvProject, gint index, gchar \
*filename);
int
gerbv_revert_file(gerbv_project_t *gerbvProject, int idx);
void
gerbv_revert_all_files(gerbv_project_t *gerbvProject);
void
gerbv_unload_layer(gerbv_project_t *gerbvProject, int index);
void
gerbv_unload_all_layers (gerbv_project_t *gerbvProject);
void
gerbv_change_layer_order(gerbv_project_t *gerbvProject, gint oldPosition, gint \
newPosition);
gint
gerbv_add_parsed_image_to_project (gerbv_project_t *gerbvProject, gerbv_image_t \
*parsed_image, gchar *filename, gchar *baseName, int idx, int reload);
int
gerbv_open_image(gerbv_project_t *gerbvProject, char *filename, int idx, int reload,
gerbv_HID_Attribute *fattr, int n_fattr, gboolean forceLoadFile);
void
gerbv_render_get_boundingbox(gerbv_project_t *gerbvProject, gerbv_render_size_t \
*boundingbox);
//! Calculate the zoom and translations to fit the rendered scene inside the given \
scene size void
gerbv_render_zoom_to_fit_display (gerbv_project_t *gerbvProject, /*!< the project to \
use for calculating */ gerbv_render_info_t *renderInfo /*!< the scene render pointer \
(updates the values in this parameter) */ );
void
gerbv_render_translate_to_fit_display (gerbv_project_t *gerbvProject, \
gerbv_render_info_t *renderInfo);
void
gerbv_render_to_pixmap_using_gdk (gerbv_project_t *gerbvProject, GdkPixmap *pixmap,
gerbv_render_info_t *renderInfo, gerbv_selection_info_t *selectionInfo,
GdkColor *selectionColor);
#ifndef RENDER_USING_GDK
void
gerbv_render_all_layers_to_cairo_target_for_vector_output (gerbv_project_t \
*gerbvProject, cairo_t *cr, gerbv_render_info_t *renderInfo);
void
gerbv_render_all_layers_to_cairo_target (gerbv_project_t *gerbvProject, cairo_t *cr,
gerbv_render_info_t *renderInfo);
//! Render a layer to a cairo context
void
gerbv_render_layer_to_cairo_target (cairo_t *cr, /*!< the cairo context */
gerbv_fileinfo_t *fileInfo, /*!< the layer fileinfo pointer */
gerbv_render_info_t *renderInfo /*!< the scene render info */
);
void
gerbv_render_cairo_set_scale_and_translation(cairo_t *cr, gerbv_render_info_t \
*renderInfo);
void
gerbv_render_layer_to_cairo_target_without_transforming(cairo_t *cr, gerbv_fileinfo_t \
*fileInfo, gerbv_render_info_t *renderInfo, gboolean pixelOutput ); #endif
double
gerbv_get_tool_diameter(int toolNumber
);
int
gerbv_process_tools_file(const char *toolFileName
);
//! Render a project to a PNG file, autoscaling the layers to fit inside the \
specified image dimensions void
gerbv_export_png_file_from_project_autoscaled (
gerbv_project_t *gerbvProject, /*!< the project to render */
int widthInPixels, /*!< the width of the rendered picture (in pixels) */
int heightInPixels, /*!< the height of the rendered picture (in pixels) */
gchar const* filename /*!< the filename for the exported PNG file */
);
//! Render a project to a PNG file using user-specified render info
void
gerbv_export_png_file_from_project (
gerbv_project_t *gerbvProject, /*!< the project to render */
gerbv_render_info_t *renderInfo, /*!< the render settings for the rendered image */
gchar const* filename /*!< the filename for the exported PNG file */
);
//! Render a project to a PDF file, autoscaling the layers to fit inside the \
specified image dimensions void
gerbv_export_pdf_file_from_project_autoscaled (
gerbv_project_t *gerbvProject, /*!< the project to render */
gchar const* filename /*!< the filename for the exported PDF file */
);
//! Render a project to a PDF file using user-specified render info
void
gerbv_export_pdf_file_from_project (
gerbv_project_t *gerbvProject, /*!< the project to render */
gerbv_render_info_t *renderInfo, /*!< the render settings for the rendered image */
gchar const* filename /*!< the filename for the exported PDF file */
);
//! Render a project to a Postscript file, autoscaling the layers to fit inside the \
specified image dimensions void
gerbv_export_postscript_file_from_project_autoscaled (
gerbv_project_t *gerbvProject, /*!< the project to render */
gchar const* filename /*!< the filename for the exported Postscript file */
);
//! Render a project to a Postscript file using user-specified render info
void
gerbv_export_postscript_file_from_project (
gerbv_project_t *gerbvProject, /*!< the project to render */
gerbv_render_info_t *renderInfo, /*!< the render settings for the rendered image */
gchar const* filename /*!< the filename for the exported Postscript file */
);
//! Render a project to a SVG file, autoscaling the layers to fit inside the \
specified image dimensions void
gerbv_export_svg_file_from_project_autoscaled (
gerbv_project_t *gerbvProject, /*!< the project to render */
gchar const* filename /*!< the filename for the exported file */
);
//! Render a project to a file using user-specified render info
void
gerbv_export_svg_file_from_project (
gerbv_project_t *gerbvProject, /*!< the project to render */
gerbv_render_info_t *renderInfo, /*!< the render settings for the rendered image */
gchar const* filename /*!< the filename for the exported file */
);
//! Parse a RS274X file and return the parsed image
//! \return the new gerbv_image_t, or NULL if not successful
gerbv_image_t *
gerbv_create_rs274x_image_from_filename (gchar *filename /*!< the filename of the \
file to be parsed*/ );
//! Export an image to a new file in RS274X format
//! \return TRUE if successful, or FALSE if not
gboolean
gerbv_export_rs274x_file_from_image (gchar *filename, /*!< the filename for the new \
file */ gerbv_image_t *image, /*!< the image to export */
gerbv_user_transformation_t *transform /*!< the transformation to apply before \
exporting */ );
//! Export an image to a new file in Excellon drill format
//! \return TRUE if successful, or FALSE if not
gboolean
gerbv_export_drill_file_from_image (gchar *filename, /*!< the filename for the new \
file */ gerbv_image_t *image, /*!< the image to export */
gerbv_user_transformation_t *transform /*!< the transformation to apply before \
exporting */ );
//! Draw a line on the specified image
void
gerbv_image_create_line_object (gerbv_image_t *image, /*!< the image to draw to */
gdouble startX, /*!< the starting X coordinate */
gdouble startY, /*!< the starting Y coordinate */
gdouble endX, /*!< the ending X coordinate */
gdouble endY, /*!< the ending Y coordinate */
gdouble lineWidth, /*!< the width of the line to draw */
gerbv_aperture_type_t apertureType /*!< the type of aperture to use (e.g. CIRCLE) \
*/ );
//! Draw an arc on the specified image
void
gerbv_image_create_arc_object (gerbv_image_t *image, /*!< the image to draw to */
gdouble centerX, /*!< the center X coordinate */
gdouble centerY, /*!< the center Y coordinate */
gdouble radius, /*!< the arc radius */
gdouble startAngle, /*!< the start angle (in CCW degrees) */
gdouble endAngle, /*!< the start angle (in CCW degrees) */
gdouble lineWidth, /*!< the width of the line to draw */
gerbv_aperture_type_t apertureType /*!< the type of aperture to use (e.g. CIRCLE) \
*/ );
//! Draw a filled rectangle on the specified image
void
gerbv_image_create_rectangle_object (gerbv_image_t *image, /*!< the image to draw to \
*/ gdouble coordinateX, /*!< the X coordinate of the lower left corner */
gdouble coordinateY, /*!< the Y coordinate of the lower left corner */
gdouble width, /*!< the width of the drawn rectangle */
gdouble height /*!< the height of the drawn rectangle */
);
//! Create any missing apertures in the specified image
void
gerbv_image_create_dummy_apertures (gerbv_image_t *parsed_image /*!< the image to \
repair */ );
/*! Create new struct for holding drill stats */
gerbv_drill_stats_t *
gerbv_drill_stats_new(void);
/*! Free the memory for a drill stats struct */
void
gerbv_drill_stats_destroy(gerbv_drill_stats_t *);
/*! Add stats gathered from specified layer to accumulatedd drill stats
* compiled from all layers */
void
gerbv_drill_stats_add_layer(gerbv_drill_stats_t *accum_stats,
gerbv_drill_stats_t *input_stats,
int this_layer
);
/*! Create new struct for holding Gerber stats */
gerbv_stats_t *
gerbv_stats_new(void);
/*! Free the memory for a stats struct */
void
gerbv_stats_destroy(gerbv_stats_t *);
/*! Add stats gathered from specified layer to accumulated Gerber stats
* compiled from all layers */
void
gerbv_stats_add_layer(gerbv_stats_t *accum_stats,
gerbv_stats_t *input_stats,
int this_layer
);
void
gerbv_attribute_destroy_HID_attribute (gerbv_HID_Attribute *attributeList, int \
n_attr);
gerbv_HID_Attribute *
gerbv_attribute_dup (gerbv_HID_Attribute *, int);
#if defined(__cplusplus)
}
#endif
#endif /* __GERBV_H__ */
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic