Merge branch 'master' into Path
@@ -544,15 +544,8 @@ void InterpreterSingleton::addType(PyTypeObject* Type,PyObject* Module, const ch
|
||||
void InterpreterSingleton::addPythonPath(const char* Path)
|
||||
{
|
||||
PyGILStateLocker locker;
|
||||
PyObject *list = PySys_GetObject("path");
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
PyObject *path = PyUnicode_FromString(Path);
|
||||
#else
|
||||
PyObject *path = PyString_FromString(Path);
|
||||
#endif
|
||||
PyList_Append(list, path);
|
||||
Py_DECREF(path);
|
||||
PySys_SetObject("path", list);
|
||||
Py::List list(PySys_GetObject("path"));
|
||||
list.append(Py::String(Path));
|
||||
}
|
||||
|
||||
const char* InterpreterSingleton::init(int argc,char *argv[])
|
||||
|
||||
@@ -706,7 +706,7 @@ void CmdMeshVertexCurvatureInfo::activated(int)
|
||||
viewer->setEditing(true);
|
||||
viewer->setRedirectToSceneGraph(true);
|
||||
viewer->setSelectionEnabled(false);
|
||||
viewer->setEditingCursor(QCursor(Gui::BitmapFactory().pixmapFromSvg("mesh_pipette",QSize(32,32)),4,29));
|
||||
viewer->setEditingCursor(QCursor(Gui::BitmapFactory().pixmapFromSvg("Mesh_Pipette",QSize(32,32)),4,29));
|
||||
viewer->addEventCallback(SoEvent::getClassTypeId(),
|
||||
MeshGui::ViewProviderMeshCurvature::curvatureInfoCallback);
|
||||
}
|
||||
@@ -896,7 +896,7 @@ CmdMeshPolyCut::CmdMeshPolyCut()
|
||||
sToolTipText = QT_TR_NOOP("Cuts a mesh with a picked polygon");
|
||||
sWhatsThis = "Mesh_PolyCut";
|
||||
sStatusTip = QT_TR_NOOP("Cuts a mesh with a picked polygon");
|
||||
sPixmap = "mesh_cut";
|
||||
sPixmap = "Mesh_Cut";
|
||||
}
|
||||
|
||||
void CmdMeshPolyCut::activated(int)
|
||||
@@ -1199,7 +1199,7 @@ CmdMeshEvaluateFacet::CmdMeshEvaluateFacet()
|
||||
sToolTipText = QT_TR_NOOP("Information about face");
|
||||
sWhatsThis = "Mesh_EvaluateFacet";
|
||||
sStatusTip = QT_TR_NOOP("Information about face");
|
||||
sPixmap = "mesh_pipette";
|
||||
sPixmap = "Mesh_Pipette";
|
||||
}
|
||||
|
||||
void CmdMeshEvaluateFacet::activated(int)
|
||||
@@ -1209,7 +1209,7 @@ void CmdMeshEvaluateFacet::activated(int)
|
||||
if (view) {
|
||||
Gui::View3DInventorViewer* viewer = view->getViewer();
|
||||
viewer->setEditing(true);
|
||||
viewer->setEditingCursor(QCursor(Gui::BitmapFactory().pixmapFromSvg("mesh_pipette",QSize(32,32)),4,29));
|
||||
viewer->setEditingCursor(QCursor(Gui::BitmapFactory().pixmapFromSvg("Mesh_Pipette",QSize(32,32)),4,29));
|
||||
viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), MeshGui::ViewProviderMeshFaceSet::faceInfoCallback);
|
||||
}
|
||||
}
|
||||
@@ -1675,7 +1675,7 @@ CmdMeshFillInteractiveHole::CmdMeshFillInteractiveHole()
|
||||
sToolTipText = QT_TR_NOOP("Close holes interactively");
|
||||
sWhatsThis = "Mesh_FillInteractiveHole";
|
||||
sStatusTip = QT_TR_NOOP("Close holes interactively");
|
||||
sPixmap = "mesh_boundary";
|
||||
sPixmap = "Mesh_Boundary";
|
||||
}
|
||||
|
||||
void CmdMeshFillInteractiveHole::activated(int)
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
<RCC>
|
||||
<qresource>
|
||||
<file>icons/mesh_boundary.svg</file>
|
||||
<file>icons/mesh_cut.svg</file>
|
||||
<file>icons/mesh_pipette.svg</file>
|
||||
<file>icons/Tree_Mesh.svg</file>
|
||||
<qresource>
|
||||
<file>icons/Mesh_Add_Facet.svg</file>
|
||||
<file>icons/Mesh_Boundary.svg</file>
|
||||
<file>icons/Mesh_Bounding_Box.svg</file>
|
||||
<file>icons/Mesh_Cross_Sections.svg</file>
|
||||
<file>icons/Mesh_Curvature_Info.svg</file>
|
||||
<file>icons/Mesh_Curvature_Plot.svg</file>
|
||||
<file>icons/Mesh_Cut.svg</file>
|
||||
<file>icons/Mesh_Decimating.svg</file>
|
||||
<file>icons/Mesh_Difference.svg</file>
|
||||
<file>icons/Mesh_Evaluate_Solid.svg</file>
|
||||
<file>icons/Mesh_Evaluation.svg</file>
|
||||
<file>icons/Mesh_Export_Mesh.svg</file>
|
||||
<file>icons/Mesh_Import_Mesh.svg</file>
|
||||
<file>icons/Mesh_Mesh_from_Shape.svg</file>
|
||||
<file>icons/Mesh_Flip_Normals.svg</file>
|
||||
<file>icons/Mesh_Harmonize_Normals.svg</file>
|
||||
<file>icons/Mesh_Import_Mesh.svg</file>
|
||||
<file>icons/Mesh_Intersection.svg</file>
|
||||
<file>icons/Mesh_Merge.svg</file>
|
||||
<file>icons/Mesh_Mesh_from_Shape.svg</file>
|
||||
<file>icons/Mesh_Pipette.svg</file>
|
||||
<file>icons/Mesh_Poly_Trim.svg</file>
|
||||
<file>icons/Mesh_Regular_Solid.svg</file>
|
||||
<file>icons/Mesh_Remesh_Gmsh.svg</file>
|
||||
<file>icons/Mesh_Remove_Comp_by_Hand.svg</file>
|
||||
<file>icons/Mesh_Remove_Components.svg</file>
|
||||
<file>icons/Mesh_Tree_Curvature_Plot.svg</file>
|
||||
<file>icons/MeshWorkbench.svg</file>
|
||||
<file>icons/Mesh_Scale.svg</file>
|
||||
<file>icons/Mesh_Section_by_Plane.svg</file>
|
||||
<file>icons/Mesh_Fill_up_Holes.svg</file>
|
||||
<file>icons/Mesh_Union.svg</file>
|
||||
<file>icons/Mesh_Smoothing.svg</file>
|
||||
<file>icons/Mesh_Segmentation_Best_Fit.svg</file>
|
||||
<file>icons/Mesh_Segmentation.svg</file>
|
||||
<file>icons/Mesh_Section_by_Plane.svg</file>
|
||||
<file>icons/Mesh_Scale.svg</file>
|
||||
<file>icons/Mesh_Remove_Comp_by_Hand.svg</file>
|
||||
<file>icons/Mesh_Remesh_Gmsh.svg</file>
|
||||
<file>icons/Mesh_Poly_Trim.svg</file>
|
||||
<file>icons/Mesh_Merge.svg</file>
|
||||
<file>icons/Mesh_Intersection.svg</file>
|
||||
<file>icons/Mesh_Evaluation.svg</file>
|
||||
<file>icons/Mesh_Evaluate_Solid.svg</file>
|
||||
<file>icons/Mesh_Difference.svg</file>
|
||||
<file>icons/Mesh_Decimating.svg</file>
|
||||
<file>icons/Mesh_Curvature_Info.svg</file>
|
||||
<file>icons/Mesh_Cross_Sections.svg</file>
|
||||
<file>icons/Mesh_Bounding_Box.svg</file>
|
||||
<file>icons/Mesh_Add_Facet.svg</file>
|
||||
<file>icons/Mesh_Smoothing.svg</file>
|
||||
<file>icons/Mesh_Tree.svg</file>
|
||||
<file>icons/Mesh_Tree_Curvature_Plot.svg</file>
|
||||
<file>icons/Mesh_Trim_by_Plane.svg</file>
|
||||
<file>icons/Mesh_Union.svg</file>
|
||||
<file>icons/MeshWorkbench.svg</file>
|
||||
<file>icons/RegularSolids/Mesh_Cone.svg</file>
|
||||
<file>icons/RegularSolids/Mesh_Cube.svg</file>
|
||||
<file>icons/RegularSolids/Mesh_Cylinder.svg</file>
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
id="svg9484"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.48.5 r10040"
|
||||
sodipodi:docname="mesh_boundary.svg"
|
||||
sodipodi:docname="Mesh_Boundary.svg"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||
version="1.1">
|
||||
<title
|
||||
id="title3749">mesh_boundary</title>
|
||||
id="title3749">Mesh_Boundary</title>
|
||||
<defs
|
||||
id="defs9486">
|
||||
<linearGradient
|
||||
@@ -108,7 +108,7 @@
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<cc:license
|
||||
rdf:resource="https://www.gnu.org/copyleft/lesser.html" />
|
||||
<dc:title>mesh_boundary</dc:title>
|
||||
<dc:title>Mesh_Boundary</dc:title>
|
||||
<dc:description>A single triangular mesh face with a hole in it</dc:description>
|
||||
<dc:contributor>
|
||||
<cc:Agent>
|
||||
@@ -124,7 +124,7 @@
|
||||
</rdf:Bag>
|
||||
</dc:subject>
|
||||
<dc:relation>http://www.freecadweb.org/wiki/index.php?title=Artwork</dc:relation>
|
||||
<dc:identifier>FreeCAD/src/Mod/Mesh/Gui/Resources/icons/mesh_boundary.svg</dc:identifier>
|
||||
<dc:identifier>FreeCAD/src/Mod/Mesh/Gui/Resources/icons/Mesh_Boundary.svg</dc:identifier>
|
||||
<dc:publisher>
|
||||
<cc:Agent>
|
||||
<dc:title>FreeCAD</dc:title>
|
||||
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
@@ -15,9 +15,9 @@
|
||||
id="svg3167"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.5 r10040"
|
||||
sodipodi:docname="mesh_cut.svg">
|
||||
sodipodi:docname="Mesh_Cut.svg">
|
||||
<title
|
||||
id="title3747">mesh_cut</title>
|
||||
id="title3747">Mesh_Cut</title>
|
||||
<defs
|
||||
id="defs3169">
|
||||
<linearGradient
|
||||
@@ -889,11 +889,11 @@
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>mesh_cut</dc:title>
|
||||
<dc:title>Mesh_Cut</dc:title>
|
||||
<cc:license
|
||||
rdf:resource="https://www.gnu.org/copyleft/lesser.html" />
|
||||
<dc:source>https://commons.wikimedia.org/wiki/Tango_icons#/media/File:Edit-cut.svg</dc:source>
|
||||
<dc:identifier>FreeCAD/src/Mod/Mesh/Gui/Resources/icons/mesh_cut.svg</dc:identifier>
|
||||
<dc:identifier>FreeCAD/src/Mod/Mesh/Gui/Resources/icons/Mesh_Cut.svg</dc:identifier>
|
||||
<dc:contributor>
|
||||
<cc:Agent>
|
||||
<dc:title>[agryson] Alexander Gryson</dc:title>
|
||||
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
@@ -15,12 +15,12 @@
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.5 r10040"
|
||||
sodipodi:docname="mesh_pipette.svg"
|
||||
sodipodi:docname="Mesh_Pipette.svg"
|
||||
inkscape:export-filename="/home/user/Downloads/cad/mystuff/icons/main_icons/pipette_32px.png"
|
||||
inkscape:export-xdpi="45"
|
||||
inkscape:export-ydpi="45">
|
||||
<title
|
||||
id="title3733">mesh_pipette</title>
|
||||
id="title3733">Mesh_Pipette</title>
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
@@ -158,7 +158,7 @@
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>mesh_pipette</dc:title>
|
||||
<dc:title>Mesh_Pipette</dc:title>
|
||||
<cc:license
|
||||
rdf:resource="https://www.gnu.org/copyleft/lesser.html" />
|
||||
<dc:rights>
|
||||
@@ -171,7 +171,7 @@
|
||||
<dc:title>FreeCAD</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:publisher>
|
||||
<dc:identifier>FreeCAD/src/Mod/Mesh/Gui/Resources/icons/mesh_pipette.svg</dc:identifier>
|
||||
<dc:identifier>FreeCAD/src/Mod/Mesh/Gui/Resources/icons/Mesh_Pipette.svg</dc:identifier>
|
||||
<dc:relation>http://www.freecadweb.org/wiki/index.php?title=Artwork</dc:relation>
|
||||
<dc:subject>
|
||||
<rdf:Bag>
|
||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
@@ -15,11 +15,11 @@
|
||||
id="svg3052"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.48.5 r10040"
|
||||
sodipodi:docname="Tree_Mesh.svg"
|
||||
sodipodi:docname="Mesh_Tree.svg"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||
version="1.1">
|
||||
<title
|
||||
id="title3725">Tree_Mesh</title>
|
||||
id="title3725">Mesh_Tree</title>
|
||||
<defs
|
||||
id="defs3054">
|
||||
<inkscape:perspective
|
||||
@@ -103,7 +103,7 @@
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>Tree_Mesh</dc:title>
|
||||
<dc:title>Mesh_Tree</dc:title>
|
||||
<dc:contributor>
|
||||
<cc:Agent>
|
||||
<dc:title>[agryson] Alexander Gryson</dc:title>
|
||||
@@ -127,7 +127,7 @@
|
||||
<dc:title>FreeCAD</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:publisher>
|
||||
<dc:identifier>FreeCAD/src/Mod/Mesh/Gui/Resources/icons/Tree_Mesh.svg</dc:identifier>
|
||||
<dc:identifier>FreeCAD/src/Mod/Mesh/Gui/Resources/icons/Mesh._Tree.svg</dc:identifier>
|
||||
<dc:relation>http://www.freecadweb.org/wiki/index.php?title=Artwork</dc:relation>
|
||||
<dc:subject>
|
||||
<rdf:Bag>
|
||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
@@ -503,7 +503,7 @@ void ViewProviderMesh::updateData(const App::Property* prop)
|
||||
QIcon ViewProviderMesh::getIcon() const
|
||||
{
|
||||
#if 1
|
||||
static QIcon icon = Gui::BitmapFactory().pixmap("Tree_Mesh");
|
||||
static QIcon icon = Gui::BitmapFactory().pixmap("Mesh_Tree");
|
||||
return icon;
|
||||
#else
|
||||
static const char * const Mesh_Feature_xpm[] = {
|
||||
|
||||
@@ -793,21 +793,20 @@ private:
|
||||
Py::Object getFacets(const Py::Tuple& args)
|
||||
{
|
||||
PyObject *shape;
|
||||
PyObject *list = PyList_New(0);
|
||||
Py::List list;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "O", &shape))
|
||||
throw Py::Exception();
|
||||
auto theShape = static_cast<Part::TopoShapePy*>(shape)->getTopoShapePtr()->getShape();
|
||||
for(TopExp_Explorer ex(theShape, TopAbs_FACE); ex.More(); ex.Next())
|
||||
{
|
||||
for (TopExp_Explorer ex(theShape, TopAbs_FACE); ex.More(); ex.Next()) {
|
||||
TopoDS_Face currentFace = TopoDS::Face(ex.Current());
|
||||
TopLoc_Location loc;
|
||||
Handle(Poly_Triangulation) facets = BRep_Tool::Triangulation(currentFace, loc);
|
||||
const TopAbs_Orientation anOrientation = currentFace.Orientation();
|
||||
bool flip = (anOrientation == TopAbs_REVERSED);
|
||||
if(!facets.IsNull()){
|
||||
if (!facets.IsNull()) {
|
||||
const TColgp_Array1OfPnt& nodes = facets->Nodes();
|
||||
const Poly_Array1OfTriangle& triangles = facets->Triangles();
|
||||
for(int i = 1; i <= triangles.Length(); i++){
|
||||
for (int i = 1; i <= triangles.Length(); i++) {
|
||||
Standard_Integer n1,n2,n3;
|
||||
triangles(i).Get(n1, n2, n3);
|
||||
gp_Pnt p1 = nodes(n1);
|
||||
@@ -821,19 +820,17 @@ private:
|
||||
PyObject *t1 = PyTuple_Pack(3, PyFloat_FromDouble(p1.X()), PyFloat_FromDouble(p1.Y()), PyFloat_FromDouble(p1.Z()));
|
||||
PyObject *t2 = PyTuple_Pack(3, PyFloat_FromDouble(p2.X()), PyFloat_FromDouble(p2.Y()), PyFloat_FromDouble(p2.Z()));
|
||||
PyObject *t3 = PyTuple_Pack(3, PyFloat_FromDouble(p3.X()), PyFloat_FromDouble(p3.Y()), PyFloat_FromDouble(p3.Z()));
|
||||
PyObject *points;
|
||||
if(flip)
|
||||
{
|
||||
points = PyTuple_Pack(3, t2, t1, t3);
|
||||
} else {
|
||||
points = PyTuple_Pack(3, t1, t2, t3);
|
||||
if (flip) {
|
||||
list.append(Py::asObject(PyTuple_Pack(3, t2, t1, t3)));
|
||||
}
|
||||
else {
|
||||
list.append(Py::asObject(PyTuple_Pack(3, t1, t2, t3)));
|
||||
}
|
||||
PyList_Append(list, points);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Py::asObject(list);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
Py::Object makeCompound(const Py::Tuple& args)
|
||||
{
|
||||
|
||||
@@ -105,30 +105,31 @@ PyObject* FT2FC(const Py_UNICODE *PyUString,
|
||||
const size_t length,
|
||||
const char *FontSpec,
|
||||
const double stringheight, // fc coords
|
||||
const double tracking) { // fc coords
|
||||
FT_Library FTLib;
|
||||
FT_Face FTFont;
|
||||
FT_Error error;
|
||||
FT_Long FaceIndex = 0; // some fonts have multiple faces
|
||||
FT_Vector kern;
|
||||
FT_UInt FTLoadFlags = FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP;
|
||||
const double tracking) // fc coords
|
||||
{
|
||||
FT_Library FTLib;
|
||||
FT_Face FTFont;
|
||||
FT_Error error;
|
||||
FT_Long FaceIndex = 0; // some fonts have multiple faces
|
||||
FT_Vector kern;
|
||||
FT_UInt FTLoadFlags = FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP;
|
||||
|
||||
std::stringstream ErrorMsg;
|
||||
double PenPos = 0, scalefactor;
|
||||
UNICHAR prevchar = 0, currchar = 0;
|
||||
int cadv;
|
||||
size_t i;
|
||||
PyObject *WireList, *CharList;
|
||||
std::stringstream ErrorMsg;
|
||||
double PenPos = 0, scalefactor;
|
||||
UNICHAR prevchar = 0, currchar = 0;
|
||||
int cadv;
|
||||
size_t i;
|
||||
Py::List CharList;
|
||||
|
||||
error = FT_Init_FreeType(&FTLib);
|
||||
if(error) {
|
||||
ErrorMsg << "FT_Init_FreeType failed: " << error;
|
||||
throw std::runtime_error(ErrorMsg.str());
|
||||
}
|
||||
error = FT_Init_FreeType(&FTLib);
|
||||
if (error) {
|
||||
ErrorMsg << "FT_Init_FreeType failed: " << error;
|
||||
throw std::runtime_error(ErrorMsg.str());
|
||||
}
|
||||
|
||||
#ifdef FC_OS_WIN32
|
||||
Base::FileInfo fi(FontSpec);
|
||||
if (!fi.isReadable()) {
|
||||
if (!fi.isReadable()) {
|
||||
ErrorMsg << "Font file not found (Win): " << FontSpec;
|
||||
throw std::runtime_error(ErrorMsg.str());
|
||||
}
|
||||
@@ -143,58 +144,61 @@ PyObject* FT2FC(const Py_UNICODE *PyUString,
|
||||
#endif
|
||||
|
||||
|
||||
error = FT_New_Face(FTLib,FontSpec,FaceIndex, &FTFont);
|
||||
if(error) {
|
||||
ErrorMsg << "FT_New_Face failed: " << error;
|
||||
throw std::runtime_error(ErrorMsg.str());
|
||||
}
|
||||
error = FT_New_Face(FTLib,FontSpec,FaceIndex, &FTFont);
|
||||
if (error) {
|
||||
ErrorMsg << "FT_New_Face failed: " << error;
|
||||
throw std::runtime_error(ErrorMsg.str());
|
||||
}
|
||||
|
||||
//TODO: check that FTFont is scalable? only relevant for hinting etc?
|
||||
|
||||
// FT2 blows up if char size is not set to some non-zero value.
|
||||
// This sets size to 48 point. Magic.
|
||||
error = FT_Set_Char_Size(FTFont,
|
||||
0, /* char_width in 1/64th of points */
|
||||
48*64, /* char_height in 1/64th of points */
|
||||
0, /* horizontal device resolution */
|
||||
0 ); /* vertical device resolution */
|
||||
if(error) {
|
||||
ErrorMsg << "FT_Set_Char_Size failed: " << error;
|
||||
throw std::runtime_error(ErrorMsg.str());
|
||||
}
|
||||
error = FT_Set_Char_Size(FTFont,
|
||||
0, /* char_width in 1/64th of points */
|
||||
48*64, /* char_height in 1/64th of points */
|
||||
0, /* horizontal device resolution */
|
||||
0 ); /* vertical device resolution */
|
||||
if (error) {
|
||||
ErrorMsg << "FT_Set_Char_Size failed: " << error;
|
||||
throw std::runtime_error(ErrorMsg.str());
|
||||
}
|
||||
|
||||
CharList = PyList_New(0);
|
||||
scalefactor = stringheight/float(FTFont->height);
|
||||
for (i=0; i<length; i++) {
|
||||
currchar = PyUString[i];
|
||||
error = FT_Load_Char(FTFont,
|
||||
currchar,
|
||||
FTLoadFlags);
|
||||
if(error) {
|
||||
ErrorMsg << "FT_Load_Char failed: " << error;
|
||||
throw std::runtime_error(ErrorMsg.str());
|
||||
}
|
||||
scalefactor = stringheight/float(FTFont->height);
|
||||
for (i=0; i<length; i++) {
|
||||
currchar = PyUString[i];
|
||||
error = FT_Load_Char(FTFont,
|
||||
currchar,
|
||||
FTLoadFlags);
|
||||
if (error) {
|
||||
ErrorMsg << "FT_Load_Char failed: " << error;
|
||||
throw std::runtime_error(ErrorMsg.str());
|
||||
}
|
||||
|
||||
cadv = FTFont->glyph->advance.x;
|
||||
kern = getKerning(FTFont,prevchar,currchar);
|
||||
PenPos += kern.x;
|
||||
WireList = getGlyphContours(FTFont,currchar,PenPos, scalefactor,i,tracking);
|
||||
if (!PyList_Size(WireList)) // empty ==> whitespace
|
||||
Base::Console().Log("FT2FC char '0x%04x'/'%d' has no Wires!\n", currchar, currchar);
|
||||
else
|
||||
PyList_Append(CharList, WireList);
|
||||
PenPos += cadv;
|
||||
prevchar = currchar;
|
||||
}
|
||||
cadv = FTFont->glyph->advance.x;
|
||||
kern = getKerning(FTFont,prevchar,currchar);
|
||||
PenPos += kern.x;
|
||||
try {
|
||||
Py::List WireList(getGlyphContours(FTFont, currchar, PenPos, scalefactor, i, tracking), true);
|
||||
CharList.append(WireList);
|
||||
}
|
||||
catch (Py::Exception& e) {
|
||||
e.clear();
|
||||
Base::Console().Log("FT2FC char '0x%04x'/'%d' has no Wires!\n", currchar, currchar);
|
||||
}
|
||||
|
||||
error = FT_Done_FreeType(FTLib);
|
||||
if(error) {
|
||||
ErrorMsg << "FT_Done_FreeType failed: " << error;
|
||||
throw std::runtime_error(ErrorMsg.str());
|
||||
}
|
||||
PenPos += cadv;
|
||||
prevchar = currchar;
|
||||
}
|
||||
|
||||
return(CharList);
|
||||
}
|
||||
error = FT_Done_FreeType(FTLib);
|
||||
if (error) {
|
||||
ErrorMsg << "FT_Done_FreeType failed: " << error;
|
||||
throw std::runtime_error(ErrorMsg.str());
|
||||
}
|
||||
|
||||
return Py::new_reference_to(CharList);
|
||||
}
|
||||
|
||||
//********** FT Decompose callbacks and data defns
|
||||
// FT Decomp Context for 1 char
|
||||
@@ -342,7 +346,7 @@ PyObject* getGlyphContours(FT_Face FTFont, UNICHAR currchar, double PenPos, doub
|
||||
isTTF = true;
|
||||
}
|
||||
|
||||
PyObject* ret = PyList_New(0);
|
||||
Py::List list;
|
||||
|
||||
gp_Vec pointer = gp_Vec(PenPos * Scale + charNum*tracking,0.0,0.0);
|
||||
gp_Trsf xForm;
|
||||
@@ -372,9 +376,11 @@ PyObject* getGlyphContours(FT_Face FTFont, UNICHAR currchar, double PenPos, doub
|
||||
ErrorMsg << "FT2FC OCC BRepScale failed \n";
|
||||
throw std::runtime_error(ErrorMsg.str());
|
||||
}
|
||||
PyList_Append(ret,new TopoShapeWirePy(new TopoShape(TopoDS::Wire(BRepScale.Shape()))));
|
||||
|
||||
PyObject* wire = new TopoShapeWirePy(new TopoShape(TopoDS::Wire(BRepScale.Shape())));
|
||||
list.append(Py::asObject(wire));
|
||||
}
|
||||
return(ret);
|
||||
return Py::new_reference_to(list);
|
||||
}
|
||||
|
||||
// get kerning values for this char pair
|
||||
|
||||
@@ -412,7 +412,7 @@ PyObject* GeometryPy::getExtensions(PyObject *args)
|
||||
try {
|
||||
const std::vector<std::weak_ptr<const GeometryExtension>> ext = this->getGeometryPtr()->getExtensions();
|
||||
|
||||
PyObject* list = PyList_New(0);
|
||||
Py::List list;
|
||||
|
||||
for (std::size_t i=0; i<ext.size(); ++i) {
|
||||
|
||||
@@ -423,9 +423,7 @@ PyObject* GeometryPy::getExtensions(PyObject *args)
|
||||
// we create a python copy and add it to the list
|
||||
|
||||
try {
|
||||
PyObject* cpy = p->copyPyObject();
|
||||
PyList_Append( list, cpy);
|
||||
Py_DECREF(cpy);
|
||||
list.append(Py::asObject(p->copyPyObject()));
|
||||
}
|
||||
catch(Base::NotImplementedError) {
|
||||
// silently ignoring extensions not having a Python object
|
||||
@@ -433,7 +431,7 @@ PyObject* GeometryPy::getExtensions(PyObject *args)
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
return Py::new_reference_to(list);
|
||||
}
|
||||
catch(const Base::ValueError& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.what());
|
||||
|
||||
@@ -2524,16 +2524,16 @@ PyObject* TopoShapePy::proximity(PyObject *args)
|
||||
PyObject* ps2;
|
||||
Standard_Real tol = Precision::Confusion();
|
||||
if (!PyArg_ParseTuple(args, "O!|d",&(TopoShapePy::Type), &ps2, &tol))
|
||||
return 0;
|
||||
return nullptr;
|
||||
const TopoDS_Shape& s1 = getTopoShapePtr()->getShape();
|
||||
const TopoDS_Shape& s2 = static_cast<Part::TopoShapePy*>(ps2)->getTopoShapePtr()->getShape();
|
||||
if (s1.IsNull()) {
|
||||
PyErr_SetString(PyExc_ValueError, "proximity: Shape object is invalid");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
if (s2.IsNull()) {
|
||||
PyErr_SetString(PyExc_ValueError, "proximity: Shape parameter is invalid");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BRepExtrema_ShapeProximity proximity;
|
||||
@@ -2551,7 +2551,7 @@ PyObject* TopoShapePy::proximity(PyObject *args)
|
||||
BRep_Tool::Triangulation(TopoDS::Face(xp.Current()), aLoc);
|
||||
if (aTriangulation.IsNull()) {
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity not done, call 'tessellate' beforehand");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2561,7 +2561,7 @@ PyObject* TopoShapePy::proximity(PyObject *args)
|
||||
BRep_Tool::Triangulation(TopoDS::Face(xp.Current()), aLoc);
|
||||
if (aTriangulation.IsNull()) {
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity not done, call 'tessellate' beforehand");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2572,7 +2572,7 @@ PyObject* TopoShapePy::proximity(PyObject *args)
|
||||
BRep_Tool::Polygon3D(TopoDS::Edge(xp.Current()), aLoc);
|
||||
if (aPoly3D.IsNull()) {
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity not done, call 'tessellate' beforehand");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2582,37 +2582,29 @@ PyObject* TopoShapePy::proximity(PyObject *args)
|
||||
BRep_Tool::Polygon3D(TopoDS::Edge(xp.Current()), aLoc);
|
||||
if (aPoly3D.IsNull()) {
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity not done, call 'tessellate' beforehand");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// another problem must have occurred
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity not done");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
//PyObject* overlappss1 = PyList_New(0);
|
||||
//PyObject* overlappss2 = PyList_New(0);
|
||||
PyObject* overlappssindex1 = PyList_New(0);
|
||||
PyObject* overlappssindex2 = PyList_New(0);
|
||||
|
||||
Py::List overlappssindex1;
|
||||
Py::List overlappssindex2;
|
||||
|
||||
for (BRepExtrema_OverlappedSubShapes::Iterator anIt1 (proximity.OverlapSubShapes1()); anIt1.More(); anIt1.Next()) {
|
||||
//PyList_Append(overlappss1, new TopoShapeFacePy(new TopoShape(proximity.GetSubShape1 (anIt1.Key()))));
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
PyList_Append(overlappssindex1,PyLong_FromLong(anIt1.Key()+1));
|
||||
#else
|
||||
PyList_Append(overlappssindex1,PyInt_FromLong(anIt1.Key()+1));
|
||||
#endif
|
||||
overlappssindex1.append(Py::Long(anIt1.Key() + 1));
|
||||
}
|
||||
for (BRepExtrema_OverlappedSubShapes::Iterator anIt2 (proximity.OverlapSubShapes2()); anIt2.More(); anIt2.Next()) {
|
||||
//PyList_Append(overlappss2, new TopoShapeFacePy(new TopoShape(proximity.GetSubShape2 (anIt2.Key()))));
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
PyList_Append(overlappssindex2,PyLong_FromLong(anIt2.Key()+1));
|
||||
#else
|
||||
PyList_Append(overlappssindex2,PyInt_FromLong(anIt2.Key()+1));
|
||||
#endif
|
||||
overlappssindex2.append(Py::Long(anIt2.Key() + 1));
|
||||
}
|
||||
//return Py_BuildValue("OO", overlappss1, overlappss2); //subshapes
|
||||
return Py_BuildValue("OO", overlappssindex1, overlappssindex2); //face indexes
|
||||
|
||||
Py::Tuple tuple(2);
|
||||
tuple.setItem(0, overlappssindex1);
|
||||
tuple.setItem(1, overlappssindex2);
|
||||
return Py::new_reference_to(tuple); //face indexes
|
||||
#else
|
||||
(void)args;
|
||||
PyErr_SetString(PyExc_NotImplementedError, "proximity requires OCCT >= 6.8.1");
|
||||
|
||||
@@ -389,8 +389,9 @@ private:
|
||||
throw Py::Exception();
|
||||
|
||||
std::list<TopoDS_Shape> shapes;
|
||||
if (PyObject_TypeCheck(pShapes, &(Part::TopoShapePy::Type)))
|
||||
if (PyObject_TypeCheck(pShapes, &(Part::TopoShapePy::Type))) {
|
||||
shapes.push_back(static_cast<Part::TopoShapePy*>(pShapes)->getTopoShapePtr()->getShape());
|
||||
}
|
||||
else if (PyObject_TypeCheck(pShapes, &(PyList_Type)) ||
|
||||
PyObject_TypeCheck(pShapes, &(PyTuple_Type))) {
|
||||
Py::Sequence shapeSeq(pShapes);
|
||||
@@ -414,21 +415,18 @@ private:
|
||||
bool need_arc_plane = arc_plane==Area::ArcPlaneAuto;
|
||||
std::list<TopoDS_Shape> wires = Area::sortWires(shapes,start!=0,&pstart,
|
||||
&pend, 0, &arc_plane, PARAM_PY_FIELDS(PARAM_FARG,AREA_PARAMS_SORT));
|
||||
PyObject *list = PyList_New(0);
|
||||
for(auto &wire : wires)
|
||||
PyList_Append(list,Py::new_reference_to(
|
||||
Part::shape2pyshape(TopoDS::Wire(wire))));
|
||||
PyObject *ret = PyTuple_New(need_arc_plane?3:2);
|
||||
PyTuple_SetItem(ret,0,list);
|
||||
PyTuple_SetItem(ret,1,new Base::VectorPy(
|
||||
Base::Vector3d(pend.X(),pend.Y(),pend.Z())));
|
||||
if(need_arc_plane)
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
PyTuple_SetItem(ret,2,PyInt_FromLong(arc_plane));
|
||||
#else
|
||||
PyTuple_SetItem(ret,2,PyLong_FromLong(arc_plane));
|
||||
#endif
|
||||
return Py::asObject(ret);
|
||||
Py::List list;
|
||||
for(auto &wire : wires) {
|
||||
list.append(Part::shape2pyshape(TopoDS::Wire(wire)));
|
||||
}
|
||||
|
||||
Py::Tuple ret(need_arc_plane ? 3 : 2);
|
||||
ret.setItem(0, list);
|
||||
ret.setItem(1, Py::asObject(new Base::VectorPy(Base::Vector3d(pend.X(),pend.Y(),pend.Z()))));
|
||||
if (need_arc_plane)
|
||||
ret.setItem(2, Py::Long(arc_plane));
|
||||
|
||||
return ret;
|
||||
} PATH_CATCH
|
||||
}
|
||||
};
|
||||
|
||||
@@ -277,12 +277,12 @@ PyObject* ToolPy::getToolTypes(PyObject * args)
|
||||
{
|
||||
if (PyArg_ParseTuple(args, "")) {
|
||||
std::vector<std::string> toolTypes = Tool::ToolTypes();
|
||||
PyObject *list = PyList_New(0);
|
||||
Py::List list;
|
||||
for(unsigned i = 0; i != toolTypes.size(); i++) {
|
||||
|
||||
PyList_Append(list, PYSTRING_FROMSTRING(toolTypes[i].c_str()));
|
||||
list.append(Py::asObject(PYSTRING_FROMSTRING(toolTypes[i].c_str())));
|
||||
}
|
||||
return list;
|
||||
return Py::new_reference_to(list);
|
||||
}
|
||||
throw Py::TypeError("This method accepts no argument");
|
||||
}
|
||||
@@ -291,12 +291,12 @@ PyObject* ToolPy::getToolMaterials(PyObject * args)
|
||||
{
|
||||
if (PyArg_ParseTuple(args, "")) {
|
||||
std::vector<std::string> toolMaterials = Tool::ToolMaterials();
|
||||
PyObject *list = PyList_New(0);
|
||||
Py::List list;;
|
||||
for(unsigned i = 0; i != toolMaterials.size(); i++) {
|
||||
|
||||
PyList_Append(list, PYSTRING_FROMSTRING(toolMaterials[i].c_str()));
|
||||
list.append(Py::asObject(PYSTRING_FROMSTRING(toolMaterials[i].c_str())));
|
||||
}
|
||||
return list;
|
||||
return Py::new_reference_to(list);
|
||||
}
|
||||
throw Py::TypeError("This method accepts no argument");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,7 +469,7 @@ PyObject* ExternalGeometryFacadePy::getExtensions(PyObject *args)
|
||||
try {
|
||||
const std::vector<std::weak_ptr<const Part::GeometryExtension>> ext = this->getExternalGeometryFacadePtr()->getExtensions();
|
||||
|
||||
PyObject* list = PyList_New(0);
|
||||
Py::List list;
|
||||
|
||||
for (std::size_t i=0; i<ext.size(); ++i) {
|
||||
|
||||
@@ -478,9 +478,7 @@ PyObject* ExternalGeometryFacadePy::getExtensions(PyObject *args)
|
||||
if(p) {
|
||||
// we create a python copy and add it to the list
|
||||
try {
|
||||
PyObject* cpy = p->copyPyObject();
|
||||
PyList_Append( list, cpy);
|
||||
Py_DECREF(cpy);
|
||||
list.append(Py::asObject(p->copyPyObject()));
|
||||
}
|
||||
catch(Base::NotImplementedError) {
|
||||
// silently ignoring extensions not having a Python object
|
||||
@@ -488,7 +486,7 @@ PyObject* ExternalGeometryFacadePy::getExtensions(PyObject *args)
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
return Py::new_reference_to(list);
|
||||
}
|
||||
catch(const Base::ValueError& e) {
|
||||
PyErr_SetString(Part::PartExceptionOCCError, e.what());
|
||||
|
||||
@@ -447,7 +447,7 @@ PyObject* GeometryFacadePy::getExtensions(PyObject *args)
|
||||
try {
|
||||
const std::vector<std::weak_ptr<const Part::GeometryExtension>> ext = this->getGeometryFacadePtr()->getExtensions();
|
||||
|
||||
PyObject* list = PyList_New(0);
|
||||
Py::List list;
|
||||
|
||||
for (std::size_t i=0; i<ext.size(); ++i) {
|
||||
|
||||
@@ -456,9 +456,7 @@ PyObject* GeometryFacadePy::getExtensions(PyObject *args)
|
||||
if(p) {
|
||||
// we create a python copy and add it to the list
|
||||
try {
|
||||
PyObject* cpy = p->copyPyObject();
|
||||
PyList_Append( list, cpy);
|
||||
Py_DECREF(cpy);
|
||||
list.append(Py::asObject(p->copyPyObject()));
|
||||
}
|
||||
catch(Base::NotImplementedError) {
|
||||
// silently ignoring extensions not having a Python object
|
||||
@@ -466,7 +464,7 @@ PyObject* GeometryFacadePy::getExtensions(PyObject *args)
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
return Py::new_reference_to(list);
|
||||
}
|
||||
catch(const Base::ValueError& e) {
|
||||
PyErr_SetString(Part::PartExceptionOCCError, e.what());
|
||||
|
||||
@@ -197,7 +197,8 @@ private:
|
||||
} else {
|
||||
biggie = false;
|
||||
}
|
||||
PyObject* result = PyList_New(0);
|
||||
|
||||
Py::List result;
|
||||
|
||||
try {
|
||||
EdgeWalker ew;
|
||||
@@ -207,16 +208,18 @@ private:
|
||||
std::vector<TopoDS_Wire> rw = ew.getResultNoDups();
|
||||
std::vector<TopoDS_Wire> sortedWires = ew.sortStrip(rw,biggie); //false==>do not include biggest wires
|
||||
for (auto& w:sortedWires) {
|
||||
PyList_Append(result,new TopoShapeWirePy(new TopoShape(w)));
|
||||
PyObject* wire = new TopoShapeWirePy(new TopoShape(w));
|
||||
result.append(Py::asObject(wire));
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Base::Console().Warning("edgeWalker: input is not planar graph. Wire detection not done\n");
|
||||
}
|
||||
}
|
||||
catch (Base::Exception &e) {
|
||||
throw Py::Exception(Base::BaseExceptionFreeCADError, e.what());
|
||||
}
|
||||
return Py::asObject(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
Py::Object findOuterWire(const Py::Tuple& args)
|
||||
|
||||
@@ -300,13 +300,13 @@ Py::Object CenterLinePy::getEdges(void) const
|
||||
std::vector<std::string> edges = cl->m_edges;
|
||||
int size = edges.size();
|
||||
|
||||
PyObject* result = PyList_New(size);
|
||||
Py::List result(size);
|
||||
|
||||
for (auto& e: edges) {
|
||||
PyList_Append(result, PyUnicode_FromString(e.c_str()));
|
||||
result.append(Py::asObject(PyUnicode_FromString(e.c_str())));
|
||||
}
|
||||
|
||||
return Py::asObject(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void CenterLinePy::setEdges(Py::Object arg)
|
||||
@@ -346,13 +346,13 @@ Py::Object CenterLinePy::getFaces(void) const
|
||||
std::vector<std::string> faces = cl->m_faces;
|
||||
int size = faces.size();
|
||||
|
||||
PyObject* result = PyList_New(size);
|
||||
Py::List result(size);
|
||||
|
||||
for (auto& f: faces) {
|
||||
PyList_Append(result, PyUnicode_FromString(f.c_str()));
|
||||
result.append(Py::asObject(PyUnicode_FromString(f.c_str())));
|
||||
}
|
||||
|
||||
return Py::asObject(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void CenterLinePy::setFaces(Py::Object arg)
|
||||
@@ -393,13 +393,13 @@ Py::Object CenterLinePy::getPoints(void) const
|
||||
std::vector<std::string> points = cl->m_verts;
|
||||
int size = points.size();
|
||||
|
||||
PyObject* result = PyList_New(size);
|
||||
Py::List result(size);
|
||||
|
||||
for (auto& p: points) {
|
||||
PyList_Append(result, PyUnicode_FromString(p.c_str()));
|
||||
result.append(Py::asObject(PyUnicode_FromString(p.c_str())));
|
||||
}
|
||||
|
||||
return Py::asObject(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void CenterLinePy::setPoints(Py::Object arg)
|
||||
|
||||
@@ -82,23 +82,23 @@ PyObject* DrawPagePy::getAllViews(PyObject* args)
|
||||
DrawPage* page = getDrawPagePtr();
|
||||
std::vector<App::DocumentObject*> allViews = page->getAllViews();
|
||||
|
||||
PyObject* ret = PyList_New(0);
|
||||
Py::List ret;
|
||||
for (auto&v: allViews) {
|
||||
if (v->isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())) {
|
||||
TechDraw::DrawProjGroupItem* dpgi = static_cast<TechDraw::DrawProjGroupItem*>(v);
|
||||
PyList_Append(ret,new TechDraw::DrawProjGroupItemPy(dpgi)); //is this legit? or need to make new copy of dv?
|
||||
ret.append(Py::asObject(new TechDraw::DrawProjGroupItemPy(dpgi))); //is this legit? or need to make new copy of dv?
|
||||
} else if (v->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) {
|
||||
TechDraw::DrawViewPart* dvp = static_cast<TechDraw::DrawViewPart*>(v);
|
||||
PyList_Append(ret,new TechDraw::DrawViewPartPy(dvp));
|
||||
ret.append(Py::asObject(new TechDraw::DrawViewPartPy(dvp)));
|
||||
} else if (v->isDerivedFrom(TechDraw::DrawViewAnnotation::getClassTypeId())) {
|
||||
TechDraw::DrawViewAnnotation* dva = static_cast<TechDraw::DrawViewAnnotation*>(v);
|
||||
PyList_Append(ret,new TechDraw::DrawViewAnnotationPy(dva));
|
||||
ret.append(Py::asObject(new TechDraw::DrawViewAnnotationPy(dva)));
|
||||
} else {
|
||||
TechDraw::DrawView* dv = static_cast<TechDraw::DrawView*>(v);
|
||||
PyList_Append(ret,new TechDraw::DrawViewPy(dv));
|
||||
ret.append(Py::asObject(new TechDraw::DrawViewPy(dv)));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return Py::new_reference_to(ret);
|
||||
}
|
||||
|
||||
// double getPageWidth() const;
|
||||
|
||||
@@ -93,27 +93,20 @@ PyObject* DrawViewClipPy::removeView(PyObject* args)
|
||||
PyObject* DrawViewClipPy::getChildViewNames(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
DrawViewClip* clip = getDrawViewClipPtr();
|
||||
std::vector<std::string> strings = clip->getChildViewNames();
|
||||
int stringSize = strings.size();
|
||||
|
||||
PyObject* result = PyList_New(stringSize);
|
||||
Py::List result(stringSize);
|
||||
|
||||
std::vector<std::string>::iterator it = strings.begin();
|
||||
for( ; it != strings.end(); it++) {
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
PyObject* pString = PyString_FromString(it->c_str()); //TODO: unicode & py3
|
||||
#else
|
||||
PyObject* pString = PyUnicode_FromString(it->c_str());
|
||||
#endif
|
||||
//int rc =
|
||||
static_cast<void> (PyList_Append(result, pString));
|
||||
result.append(Py::String(*it));
|
||||
}
|
||||
|
||||
// PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return result;
|
||||
return Py::new_reference_to(result);
|
||||
}
|
||||
|
||||
PyObject *DrawViewClipPy::getCustomAttributes(const char* ) const
|
||||
|
||||
@@ -76,10 +76,10 @@ PyObject* DrawViewDimensionPy::getLinearPoints(PyObject* args)
|
||||
(void) args;
|
||||
DrawViewDimension* dvd = getDrawViewDimensionPtr();
|
||||
pointPair pts = dvd->getLinearPoints();
|
||||
PyObject* ret = PyList_New(0);
|
||||
PyList_Append(ret,new Base::VectorPy(new Base::Vector3d(pts.first)));
|
||||
PyList_Append(ret,new Base::VectorPy(new Base::Vector3d(pts.second)));
|
||||
return ret;
|
||||
Py::List ret;
|
||||
ret.append(Py::asObject(new Base::VectorPy(new Base::Vector3d(pts.first))));
|
||||
ret.append(Py::asObject(new Base::VectorPy(new Base::Vector3d(pts.second))));
|
||||
return Py::new_reference_to(ret);
|
||||
}
|
||||
|
||||
PyObject* DrawViewDimensionPy::getArcPoints(PyObject* args)
|
||||
@@ -87,14 +87,14 @@ PyObject* DrawViewDimensionPy::getArcPoints(PyObject* args)
|
||||
(void) args;
|
||||
DrawViewDimension* dvd = getDrawViewDimensionPtr();
|
||||
arcPoints pts = dvd->getArcPoints();
|
||||
PyObject* ret = PyList_New(0);
|
||||
PyList_Append(ret,new Base::VectorPy(new Base::Vector3d(pts.center)));
|
||||
PyList_Append(ret,new Base::VectorPy(new Base::Vector3d(pts.onCurve.first)));
|
||||
PyList_Append(ret,new Base::VectorPy(new Base::Vector3d(pts.onCurve.second)));
|
||||
PyList_Append(ret,new Base::VectorPy(new Base::Vector3d(pts.arcEnds.first)));
|
||||
PyList_Append(ret,new Base::VectorPy(new Base::Vector3d(pts.arcEnds.second)));
|
||||
PyList_Append(ret,new Base::VectorPy(new Base::Vector3d(pts.midArc)));
|
||||
return ret;
|
||||
Py::List ret;
|
||||
ret.append(Py::asObject(new Base::VectorPy(new Base::Vector3d(pts.center))));
|
||||
ret.append(Py::asObject(new Base::VectorPy(new Base::Vector3d(pts.onCurve.first))));
|
||||
ret.append(Py::asObject(new Base::VectorPy(new Base::Vector3d(pts.onCurve.second))));
|
||||
ret.append(Py::asObject(new Base::VectorPy(new Base::Vector3d(pts.arcEnds.first))));
|
||||
ret.append(Py::asObject(new Base::VectorPy(new Base::Vector3d(pts.arcEnds.second))));
|
||||
ret.append(Py::asObject(new Base::VectorPy(new Base::Vector3d(pts.midArc))));
|
||||
return Py::new_reference_to(ret);
|
||||
}
|
||||
|
||||
PyObject* DrawViewDimensionPy::getAnglePoints(PyObject* args)
|
||||
@@ -102,11 +102,11 @@ PyObject* DrawViewDimensionPy::getAnglePoints(PyObject* args)
|
||||
(void) args;
|
||||
DrawViewDimension* dvd = getDrawViewDimensionPtr();
|
||||
anglePoints pts = dvd->getAnglePoints();
|
||||
PyObject* ret = PyList_New(0);
|
||||
PyList_Append(ret,new Base::VectorPy(new Base::Vector3d(pts.ends.first)));
|
||||
PyList_Append(ret,new Base::VectorPy(new Base::Vector3d(pts.ends.second)));
|
||||
PyList_Append(ret,new Base::VectorPy(new Base::Vector3d(pts.vertex)));
|
||||
return ret;
|
||||
Py::List ret;
|
||||
ret.append(Py::asObject(new Base::VectorPy(new Base::Vector3d(pts.ends.first))));
|
||||
ret.append(Py::asObject(new Base::VectorPy(new Base::Vector3d(pts.ends.second))));
|
||||
ret.append(Py::asObject(new Base::VectorPy(new Base::Vector3d(pts.vertex))));
|
||||
return Py::new_reference_to(ret);
|
||||
}
|
||||
|
||||
PyObject* DrawViewDimensionPy::getArrowPositions(PyObject* args)
|
||||
@@ -114,10 +114,10 @@ PyObject* DrawViewDimensionPy::getArrowPositions(PyObject* args)
|
||||
(void) args;
|
||||
DrawViewDimension* dvd = getDrawViewDimensionPtr();
|
||||
pointPair pts = dvd->getArrowPositions();
|
||||
PyObject* ret = PyList_New(0);
|
||||
PyList_Append(ret,new Base::VectorPy(new Base::Vector3d(pts.first)));
|
||||
PyList_Append(ret,new Base::VectorPy(new Base::Vector3d(pts.second)));
|
||||
return ret;
|
||||
Py::List ret;
|
||||
ret.append(Py::asObject(new Base::VectorPy(new Base::Vector3d(pts.first))));
|
||||
ret.append(Py::asObject(new Base::VectorPy(new Base::Vector3d(pts.second))));
|
||||
return Py::new_reference_to(ret);
|
||||
}
|
||||
PyObject *DrawViewDimensionPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
|
||||
@@ -77,32 +77,32 @@ PyObject* DrawViewPartPy::getVisibleEdges(PyObject *args)
|
||||
{
|
||||
(void) args;
|
||||
DrawViewPart* dvp = getDrawViewPartPtr();
|
||||
PyObject* pEdgeList = PyList_New(0);
|
||||
Py::List pEdgeList;
|
||||
std::vector<TechDraw::BaseGeom*> geoms = dvp->getEdgeGeometry();
|
||||
for (auto& g: geoms) {
|
||||
if (g->hlrVisible) {
|
||||
PyObject* pEdge = new Part::TopoShapeEdgePy(new Part::TopoShape(g->occEdge));
|
||||
PyList_Append(pEdgeList, pEdge);
|
||||
pEdgeList.append(Py::asObject(pEdge));
|
||||
}
|
||||
}
|
||||
|
||||
return pEdgeList;
|
||||
return Py::new_reference_to(pEdgeList);
|
||||
}
|
||||
|
||||
PyObject* DrawViewPartPy::getHiddenEdges(PyObject *args)
|
||||
{
|
||||
(void) args;
|
||||
DrawViewPart* dvp = getDrawViewPartPtr();
|
||||
PyObject* pEdgeList = PyList_New(0);
|
||||
Py::List pEdgeList;
|
||||
std::vector<TechDraw::BaseGeom*> geoms = dvp->getEdgeGeometry();
|
||||
for (auto& g: geoms) {
|
||||
if (!g->hlrVisible) {
|
||||
PyObject* pEdge = new Part::TopoShapeEdgePy(new Part::TopoShape(g->occEdge));
|
||||
PyList_Append(pEdgeList, pEdge);
|
||||
pEdgeList.append(Py::asObject(pEdge));
|
||||
}
|
||||
}
|
||||
|
||||
return pEdgeList;
|
||||
return Py::new_reference_to(pEdgeList);
|
||||
}
|
||||
|
||||
PyObject* DrawViewPartPy::requestPaint(PyObject *args)
|
||||
|
||||