Numeric Shapes

Hi guys! I make my numeric shapes for drawing in OCC.
Also don't forget thanks If this code help with your working.
For rus: Ñîãëàñíî ÃÎÑÒ 2.304-68

#ifndef ADDTEXT_H
#define ADDTEXT_H

#include
#include "TDF_Label.hxx"
#include "TopoDS_Shape.hxx"

class addtext: public QObject
{
Q_OBJECT

public:
//! 1. Ñîçäàåò òåêñò â óêàçàííîé ïëîñêîñòè è çàãðóæàåò åãî â ìåòêó ñ äðàéâåðîì "Text"
QString mtext(TDF_Label MainLab,const QString text,
const double height,
const double X, const double Y, const double Z,
const double angleXOZ,
const double angleYOZ,
const double angleXOY,
const QString Name,
const int R, const int G, const int B,
const int SelectionMode=0);
//! 2. Âîçâðàùàåò òåëî òåêñòà â óêàçàííîé ïëîñêîñòè, áåç ìåòêè.
void mtext(const QString text,
const double height,
const double X, const double Y, const double Z,
const double angleXOZ,
const double angleYOZ,
const double angleXOY,
TopoDS_Shape &myTextShape);
//! 3. Âîçâðàùàåò äëèíó ñòðîêè. Ñîãëàñíî ÃÎÑÒ 2.304-68
double getLength(const QString text,
const double height);
addtext();
~addtext();
private:
void write0(double &writeCur, const double height,
TopoDS_Shape &myTempShape);
void write1(double &writeCur, const double height,
TopoDS_Shape &myTempShape);
void write2(double &writeCur, const double height,
TopoDS_Shape &myTempShape);
void write3(double &writeCur, const double height,
TopoDS_Shape &myTempShape);
void write4(double &writeCur, const double height,
TopoDS_Shape &myTempShape);
void write5(double &writeCur, const double height,
TopoDS_Shape &myTempShape);
void write6(double &writeCur, const double height,
TopoDS_Shape &myTempShape);
void write7(double &writeCur, const double height,
TopoDS_Shape &myTempShape);
void write8(double &writeCur, const double height,
TopoDS_Shape &myTempShape);
void write9(double &writeCur, const double height,
TopoDS_Shape &myTempShape);
};

#endif // ADDTEXT_H

Attachments: 
JuryS's picture

In my previous message header file. Here my CPP:

#include "addtext.h"
#include "TopoDS_Compound.hxx"
#include "GC_MakeCircle.hxx"
#include "BRep_Builder.hxx"
#include "gp_Pnt.hxx"
#include "gp_Ax1.hxx"
#include "BRepBuilderAPI_Transform.hxx"
#include "BRepBuilderAPI_MakeEdge.hxx"
#include "TDataStd_AsciiString.hxx"
#include "TDataStd_RealArray.hxx"
#include "TDataStd_Real.hxx"
#include "TNaming_Builder.hxx"
#include "TPrsStd_AISPresentation.hxx"
#include "TNaming_NamedShape.hxx"
#include "Quantity_Color.hxx"

