2021-11-19 02:21:22 +00:00
|
|
|
%ignore EDA_SHAPE::getCenter;
|
2023-09-03 04:02:34 +00:00
|
|
|
%ignore std::abs;
|
2022-03-09 16:23:29 +00:00
|
|
|
#pragma SWIG nowarn=503
|
2016-09-21 01:07:41 +00:00
|
|
|
|
2021-10-20 05:28:06 +00:00
|
|
|
%{
|
2022-01-14 04:55:50 +00:00
|
|
|
#include <geometry/eda_angle.h>
|
2021-10-20 05:28:06 +00:00
|
|
|
#include <eda_shape.h>
|
|
|
|
#include <pcb_shape.h>
|
|
|
|
%}
|
2022-01-14 04:55:50 +00:00
|
|
|
%include geometry/eda_angle.h
|
2021-10-15 20:50:33 +00:00
|
|
|
%include eda_shape.h
|
2020-10-04 23:34:59 +00:00
|
|
|
%include pcb_shape.h
|
2021-11-19 02:21:22 +00:00
|
|
|
|
2022-12-15 15:18:21 +00:00
|
|
|
%extend EDA_ANGLE
|
|
|
|
{
|
|
|
|
/* Implement common operators that use outside-class definition in C++ */
|
|
|
|
%pythoncode
|
|
|
|
%{
|
|
|
|
def __add__(self, other):
|
|
|
|
n = EDA_ANGLE(self.AsDegrees(), DEGREES_T)
|
|
|
|
n += other
|
|
|
|
return n
|
|
|
|
|
|
|
|
def __sub__(self, other):
|
|
|
|
n = EDA_ANGLE(self.AsDegrees(), DEGREES_T)
|
|
|
|
n -= other
|
|
|
|
return n
|
|
|
|
|
|
|
|
def __mul__(self, other):
|
|
|
|
return EDA_ANGLE(self.AsDegrees() * other, DEGREES_T)
|
|
|
|
|
|
|
|
def __rmul__(self, other):
|
|
|
|
return EDA_ANGLE(other * self.AsDegrees(), DEGREES_T)
|
|
|
|
|
|
|
|
def __truediv__(self, other):
|
|
|
|
return EDA_ANGLE(self.AsDegrees() / other, DEGREES_T)
|
2023-09-03 04:02:34 +00:00
|
|
|
|
|
|
|
def __abs__(self):
|
|
|
|
return EDA_ANGLE(abs(self.AsDegrees()), DEGREES_T)
|
2022-12-15 15:18:21 +00:00
|
|
|
%}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-04 23:34:59 +00:00
|
|
|
%extend PCB_SHAPE
|
2016-09-21 01:07:41 +00:00
|
|
|
{
|
2022-12-15 12:51:53 +00:00
|
|
|
EDA_ANGLE GetArcAngleStart()
|
2021-10-20 05:28:06 +00:00
|
|
|
{
|
2022-01-16 01:06:25 +00:00
|
|
|
EDA_ANGLE startAngle;
|
|
|
|
EDA_ANGLE endAngle;
|
2021-10-20 05:28:06 +00:00
|
|
|
$self->CalcArcAngles( startAngle, endAngle );
|
2022-12-15 12:51:53 +00:00
|
|
|
return startAngle;
|
2021-10-20 05:28:06 +00:00
|
|
|
}
|
|
|
|
|
2016-09-21 01:07:41 +00:00
|
|
|
%pythoncode
|
|
|
|
%{
|
|
|
|
def GetShapeStr(self):
|
2023-11-26 12:44:31 +00:00
|
|
|
return self.ShowShape()
|
2016-09-21 01:07:41 +00:00
|
|
|
%}
|
|
|
|
}
|
|
|
|
|
2021-10-17 10:21:47 +00:00
|
|
|
/* Only for compatibility with old python scripts: */
|
|
|
|
const int S_SEGMENT = (const int)SHAPE_T::SEGMENT;
|
2023-07-24 16:07:56 +00:00
|
|
|
const int S_RECT = (const int)SHAPE_T::RECTANGLE;
|
2021-10-17 10:21:47 +00:00
|
|
|
const int S_ARC = (const int)SHAPE_T::ARC;
|
|
|
|
const int S_CIRCLE = (const int)SHAPE_T::CIRCLE;
|
|
|
|
const int S_POLYGON = (const int)SHAPE_T::POLY;
|
|
|
|
const int S_CURVE = (const int)SHAPE_T::BEZIER;
|
2023-07-24 16:07:56 +00:00
|
|
|
const int SHAPE_T_RECT = (const int)SHAPE_T::RECTANGLE;
|
2021-10-17 10:21:47 +00:00
|
|
|
|
|
|
|
%{
|
|
|
|
/* for compatibility with old python scripts: */
|
|
|
|
const int S_SEGMENT = (const int)SHAPE_T::SEGMENT;
|
2023-07-24 16:07:56 +00:00
|
|
|
const int S_RECT = (const int)SHAPE_T::RECTANGLE;
|
2021-10-17 10:21:47 +00:00
|
|
|
const int S_ARC = (const int)SHAPE_T::ARC;
|
|
|
|
const int S_CIRCLE = (const int)SHAPE_T::CIRCLE;
|
|
|
|
const int S_POLYGON = (const int)SHAPE_T::POLY;
|
|
|
|
const int S_CURVE = (const int)SHAPE_T::BEZIER;
|
2023-07-24 16:07:56 +00:00
|
|
|
const int SHAPE_T_RECT = (const int)SHAPE_T::RECTANGLE;
|
2021-10-17 10:21:47 +00:00
|
|
|
%}
|