Improve geom creation, scaling and translation

This commit is contained in:
WandererFan 2014-03-01 16:10:46 -05:00 committed by wmayer
parent c700d9d368
commit 13cdc443fa
4 changed files with 96 additions and 131 deletions

View File

@ -2134,8 +2134,6 @@ def makePoint(X=0, Y=0, Z=0,color=None,name = "Point", point_size= 5):
def makeShapeString(String,FontFile,Size = 100,Tracking = 0): def makeShapeString(String,FontFile,Size = 100,Tracking = 0):
'''ShapeString(Text,FontFile,Height,Track): Turns a text string '''ShapeString(Text,FontFile,Height,Track): Turns a text string
into a Compound Shape''' into a Compound Shape'''
# temporary code
obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","ShapeString") obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","ShapeString")
_ShapeString(obj) _ShapeString(obj)
obj.String = String obj.String = String
@ -4580,7 +4578,7 @@ class _ShapeString(_DraftObject):
obj.addProperty("App::PropertyString","String","Draft","Text string") obj.addProperty("App::PropertyString","String","Draft","Text string")
obj.addProperty("App::PropertyFile","FontFile","Draft","Font file name") obj.addProperty("App::PropertyFile","FontFile","Draft","Font file name")
obj.addProperty("App::PropertyFloat","Size","Draft","Height of text") obj.addProperty("App::PropertyFloat","Size","Draft","Height of text")
obj.addProperty("App::PropertyInteger","Tracking","Draft", obj.addProperty("App::PropertyFloat","Tracking","Draft",
"Inter-character spacing") "Inter-character spacing")
def execute(self, obj): def execute(self, obj):
@ -4590,11 +4588,6 @@ class _ShapeString(_DraftObject):
if obj.String and obj.FontFile: if obj.String and obj.FontFile:
if obj.Placement: if obj.Placement:
plm = obj.Placement plm = obj.Placement
# TODO: os.path.splitunc() for Win/Samba net files?
#head, tail = os.path.splitdrive(obj.FontFile) # os.path.splitdrive() for Win
#head, tail = os.path.split(tail)
#head = head + '/' # os.split drops last '/' from head
print "_ShapeString FontFile: ", obj.FontFile
CharList = Part.makeWireString(obj.String, CharList = Part.makeWireString(obj.String,
obj.FontFile, obj.FontFile,
obj.Size, obj.Size,

View File

@ -330,28 +330,26 @@ static PyObject * makeWireString(PyObject *self, PyObject *args)
const char* fontfile; const char* fontfile;
const char* fontspec; const char* fontspec;
bool useFontSpec = false; bool useFontSpec = false;
float height; double height;
int track = 0; double track = 0;
Py_UNICODE *unichars; Py_UNICODE *unichars;
Py_ssize_t pysize; Py_ssize_t pysize;
PyObject *CharList; PyObject *CharList;
if (PyArg_ParseTuple(args, "Ossf|i", &intext, // compatibility with old version if (PyArg_ParseTuple(args, "Ossd|d", &intext, // compatibility with old version
&dir, &dir,
&fontfile, &fontfile,
&height, &height,
&track)) { &track)) {
Base::Console().Message("** makeWireString dir + font\n");
useFontSpec = false; } useFontSpec = false; }
else { else {
PyErr_Clear(); PyErr_Clear();
if (PyArg_ParseTuple(args, "Osf|i", &intext, if (PyArg_ParseTuple(args, "Osd|d", &intext,
&fontspec, &fontspec,
&height, &height,
&track)) { &track)) {
Base::Console().Message("** makeWireString useFontSpec\n");
useFontSpec = true; } useFontSpec = true; }
else { else {
Base::Console().Message("** makeWireString bad args.\n"); Base::Console().Message("** makeWireString bad args.\n");
@ -378,10 +376,8 @@ static PyObject * makeWireString(PyObject *self, PyObject *args)
try { try {
if (useFontSpec) { if (useFontSpec) {
Base::Console().Message("** makeWireString trying fontspec\n");
CharList = FT2FC(unichars,pysize,fontspec,height,track); } CharList = FT2FC(unichars,pysize,fontspec,height,track); }
else { else {
Base::Console().Message("** makeWireString trying dir + file\n");
CharList = FT2FC(unichars,pysize,dir,fontfile,height,track); } CharList = FT2FC(unichars,pysize,dir,fontfile,height,track); }
} }
catch (Standard_DomainError) { // Standard_DomainError is OCC error. catch (Standard_DomainError) { // Standard_DomainError is OCC error.

View File

@ -39,16 +39,23 @@
#include <stdexcept> #include <stdexcept>
#include <vector> #include <vector>
#include <BRepLib.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx> #include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx> #include <BRepBuilderAPI_MakeWire.hxx>
#include <Geom_BezierCurve.hxx> #include <BRepBuilderAPI_Transform.hxx>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx> #include <TopoDS_Edge.hxx>
#include <TopoDS_Wire.hxx> #include <TopoDS_Wire.hxx>
#include <TColStd_Array1OfReal.hxx> #include <TColgp_Array1OfPnt2d.hxx>
#include <TColStd_Array1OfInteger.hxx> #include <GCE2d_MakeSegment.hxx>
#include <TColgp_Array1OfPnt.hxx> #include <Geom2d_TrimmedCurve.hxx>
#include <Geom_Plane.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <gp_Trsf.hxx>
#include <Base/Console.h>
#include "TopoShape.h" #include "TopoShape.h"
#include "TopoShapePy.h" #include "TopoShapePy.h"
#include "TopoShapeEdgePy.h" #include "TopoShapeEdgePy.h"
@ -67,17 +74,17 @@ using namespace Part;
typedef unsigned long UNICHAR; // ul is FT2's codepoint type <=> Py_UNICODE2/4 typedef unsigned long UNICHAR; // ul is FT2's codepoint type <=> Py_UNICODE2/4
// Private function prototypes // Private function prototypes
PyObject* getGlyphContours(FT_Face FTFont, UNICHAR currchar, int PenPos, float Scale); PyObject* getGlyphContours(FT_Face FTFont, UNICHAR currchar, double PenPos, double Scale);
FT_Vector getKerning(FT_Face FTFont, UNICHAR lc, UNICHAR rc); FT_Vector getKerning(FT_Face FTFont, UNICHAR lc, UNICHAR rc);
TopoShapeWirePy* edgesToWire(std::vector<TopoDS_Edge> Edges); TopoDS_Wire edgesToWire(std::vector<TopoDS_Edge> Edges);
// for compatibility with old version - separate path & filename // for compatibility with old version - separate path & filename
PyObject* FT2FC(const Py_UNICODE *PyUString, PyObject* FT2FC(const Py_UNICODE *PyUString,
const size_t length, const size_t length,
const char *FontPath, const char *FontPath,
const char *FontName, const char *FontName,
const float stringheight, const double stringheight,
const int tracking) { const double tracking) {
std::string FontSpec; std::string FontSpec;
std::string tmpPath = FontPath; // can't concat const char* std::string tmpPath = FontPath; // can't concat const char*
std::string tmpName = FontName; std::string tmpName = FontName;
@ -89,8 +96,8 @@ PyObject* FT2FC(const Py_UNICODE *PyUString,
PyObject* FT2FC(const Py_UNICODE *PyUString, PyObject* FT2FC(const Py_UNICODE *PyUString,
const size_t length, const size_t length,
const char *FontSpec, const char *FontSpec,
const float stringheight, // fc coords const double stringheight, // fc coords
const int tracking) { // fc coords const double tracking) { // fc coords
FT_Library FTLib; FT_Library FTLib;
FT_Face FTFont; FT_Face FTFont;
FT_Error error; FT_Error error;
@ -98,13 +105,11 @@ PyObject* FT2FC(const Py_UNICODE *PyUString,
FT_Vector kern; FT_Vector kern;
FT_UInt FTLoadFlags = FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP; FT_UInt FTLoadFlags = FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP;
//std::string FontSpec;
std::stringstream ErrorMsg; std::stringstream ErrorMsg;
float scalefactor; double PenPos = 0, scalefactor;
UNICHAR prevchar = 0, currchar = 0; UNICHAR prevchar = 0, currchar = 0;
int cadv, PenPos = 0, PyErr; int cadv, PyErr;
size_t i; size_t i;
PyObject *WireList, *CharList; PyObject *WireList, *CharList;
error = FT_Init_FreeType(&FTLib); error = FT_Init_FreeType(&FTLib);
@ -113,10 +118,6 @@ PyObject* FT2FC(const Py_UNICODE *PyUString,
throw std::runtime_error(ErrorMsg.str()); throw std::runtime_error(ErrorMsg.str());
} }
//std::string tmpPath = FontPath; // can't concat const char*
//std::string tmpName = FontName;
//FontSpec = tmpPath + tmpName;
// FT does not return an error if font file not found? // FT does not return an error if font file not found?
std::ifstream is; std::ifstream is;
is.open (FontSpec); is.open (FontSpec);
@ -124,7 +125,6 @@ PyObject* FT2FC(const Py_UNICODE *PyUString,
ErrorMsg << "Font file not found: " << FontSpec; ErrorMsg << "Font file not found: " << FontSpec;
throw std::runtime_error(ErrorMsg.str()); throw std::runtime_error(ErrorMsg.str());
} }
// maybe boost::filesystem::exists for x-platform??
error = FT_New_Face(FTLib,FontSpec,FaceIndex, &FTFont); error = FT_New_Face(FTLib,FontSpec,FaceIndex, &FTFont);
if(error) { if(error) {
@ -146,8 +146,8 @@ PyObject* FT2FC(const Py_UNICODE *PyUString,
throw std::runtime_error(ErrorMsg.str()); throw std::runtime_error(ErrorMsg.str());
} }
scalefactor = float(stringheight/FTFont->height);
CharList = PyList_New(0); CharList = PyList_New(0);
scalefactor = stringheight/float(FTFont->height);
for (i=0; i<length; i++) { for (i=0; i<length; i++) {
currchar = PyUString[i]; currchar = PyUString[i];
error = FT_Load_Char(FTFont, error = FT_Load_Char(FTFont,
@ -163,14 +163,10 @@ PyObject* FT2FC(const Py_UNICODE *PyUString,
PenPos += kern.x; PenPos += kern.x;
WireList = getGlyphContours(FTFont,currchar,PenPos, scalefactor); WireList = getGlyphContours(FTFont,currchar,PenPos, scalefactor);
if (!PyList_Size(WireList)) // empty ==> whitespace if (!PyList_Size(WireList)) // empty ==> whitespace
std::cout << "char " << i << " = " << hex << std::showbase << currchar << " has no wires! " << std::endl; Base::Console().Log("FT2FC char '0x%04x'/'%d' has no Wires!\n", currchar, currchar);
else else
PyErr = PyList_Append(CharList, WireList); //add error check PyErr = PyList_Append(CharList, WireList);
// not entirely happy with tracking solution. It's specified in FC units, PenPos += (cadv + tracking);
// so we have to convert back to font units to use it here. We could
// lose some accuracy. Hard to put it into FT callbacks since tracking
// only affects position of chars 2 - n. Don't want to loop 2x through wires.
PenPos += cadv + int(tracking/scalefactor);
prevchar = currchar; prevchar = currchar;
} }
@ -186,46 +182,35 @@ PyObject* FT2FC(const Py_UNICODE *PyUString,
//********** FT Decompose callbacks and data defns //********** FT Decompose callbacks and data defns
// FT Decomp Context for 1 char // FT Decomp Context for 1 char
struct FTDC_Ctx { struct FTDC_Ctx {
// std::vector<TopoShapeWirePy*> TWires; std::vector<TopoDS_Wire> Wires;
PyObject* WireList;
std::vector<TopoDS_Edge> Edges; std::vector<TopoDS_Edge> Edges;
UNICHAR currchar; UNICHAR currchar;
int penpos;
float scalefactor;
FT_Vector LastVert; FT_Vector LastVert;
Handle_Geom_Surface surf;
}; };
// move_cb called for start of new contour. pt is xy of contour start. // move_cb called for start of new contour. pt is xy of contour start.
// p points to the context where we remember what happened previously (last point, etc) // p points to the context where we remember what happened previously (last point, etc)
static int move_cb(const FT_Vector* pt, void* p) { static int move_cb(const FT_Vector* pt, void* p) {
FTDC_Ctx* dc = (FTDC_Ctx*) p; FTDC_Ctx* dc = (FTDC_Ctx*) p;
int PyErr;
if (!dc->Edges.empty()){ if (!dc->Edges.empty()){
TopoShapeWirePy* newwire; TopoDS_Wire newwire = edgesToWire(dc->Edges);
newwire = edgesToWire(dc->Edges); dc->Wires.push_back(newwire);
PyErr = PyList_Append(dc->WireList, newwire); // add error check
dc->Edges.clear(); dc->Edges.clear();
} }
dc->LastVert.x = pt->x + dc->penpos; dc->LastVert = *pt;
dc->LastVert.y = pt->y;
return 0; return 0;
} }
// line_cb called for line segment in the current contour: line(LastVert -- pt) // line_cb called for line segment in the current contour: line(LastVert -- pt)
static int line_cb(const FT_Vector* pt, void* p) { static int line_cb(const FT_Vector* pt, void* p) {
FTDC_Ctx* dc = (FTDC_Ctx*) p; FTDC_Ctx* dc = (FTDC_Ctx*) p;
// convert font coords to FC/OCC coords gp_Pnt2d v1(dc->LastVert.x, dc->LastVert.y);
float v1x = dc->scalefactor * dc->LastVert.x; gp_Pnt2d v2(pt->x, pt->y);
float v1y = dc->scalefactor * dc->LastVert.y; Handle(Geom2d_TrimmedCurve) lseg = GCE2d_MakeSegment(v1,v2);
float v2x = dc->scalefactor * (pt->x + dc->penpos); TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(lseg , dc->surf);
float v2y = dc->scalefactor * pt->y;
gp_Pnt v1(v1x, v1y, 0);
gp_Pnt v2(v2x, v2y, 0);
BRepBuilderAPI_MakeEdge makeEdge(v1,v2);
TopoDS_Edge edge = makeEdge.Edge();
dc->Edges.push_back(edge); dc->Edges.push_back(edge);
dc->LastVert.x = pt->x + dc->penpos; dc->LastVert = *pt;
dc->LastVert.y = pt->y;
return 0; return 0;
} }
@ -233,28 +218,17 @@ static int line_cb(const FT_Vector* pt, void* p) {
// (ie V-C-V in TTF fonts). BCurve(LastVert -- pt0 -- pt1) // (ie V-C-V in TTF fonts). BCurve(LastVert -- pt0 -- pt1)
static int quad_cb(const FT_Vector* pt0, const FT_Vector* pt1, void* p) { static int quad_cb(const FT_Vector* pt0, const FT_Vector* pt1, void* p) {
FTDC_Ctx* dc = (FTDC_Ctx*) p; FTDC_Ctx* dc = (FTDC_Ctx*) p;
TColgp_Array1OfPnt Poles(1,3); TColgp_Array1OfPnt2d Poles(1,3);
// convert font coords to FC/OCC coords gp_Pnt2d v1(dc->LastVert.x, dc->LastVert.y);
float v1x = dc->scalefactor * dc->LastVert.x; gp_Pnt2d c1(pt0->x, pt0->y);
float v1y = dc->scalefactor * dc->LastVert.y; gp_Pnt2d v2(pt1->x, pt1->y);
float c1x = dc->scalefactor * (pt0->x + dc->penpos);
float c1y = dc->scalefactor * pt0->y;
float v2x = dc->scalefactor * (pt1->x + dc->penpos);
float v2y = dc->scalefactor * pt1->y;
gp_Pnt v1(v1x, v1y, 0);
gp_Pnt c1(c1x, c1y, 0);
gp_Pnt v2(v2x, v2y, 0);
Poles.SetValue(1, v1); Poles.SetValue(1, v1);
Poles.SetValue(2, c1); Poles.SetValue(2, c1);
Poles.SetValue(3, v2); Poles.SetValue(3, v2);
// "new" bcseg? need to free this? don't know when. does makeedge need it forever? or just for creation? Handle(Geom2d_BezierCurve) bcseg = new Geom2d_BezierCurve(Poles);
// how to delete a "handle"? memory leak? TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(bcseg , dc->surf);
Handle(Geom_BezierCurve) bcseg = new Geom_BezierCurve(Poles);
BRepBuilderAPI_MakeEdge makeEdge(bcseg, v1, v2);
TopoDS_Edge edge = makeEdge.Edge();
dc->Edges.push_back(edge); dc->Edges.push_back(edge);
dc->LastVert.x = pt1->x + dc->penpos; dc->LastVert = *pt1;
dc->LastVert.y = pt1->y;
return 0; return 0;
} }
@ -262,30 +236,19 @@ static int quad_cb(const FT_Vector* pt0, const FT_Vector* pt1, void* p) {
// Type 1 fonts). BCurve(LastVert -- pt0 -- pt1 -- pt2) // Type 1 fonts). BCurve(LastVert -- pt0 -- pt1 -- pt2)
static int cubic_cb(const FT_Vector* pt0, const FT_Vector* pt1, const FT_Vector* pt2, void* p) { static int cubic_cb(const FT_Vector* pt0, const FT_Vector* pt1, const FT_Vector* pt2, void* p) {
FTDC_Ctx* dc = (FTDC_Ctx*) p; FTDC_Ctx* dc = (FTDC_Ctx*) p;
TColgp_Array1OfPnt Poles(1,4); TColgp_Array1OfPnt2d Poles(1,4);
// convert font coords to FC/OCC coords gp_Pnt2d v1(dc->LastVert.x, dc->LastVert.y);
float v1x = dc->scalefactor * dc->LastVert.x; gp_Pnt2d c1(pt0->x, pt0->y);
float v1y = dc->scalefactor * dc->LastVert.y; gp_Pnt2d c2(pt1->x, pt1->y);
float c1x = dc->scalefactor * (pt0->x + dc->penpos); gp_Pnt2d v2(pt2->x, pt2->y);
float c1y = dc->scalefactor * pt0->y;
float c2x = dc->scalefactor * (pt1->x + dc->penpos);
float c2y = dc->scalefactor * pt1->y;
float v2x = dc->scalefactor * (pt2->x + dc->penpos);
float v2y = dc->scalefactor * pt2->y;
gp_Pnt v1(v1x, v1y, 0);
gp_Pnt c1(c1x, c1y, 0);
gp_Pnt c2(c2x, c2y, 0);
gp_Pnt v2(v2x, v2y, 0);
Poles.SetValue(1, v1); Poles.SetValue(1, v1);
Poles.SetValue(2, c1); Poles.SetValue(2, c1);
Poles.SetValue(3, c2); Poles.SetValue(3, c2);
Poles.SetValue(4, v2); Poles.SetValue(4, v2);
Handle(Geom_BezierCurve) bcseg = new Geom_BezierCurve(Poles); // new? need to free this? Handle(Geom2d_BezierCurve) bcseg = new Geom2d_BezierCurve(Poles);
BRepBuilderAPI_MakeEdge makeEdge(bcseg, v1, v2); TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(bcseg , dc->surf);
TopoDS_Edge edge = makeEdge.Edge();
dc->Edges.push_back(edge); dc->Edges.push_back(edge);
dc->LastVert.x = pt2->x + dc->penpos; dc->LastVert = *pt2;
dc->LastVert.y = pt2->y;
return 0; return 0;
} }
@ -300,17 +263,15 @@ static FT_Outline_Funcs FTcbFuncs = {
//********** FT2FC Helpers //********** FT2FC Helpers
// get glyph outline in wires // get glyph outline in wires
//std::vector<TopoShapeWirePy*> getGlyphContours(FT_Face FTFont, UNICHAR currchar, int PenPos, float Scale) { PyObject* getGlyphContours(FT_Face FTFont, UNICHAR currchar, double PenPos, double Scale) {
PyObject* getGlyphContours(FT_Face FTFont, UNICHAR currchar, int PenPos, float Scale) {
FT_Error error = 0; FT_Error error = 0;
std::stringstream ErrorMsg; std::stringstream ErrorMsg;
FTDC_Ctx ctx;
int PyErr; int PyErr;
gp_Pnt origin = gp_Pnt(0.0,0.0,0.0);
FTDC_Ctx ctx;
ctx.currchar = currchar; ctx.currchar = currchar;
ctx.penpos = PenPos; ctx.surf = new Geom_Plane(origin,gp::DZ());
ctx.scalefactor = Scale;
ctx.WireList = PyList_New(0);
error = FT_Outline_Decompose(&FTFont->glyph->outline, error = FT_Outline_Decompose(&FTFont->glyph->outline,
&FTcbFuncs, &FTcbFuncs,
@ -320,18 +281,33 @@ PyObject* getGlyphContours(FT_Face FTFont, UNICHAR currchar, int PenPos, float S
throw std::runtime_error(ErrorMsg.str()); throw std::runtime_error(ErrorMsg.str());
} }
// make the last twire // make the last TopoDS_Wire
if (!ctx.Edges.empty()){ if (!ctx.Edges.empty()){
// ctx.TWires.push_back(edgesToWire(ctx.Edges)); ctx.Wires.push_back(edgesToWire(ctx.Edges));
PyErr = PyList_Append(ctx.WireList, edgesToWire(ctx.Edges)); // add error check
} }
FT_Orientation fontClass = FT_Outline_Get_Orientation(&FTFont->glyph->outline);
PyObject* ret = PyList_New(0);
// return(ctx.TWires); gp_Vec pointer = gp_Vec(PenPos * Scale,0.0,0.0);
return(ctx.WireList); gp_Trsf xForm;
xForm.SetScale(origin,Scale);
xForm.SetTranslationPart(pointer);
BRepBuilderAPI_Transform BRepScale(xForm);
bool bCopy = true; // no effect?
for(std::vector<TopoDS_Wire>::iterator iWire=ctx.Wires.begin();iWire != ctx.Wires.end();iWire++) {
BRepScale.Perform(*iWire,bCopy);
if (!BRepScale.IsDone()) {
ErrorMsg << "FT2FC OCC BRepScale failed \n";
throw std::runtime_error(ErrorMsg.str());
}
PyErr = PyList_Append(ret,new TopoShapeWirePy(new TopoShape(TopoDS::Wire(BRepScale.Shape()))));
}
return(ret);
} }
// get kerning values for this char pair // get kerning values for this char pair
//TODO: should check FT_HASKERNING flag? //TODO: should check FT_HASKERNING flag? returns (0,0) if no kerning?
FT_Vector getKerning(FT_Face FTFont, UNICHAR lc, UNICHAR rc) { FT_Vector getKerning(FT_Face FTFont, UNICHAR lc, UNICHAR rc) {
FT_Vector retXY; FT_Vector retXY;
FT_Error error; FT_Error error;
@ -350,19 +326,19 @@ FT_Vector getKerning(FT_Face FTFont, UNICHAR lc, UNICHAR rc) {
} }
// Make a TopoDS_Wire from a list of TopoDS_Edges // Make a TopoDS_Wire from a list of TopoDS_Edges
TopoShapeWirePy* edgesToWire(std::vector<TopoDS_Edge> Edges) { TopoDS_Wire edgesToWire(std::vector<TopoDS_Edge> Edges) {
TopoDS_Wire occwire; TopoDS_Wire occwire;
std::vector<TopoDS_Edge>::iterator iEdge; std::vector<TopoDS_Edge>::iterator iEdge;
// if Edges.empty() ????
BRepBuilderAPI_MakeWire mkWire; BRepBuilderAPI_MakeWire mkWire;
for (iEdge = Edges.begin(); iEdge != Edges.end(); ++iEdge){ for (iEdge = Edges.begin(); iEdge != Edges.end(); ++iEdge){
mkWire.Add(*iEdge); mkWire.Add(*iEdge);
if (!mkWire.IsDone()) {
Base::Console().Message("FT2FC Trace edgesToWire failed to add wire\n");
}
} }
// if(mkWire.Done()) ???
occwire = mkWire.Wire(); occwire = mkWire.Wire();
TopoShapeWirePy* newwire = new TopoShapeWirePy(new TopoShape (occwire)); BRepLib::BuildCurves3d(occwire);
return(occwire);
return(newwire);
} }

View File

@ -34,14 +34,14 @@ PyObject* FT2FC(const Py_UNICODE *unichars,
const size_t length, const size_t length,
const char *FontPath, const char *FontPath,
const char *FontName, const char *FontName,
const float stringheight, const double stringheight,
const int tracking); const double tracking);
PyObject* FT2FC(const Py_UNICODE *unichars, PyObject* FT2FC(const Py_UNICODE *unichars,
const size_t length, const size_t length,
const char *FontSpec, const char *FontSpec,
const float stringheight, const double stringheight,
const int tracking); const double tracking);
#endif // FT2FC_H #endif // FT2FC_H