//! 1. Ñîçäàåò òåêñò â óêàçàííîé òî÷êå, âðàùàåò åãî è çàãðóæàåò åãî â ìåòêó ñ äðàéâåðîì "Text"
QString addtext::mtext(TDF_Label MainLab,const QString text,
const double height,
const double X, const double Y, const double Z, //Òî÷êà óñòàíîâêè òåêñòà
const double angleXOZ, //Óãîë ïîâîðîòà íà âèäå ñïðàâà
const double angleYOZ, //Óãîë ïîâîðîòà íà âèäå ñëåâà
const double angleXOY,
const QString Name,
const int R, const int G, const int B,
const int SelectionMode)
{
TopoDS_Shape myTextShape;
double resultWidth = getLength(text,height);
mtext(text,height,X,Y,Z,angleXOZ,angleYOZ,angleXOY,myTextShape);
if (myTextShape.IsNull()) return trUtf8("Îøèáêà ïðè ñîçäàíèè òåêñòà - íóëåâîå òåëî òåêñòà.");

//! Ñîçäàþ èíòåðàêòèâíûé îáúåêò ñ àòðèáóòàìè:
// Text Label - ñîçäàííàÿ ìåòêà
// Ïðèñâàèâàþ àòðèáóòû â ñëåäóþùåì ïîðÿäêå:
// 0 -- òèï îáúåêòà (óíèêàëüíûé êîä äëÿ ëþáîãî îáúåêòà)
// 0:0 -- ÎÏÈÑÀÍÈÅ (èìÿ)
// 0:1 -- öâåò òåëà
// 1 -- ÃÅÎÌÅÒÐÈß
// 1:0 -- ÎÏÈÑÀÍÈÅ
// 1:1 -- øèðèíà òåêñòà
// 1:2 -- âûñîòà òåêñòà
// 1:3 -- ñîäåðæàíèå
// 1:4 -- X
// 1:5 -- Y
// 1:6 -- Z
// 1:7 -- angleXOZ
// 1:8 -- angleYOZ
// 1:9 -- angleXOY

// Íîâàÿ ìåòêà â ñòðóêòóðå
TDF_Label L = TDF_TagSource::NewChild(MainLab);

// Òèï îáúåêòà - ïðèìèòèâ
TDataStd_AsciiString::Set(L, "Text");

//Èìÿ, öâåòà, ìàòåðèàëû...
TDF_Label level0 = L.FindChild(0,Standard_True);
TDataStd_AsciiString::Set(level0.FindChild(0), Name.toAscii().data()); //èìÿ

Handle_TDataStd_RealArray anArray = new TDataStd_RealArray();
anArray->Init( 1,3 );

anArray->SetValue( 1, R );
anArray->SetValue( 2, G );
anArray->SetValue( 3, B );
Handle_TDataStd_RealArray anAttr =
TDataStd_RealArray::Set(level0.FindChild(1), anArray->Lower(), anArray->Upper()); //öâåò
anAttr->ChangeArray(anArray->Array());

TDF_Label level1 = L.FindChild(1,Standard_True);
TDataStd_Real::Set(level1.FindChild(1), resultWidth); //øèðèíà òåêñòà
TDataStd_Real::Set(level1.FindChild(2), height); //âûñîòà òåêñòà
TDataStd_AsciiString::Set(level1.FindChild(3), text.toAscii().data()); //ñîäåðæàíèå òåêñòà
TDataStd_Real::Set(level1.FindChild(4), X);
TDataStd_Real::Set(level1.FindChild(5), Y);
TDataStd_Real::Set(level1.FindChild(6), Z);
TDataStd_Real::Set(level1.FindChild(7), angleXOZ);
TDataStd_Real::Set(level1.FindChild(8), angleYOZ);
TDataStd_Real::Set(level1.FindChild(8), angleXOY);

TNaming_Builder Build(L);
Build.Generated(myTextShape);

//Äîáàâëÿþ åãî â äîêóìåíò
Handle_TPrsStd_AISPresentation prs = TPrsStd_AISPresentation::Set(L,TNaming_NamedShape::GetID());

Quantity_Color color( R / 255., G / 255.,
B / 255., Quantity_TOC_RGB );

prs->SetColor(color.Name());
prs->SetSelectionMode(SelectionMode);
prs->Display(1);
return trUtf8("Ñîçäàíà íàäïèñü ñîãëàñíî ÃÎÑÒ 2.304-68.");
}

