def toPolyline(self, pattern, objPos, objPath, layer, color, lineType, lineWeight): """ TOWRITE .. NOTE:: This function should be used to interpret various object types and save them as polylines for stitchOnly formats. :param `pattern`: TOWRITE :type `pattern`: EmbPattern :param `objPos`: TOWRITE :type `objPos`: `QPointF`_ :param `objPath`: TOWRITE :type `objPath`: `QPainterPath`_ :param `layer`: TOWRITE :type `layer`: QString :param `color`: TOWRITE :type `color`: `QColor`_ :param `lineType`: TOWRITE :type `lineType`: QString :param `lineWeight`: TOWRITE :type `lineWeight`: QString """ startX = objPos.x() # qreal startY = objPos.y() # qreal pointList = 0 # EmbPointList* lastPoint = 0 # EmbPointList* element = QPainterPath.Element for i in range(0, objPath.elementCount()): # for(int i = 0; i < objPath.elementCount(); ++i) element = objPath.elementAt(i) if not pointList: pointList = lastPoint = embPointList_create(element.x + startX, -(element.y + startY)) else: lastPoint = embPointList_add(lastPoint, embPoint_make(element.x + startX, -(element.y + startY))) polyObject = embPolylineObject_create(pointList, embColor_make(color.red(), color.green(), color.blue()), 1) # EmbPolylineObject* # TODO: proper lineType embPattern_addPolylineObjectAbs(pattern, polyObject)
def make_thread(color): thread = libembroidery.EmbThread() thread.color = libembroidery.embColor_make(*color.rgb) thread.description = color.name thread.catalogNumber = "" return thread
def toPolyline(self, pattern, objPos, objPath, layer, color, lineType, lineWeight): """ TOWRITE .. NOTE:: This function should be used to interpret various object types and save them as polylines for stitchOnly formats. :param `pattern`: TOWRITE :type `pattern`: EmbPattern :param `objPos`: TOWRITE :type `objPos`: `QPointF`_ :param `objPath`: TOWRITE :type `objPath`: `QPainterPath`_ :param `layer`: TOWRITE :type `layer`: QString :param `color`: TOWRITE :type `color`: `QColor`_ :param `lineType`: TOWRITE :type `lineType`: QString :param `lineWeight`: TOWRITE :type `lineWeight`: QString """ startX = objPos.x() # qreal startY = objPos.y() # qreal pointList = 0 # EmbPointList* lastPoint = 0 # EmbPointList* element = QPainterPath.Element for i in range(0, objPath.elementCount() ): # for(int i = 0; i < objPath.elementCount(); ++i) element = objPath.elementAt(i) if not pointList: pointList = lastPoint = embPointList_create( element.x + startX, -(element.y + startY)) else: lastPoint = embPointList_add( lastPoint, embPoint_make(element.x + startX, -(element.y + startY))) polyObject = embPolylineObject_create( pointList, embColor_make(color.red(), color.green(), color.blue()), 1) # EmbPolylineObject* # TODO: proper lineType embPattern_addPolylineObjectAbs(pattern, polyObject)