//! 2. Âîçâðàùàåò òåëî òåêñòà â óêàçàííîé ïëîñêîñòè, áåç ìåòêè.
void addtext::mtext(const QString text,
const double height,
const double X, const double Y, const double Z,
const double angleXOZ,
const double angleYOZ,
const double angleXOY,
TopoDS_Shape &myTextShape)
{
gp_Trsf trsf;
QString myTemp;
double writeCur = 0; //Øèðèíà êîíêðåòíîãî ñèìâîëà
TopoDS_Shape myTempShape;
TopoDS_Compound comp;
BRep_Builder builder;
builder.MakeCompound( comp );

for (int i = 0; i < text.size(); ++i)
{
myTempShape.Nullify();
myTemp = text.at(i);
if (myTemp == "0") write0(writeCur,height,myTempShape);
if (myTemp == "1") write1(writeCur,height,myTempShape);
if (myTemp == "2") write2(writeCur,height,myTempShape);
if (myTemp == "3") write3(writeCur,height,myTempShape);
if (myTemp == "4") write4(writeCur,height,myTempShape);
if (myTemp == "5") write5(writeCur,height,myTempShape);
if (myTemp == "6") write6(writeCur,height,myTempShape);
if (myTemp == "7") write7(writeCur,height,myTempShape);
if (myTemp == "8") write8(writeCur,height,myTempShape);
if (myTemp == "9") write9(writeCur,height,myTempShape);
if (myTemp == " ") writeCur += 4*height/7;
if (!myTempShape.IsNull()) builder.Add( comp, myTempShape );
}
myTextShape = comp;

gp_Pnt P1(0,0,0);
if (angleXOZ!=0)
{
gp_Pnt P2(0,1,0);
gp_Vec Vec(P1, P2);
gp_Dir Dir(Vec);
gp_Ax1 Ax( P1, Dir );

trsf.SetRotation(Ax,angleXOZ*PI/180);
BRepBuilderAPI_Transform myTrsfXOZ(myTextShape,trsf,Standard_False);
myTextShape = myTrsfXOZ.Shape();
}

if (angleYOZ!=0)
{
gp_Pnt P2(1,0,0);
gp_Vec Vec(P1, P2);
gp_Dir Dir(Vec);
gp_Ax1 Ax( P1, Dir );

trsf.SetRotation(Ax,angleYOZ*PI/180);
BRepBuilderAPI_Transform myTrsfYOZ(myTextShape,trsf,Standard_False);
myTextShape = myTrsfYOZ.Shape();
}

if (angleXOY!=0)
{
gp_Pnt P2(0,0,1);
gp_Vec Vec(P1, P2);
gp_Dir Dir(Vec);
gp_Ax1 Ax( P1, Dir );

trsf.SetRotation(Ax,angleXOY*PI/180);
BRepBuilderAPI_Transform myTrsfXOY(myTextShape,trsf,Standard_False);
myTextShape = myTrsfXOY.Shape();
}

if ((X!=0)&&(Y!=0)&&(Z!=0))
{
trsf.SetTranslation(P1,gp_Pnt(X,Y,Z));
BRepBuilderAPI_Transform myTrsfTransl(myTextShape,trsf,Standard_False);
myTextShape = myTrsfTransl.Shape();
}

}

void addtext::write0(double &writeCur, const double height,
TopoDS_Shape &myTempShape)
{
TopoDS_Compound comp;
BRep_Builder builder;
builder.MakeCompound( comp );

gp_Pnt P0(0,writeCur+height/2.44,0); //êîíåö ïðàâîé íèæ äóãè
gp_Pnt P1(0,writeCur+height/6.25,0);
gp_Pnt P2(0,writeCur+height/16.67,height/14.29);
gp_Pnt P3(0,writeCur+height/20,height/5.56);
gp_Pnt P4(0,writeCur+height/4.55,height/1.22); //è äàëåå ïî ÷àñîâîé ñòðåëêå
gp_Pnt P5(0,writeCur+height/3.57,height/1.06);
gp_Pnt P6(0,writeCur+height/2.38,height);
gp_Pnt P7(0,writeCur+height/1.49,height);
gp_Pnt P8(0,writeCur+height/1.28,height/1.1);
gp_Pnt P9(0,writeCur+height/1.28,height/1.25);
gp_Pnt P10(0,writeCur+height/1.64,height/6.25);
gp_Pnt P11(0,writeCur+height/1.79,height/16.67);

TopoDS_Shape L1 = BRepBuilderAPI_MakeEdge(P0,P1).Shape();
builder.Add(comp, L1);

GC_MakeCircle circ1(P1,P2,P3);
BRepBuilderAPI_MakeEdge arc1(circ1, P1, P3);
builder.Add(comp, arc1.Shape());

TopoDS_Shape L2 = BRepBuilderAPI_MakeEdge(P3,P4).Shape();
builder.Add(comp, L2);

GC_MakeCircle circ2(P4,P5,P6);
BRepBuilderAPI_MakeEdge arc2(circ2, P4, P6);
builder.Add(comp, arc2.Shape());

TopoDS_Shape L3 = BRepBuilderAPI_MakeEdge(P6,P7).Shape();
builder.Add(comp, L3);

GC_MakeCircle circ3(P7,P8,P9);
BRepBuilderAPI_MakeEdge arc3(circ3, P7, P9);
builder.Add(comp, arc3.Shape());

TopoDS_Shape L4 = BRepBuilderAPI_MakeEdge(P9,P10).Shape();
builder.Add(comp, L4);

GC_MakeCircle circ4(P10,P11,P0);
BRepBuilderAPI_MakeEdge arc4(circ4, P10, P0);
builder.Add(comp, arc4.Shape());

myTempShape = comp;
writeCur+=6*height/7;
}

void addtext::write1(double &writeCur, const double height,
TopoDS_Shape &myTempShape)
{
double myWidth = 4*height/7;
TopoDS_Compound comp;
BRep_Builder builder;
builder.MakeCompound( comp );

gp_Pnt P0(0,writeCur+height/5.22,height/1.4); //êëþâèê
gp_Pnt P1(0,writeCur+myWidth,height); //ïðàâàÿ âåðõíÿÿ òî÷êà
gp_Pnt P2(0,writeCur+height/3.5,0); //íèæíÿÿ òî÷êà

TopoDS_Shape LineTop = BRepBuilderAPI_MakeEdge(P0,P1).Shape();
TopoDS_Shape LineBottom = BRepBuilderAPI_MakeEdge(P1,P2).Shape();
builder.Add(comp, LineTop);
builder.Add(comp, LineBottom);

myTempShape = comp;
writeCur+=myWidth;
}

void addtext::write2(double &writeCur, const double height,
TopoDS_Shape &myTempShape)
{
TopoDS_Compound comp;
BRep_Builder builder;
builder.MakeCompound( comp );

gp_Pnt P0(0,writeCur+height/3.81,height/1.4); //íà÷íó ñ âåðõà
gp_Pnt P1(0,writeCur+height/1.87,height);
gp_Pnt P2(0,writeCur+height/1.33,height/1.11);
gp_Pnt P3(0,writeCur+height/1.33,height/1.45);
gp_Pnt P4(0,writeCur+height/1.54,height/1.92);
gp_Pnt P5(0,writeCur,0);
gp_Pnt P6(0,writeCur+4*height/7,0);

GC_MakeCircle circ1(P0,P1,P2);
BRepBuilderAPI_MakeEdge arc1(circ1, P0, P2);
builder.Add(comp, arc1.Shape());

GC_MakeCircle circ2(P2,P3,P4);
BRepBuilderAPI_MakeEdge arc2(circ2, P2, P4);
builder.Add(comp, arc2.Shape());

TopoDS_Shape L1 = BRepBuilderAPI_MakeEdge(P4,P5).Shape();
TopoDS_Shape L2 = BRepBuilderAPI_MakeEdge(P5,P6).Shape();
builder.Add(comp, L1);
builder.Add(comp, L2);

myTempShape = comp;
writeCur+=6*height/7;
}

void addtext::write3(double &writeCur, const double height,
TopoDS_Shape &myTempShape)
{
TopoDS_Compound comp;
BRep_Builder builder;
builder.MakeCompound( comp );

gp_Pnt P0(0,writeCur+height/2.95,height); //íà÷íó ñ âåðõà
gp_Pnt P1(0,writeCur+height/1.3,height);
gp_Pnt P2(0,writeCur+height/3.38,height/1.75);
gp_Pnt P3(0,writeCur+height/1.66,height/2.14);
gp_Pnt P4(0,writeCur+height/1.54,height/3.52);
gp_Pnt P5(0,writeCur+height/2.84,0);
gp_Pnt P6(0,writeCur+height/17.44,height/4.67);

TopoDS_Shape L1 = BRepBuilderAPI_MakeEdge(P0,P1).Shape();
builder.Add(comp, L1);

TopoDS_Shape L2 = BRepBuilderAPI_MakeEdge(P1,P2).Shape();
builder.Add(comp, L2);

GC_MakeCircle circ1(P2,P3,P4);
BRepBuilderAPI_MakeEdge arc1(circ1, P2, P4);
builder.Add(comp, arc1.Shape());

GC_MakeCircle circ2(P4,P5,P6);
BRepBuilderAPI_MakeEdge arc2(circ2, P4, P6);
builder.Add(comp, arc2.Shape());

myTempShape = comp;
writeCur+=6*height/7;
}

void addtext::write4(double &writeCur, const double height,
TopoDS_Shape &myTempShape)
{
TopoDS_Compound comp;
BRep_Builder builder;
builder.MakeCompound( comp );

gp_Pnt P0(0,writeCur+height/1.61,height); //íà÷íó ñ âåðõà
gp_Pnt P1(0,writeCur+height/13.07,height/3.5);
gp_Pnt P2(0,writeCur+height/1.39,height/3.5);
gp_Pnt P3(0,writeCur+height/1.31,height/1.4);
gp_Pnt P4(0,writeCur+height/1.75,0);

TopoDS_Shape L1 = BRepBuilderAPI_MakeEdge(P0,P1).Shape();
builder.Add(comp, L1);

TopoDS_Shape L2 = BRepBuilderAPI_MakeEdge(P1,P2).Shape();
builder.Add(comp, L2);

TopoDS_Shape L3 = BRepBuilderAPI_MakeEdge(P3,P4).Shape();
builder.Add(comp, L3);

myTempShape = comp;
writeCur+=6*height/7;
}

void addtext::write5(double &writeCur, const double height,
TopoDS_Shape &myTempShape)
{
TopoDS_Compound comp;
BRep_Builder builder;
builder.MakeCompound( comp );

gp_Pnt P0(0,writeCur+height/1.35,height); //íà÷íó ñ ïðàâîãî âåðõíåãî óãëà
gp_Pnt P1(0,writeCur+height/2.95,height);
gp_Pnt P2(0,writeCur+height/4.87,height/2);
gp_Pnt P3(0,writeCur+height/2.51,height/1.71);
gp_Pnt P4(0,writeCur+height/1.52,height/3.18);
gp_Pnt P5(0,writeCur+height/1.63,height/6.38);
gp_Pnt P6(0,writeCur+height/2.76,0);
gp_Pnt P7(0,writeCur+height/17.44,height/4.67);

TopoDS_Shape L1 = BRepBuilderAPI_MakeEdge(P0,P1).Shape();
TopoDS_Shape L2 = BRepBuilderAPI_MakeEdge(P1,P2).Shape();
builder.Add(comp, L1);
builder.Add(comp, L2);

GC_MakeCircle circ1(P2,P3,P4);
BRepBuilderAPI_MakeEdge arc1(circ1, P2, P4);
builder.Add(comp, arc1.Shape());

TopoDS_Shape L3 = BRepBuilderAPI_MakeEdge(P4,P5).Shape();
builder.Add(comp, L3);

GC_MakeCircle circ2(P5,P6,P7);
BRepBuilderAPI_MakeEdge arc2(circ2, P5, P7);
builder.Add(comp, arc2.Shape());

myTempShape = comp;
writeCur+=6*height/7;
}

void addtext::write6(double &writeCur, const double height,
TopoDS_Shape &myTempShape)
{
TopoDS_Compound comp;
BRep_Builder builder;
builder.MakeCompound( comp );

gp_Pnt P0(0,writeCur+height/1.44,height); //íà÷íó ñ ïðàâîãî âåðõíåãî óãëà
gp_Pnt P1(0,writeCur+height/1.94,height);
gp_Pnt P2(0,writeCur+height/3.15,height/1.06);
gp_Pnt P3(0,writeCur+height/4.68,height/1.25);
gp_Pnt P4(0,writeCur+height/14.45,height/3.47);
gp_Pnt P5(0,writeCur+height/11.12,height/12.6);
gp_Pnt P6(0,writeCur+height/4.03,0);
gp_Pnt P7(0,writeCur+height/2.8,0);
gp_Pnt P8(0,writeCur+height/1.87,height/17.34);
gp_Pnt P9(0,writeCur+height/1.58,height/4.36);
gp_Pnt P10(0,writeCur+height/1.48,height/2.57);
gp_Pnt P11(0,writeCur+height/1.52,height/1.82);
gp_Pnt P12(0,writeCur+height/1.98,height/1.56);
gp_Pnt P13(0,writeCur+height/3.08,height/1.56);
gp_Pnt P14(0,writeCur+height/5.01,height/1.65);
gp_Pnt P15(0,writeCur+height/7,height/1.85);

TopoDS_Shape L1 = BRepBuilderAPI_MakeEdge(P0,P1).Shape();
builder.Add(comp, L1);

GC_MakeCircle circ1(P1,P2,P3);
BRepBuilderAPI_MakeEdge arc1(circ1, P1, P3);
builder.Add(comp, arc1.Shape());

TopoDS_Shape L2 = BRepBuilderAPI_MakeEdge(P3,P4).Shape();
builder.Add(comp, L2);

GC_MakeCircle circ2(P4,P5,P6);
BRepBuilderAPI_MakeEdge arc2(circ2, P4, P6);
builder.Add(comp, arc2.Shape());

TopoDS_Shape L3 = BRepBuilderAPI_MakeEdge(P6,P7).Shape();
builder.Add(comp, L3);

GC_MakeCircle circ3(P7,P8,P9);
BRepBuilderAPI_MakeEdge arc3(circ3, P7, P9);
builder.Add(comp, arc3.Shape());

TopoDS_Shape L4 = BRepBuilderAPI_MakeEdge(P9,P10).Shape();
builder.Add(comp, L4);

GC_MakeCircle circ4(P10,P11,P12);
BRepBuilderAPI_MakeEdge arc4(circ4, P10, P12);
builder.Add(comp, arc4.Shape());

TopoDS_Shape L5 = BRepBuilderAPI_MakeEdge(P12,P13).Shape();
builder.Add(comp, L5);

GC_MakeCircle circ5(P13,P14,P15);
BRepBuilderAPI_MakeEdge arc5(circ5, P13, P15);
builder.Add(comp, arc5.Shape());

myTempShape = comp;
writeCur+=6*height/7;
}

void addtext::write7(double &writeCur, const double height,
TopoDS_Shape &myTempShape)
{
TopoDS_Compound comp;
BRep_Builder builder;
builder.MakeCompound( comp );

gp_Pnt P0(0,writeCur+height/5.22,height/1.4);
gp_Pnt P1(0,writeCur+height/3.73,height);
gp_Pnt P2(0,writeCur+height/1.19,height);
gp_Pnt P3(0,writeCur+height/3.5,0);

TopoDS_Shape L1 = BRepBuilderAPI_MakeEdge(P0,P1).Shape();
TopoDS_Shape L2 = BRepBuilderAPI_MakeEdge(P1,P2).Shape();
TopoDS_Shape L3 = BRepBuilderAPI_MakeEdge(P2,P3).Shape();
builder.Add(comp, L1);
builder.Add(comp, L2);
builder.Add(comp, L3);

myTempShape = comp;
writeCur+=6*height/7;
}

void addtext::write8(double &writeCur, const double height,
TopoDS_Shape &myTempShape)
{
TopoDS_Compound comp;
BRep_Builder builder;
builder.MakeCompound( comp );
//Âåðõíèé ðîìá
gp_Pnt P0(0,writeCur+height/1.62,height);
gp_Pnt P1(0,writeCur+height/2.12,height);
gp_Pnt P2(0,writeCur+height/2.7,height/1.035);
gp_Pnt P3(0,writeCur+height/3.35,height/1.18);
gp_Pnt P4(0,writeCur+height/3.71,height/1.35);
gp_Pnt P5(0,writeCur+height/3.59,height/1.61);
gp_Pnt P6(0,writeCur+height/2.72,height/1.75); //Öåíòð ëåâ
gp_Pnt P7(0,writeCur+height/1.92,height/1.75); //Öåíòð ïðàâ
gp_Pnt P8(0,writeCur+height/1.6,height/1.65);
gp_Pnt P9(0,writeCur+height/1.44,height/1.37);
gp_Pnt P10(0,writeCur+height/1.39,height/1.21);
gp_Pnt P11(0,writeCur+height/1.415,height/1.047);
//Íèæíèé ðîìá
gp_Pnt P12(0,writeCur+height/5.29,height/2.01);
gp_Pnt P13(0,writeCur+height/10.43,height/2.79);
gp_Pnt P14(0,writeCur+height/17.99,height/4.82);
gp_Pnt P15(0,writeCur+height/13.81,height/13.86);
gp_Pnt P16(0,writeCur+height/5.19,0);
gp_Pnt P17(0,writeCur+height/2.83,0);
gp_Pnt P18(0,writeCur+height/1.86,height/17.42);
gp_Pnt P19(0,writeCur+height/1.6,height/4.96);
gp_Pnt P20(0,writeCur+height/1.53,height/3.3);
gp_Pnt P21(0,writeCur+height/1.56,height/2.11);

TopoDS_Shape L1 = BRepBuilderAPI_MakeEdge(P0,P1).Shape();
builder.Add(comp, L1);

GC_MakeCircle circ1(P1,P2,P3);
BRepBuilderAPI_MakeEdge arc1(circ1, P1, P3);
builder.Add(comp, arc1.Shape());

TopoDS_Shape L2 = BRepBuilderAPI_MakeEdge(P3,P4).Shape();
builder.Add(comp, L2);

GC_MakeCircle circ2(P4,P5,P6);
BRepBuilderAPI_MakeEdge arc2(circ2, P4, P6);
builder.Add(comp, arc2.Shape());

TopoDS_Shape L3 = BRepBuilderAPI_MakeEdge(P6,P7).Shape();
builder.Add(comp, L3);

GC_MakeCircle circ3(P7,P8,P9);
BRepBuilderAPI_MakeEdge arc3(circ3, P7, P9);
builder.Add(comp, arc3.Shape());

TopoDS_Shape L4 = BRepBuilderAPI_MakeEdge(P9,P10).Shape();
builder.Add(comp, L4);

GC_MakeCircle circ4(P10,P11,P0);
BRepBuilderAPI_MakeEdge arc4(circ4, P10, P0);
builder.Add(comp, arc4.Shape());

GC_MakeCircle circ5(P6,P12,P13);
BRepBuilderAPI_MakeEdge arc5(circ5, P6, P13);
builder.Add(comp, arc5.Shape());

TopoDS_Shape L5 = BRepBuilderAPI_MakeEdge(P13,P14).Shape();
builder.Add(comp, L5);

GC_MakeCircle circ6(P14,P15,P16);
BRepBuilderAPI_MakeEdge arc6(circ6, P14, P16);
builder.Add(comp, arc6.Shape());

TopoDS_Shape L6 = BRepBuilderAPI_MakeEdge(P16,P17).Shape();
builder.Add(comp, L6);

GC_MakeCircle circ7(P17,P18,P19);
BRepBuilderAPI_MakeEdge arc7(circ7, P17, P19);
builder.Add(comp, arc7.Shape());

TopoDS_Shape L7 = BRepBuilderAPI_MakeEdge(P19,P20).Shape();
builder.Add(comp, L7);

GC_MakeCircle circ8(P20,P21,P7);
BRepBuilderAPI_MakeEdge arc8(circ8, P20, P7);
builder.Add(comp, arc8.Shape());

myTempShape = comp;
writeCur+=6*height/7;
}

void addtext::write9(double &writeCur, const double height,
TopoDS_Shape &myTempShape)
{
TopoDS_Compound comp;
BRep_Builder builder;
builder.MakeCompound( comp );

gp_Pnt P0(0,writeCur+height/7,0); //íà÷íó ñ ëåâîãî íèæíåãî óãëà
gp_Pnt P1(0,writeCur+height/3.09,0);
gp_Pnt P2(0,writeCur+height/1.86,height/14.03);
gp_Pnt P3(0,writeCur+height/1.6,height/4.93);
gp_Pnt P4(0,writeCur+height/1.3,height/1.35);
gp_Pnt P5(0,writeCur+height/1.33,height/1.09);
gp_Pnt P6(0,writeCur+height/1.69,height);
gp_Pnt P7(0,writeCur+height/2.08,height);
gp_Pnt P8(0,writeCur+height/3.34,height/1.065);
gp_Pnt P9(0,writeCur+height/4.86,height/1.3);
gp_Pnt P10(0,writeCur+height/6.13,height/1.64);
gp_Pnt P11(0,writeCur+height/5.46,height/2.27);
gp_Pnt P12(0,writeCur+height/3,height/2.8);
gp_Pnt P13(0,writeCur+height/1.95,height/2.8);
gp_Pnt P14(0,writeCur+height/1.61,height/2.61);
gp_Pnt P15(0,writeCur+height/1.44,height/2.18);

TopoDS_Shape L1 = BRepBuilderAPI_MakeEdge(P0,P1).Shape();
builder.Add(comp, L1);

GC_MakeCircle circ1(P1,P2,P3);
BRepBuilderAPI_MakeEdge arc1(circ1, P1, P3);
builder.Add(comp, arc1.Shape());

TopoDS_Shape L2 = BRepBuilderAPI_MakeEdge(P3,P4).Shape();
builder.Add(comp, L2);

GC_MakeCircle circ2(P4,P5,P6);
BRepBuilderAPI_MakeEdge arc2(circ2, P4, P6);
builder.Add(comp, arc2.Shape());

TopoDS_Shape L3 = BRepBuilderAPI_MakeEdge(P6,P7).Shape();
builder.Add(comp, L3);

GC_MakeCircle circ3(P7,P8,P9);
BRepBuilderAPI_MakeEdge arc3(circ3, P7, P9);
builder.Add(comp, arc3.Shape());

TopoDS_Shape L4 = BRepBuilderAPI_MakeEdge(P9,P10).Shape();
builder.Add(comp, L4);

GC_MakeCircle circ4(P10,P11,P12);
BRepBuilderAPI_MakeEdge arc4(circ4, P10, P12);
builder.Add(comp, arc4.Shape());

TopoDS_Shape L5 = BRepBuilderAPI_MakeEdge(P12,P13).Shape();
builder.Add(comp, L5);

GC_MakeCircle circ5(P13,P14,P15);
BRepBuilderAPI_MakeEdge arc5(circ5, P13, P15);
builder.Add(comp, arc5.Shape());

myTempShape = comp;
writeCur+=6*height/7;
}

//! 3. Âîçâðàùàåò äëèíó ñòðîêè. Ñîãëàñíî ÃÎÑÒ 2.304-68
double addtext::getLength(const QString text, const double height)
{
QString current;
double resultWidth = 0;
//Âû÷èñëÿþ äëèíó íàäïèñè.
for (int i = 0; i < text.size(); ++i)
{
current = text.at(i);
if (current == " ") resultWidth += 4*height/7;
if (current == "1") resultWidth += 4*height/7;

if ((current == "2")||(current == "3")||(current == "4")||
(current == "5")||(current == "6")||(current == "7")||
(current == "8")||(current == "9")||(current == "0"))
resultWidth += 6*height/7;
}
return resultWidth;
}

addtext::addtext()
{
}

addtext::~addtext()
{
}