[qet] [3374] dxfTOelmt updated acad ellipse, function not ready for the moment

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 3374
Author:   rdsivd
Date:     2014-10-12 22:14:30 +0200 (Sun, 12 Oct 2014)
Log Message:
-----------
dxfTOelmt updated acad ellipse, function not ready for the moment

Modified Paths:
--------------
    branches/dxftoelmt/src/ui/dxf_attdef.cpp
    branches/dxftoelmt/src/ui/dxf_attrib.cpp
    branches/dxftoelmt/src/ui/dxf_ellipse.cpp
    branches/dxftoelmt/src/ui/dxf_insert.cpp
    branches/dxftoelmt/src/ui/dxf_mtext.cpp
    branches/dxftoelmt/src/ui/dxf_mtext.h
    branches/dxftoelmt/src/ui/dxf_text.cpp
    branches/dxftoelmt/src/ui/dxftoelmt.cpp
    branches/dxftoelmt/src/ui/dxftoelmt.h

Modified: branches/dxftoelmt/src/ui/dxf_attdef.cpp
===================================================================
--- branches/dxftoelmt/src/ui/dxf_attdef.cpp	2014-10-12 10:28:36 UTC (rev 3373)
+++ branches/dxftoelmt/src/ui/dxf_attdef.cpp	2014-10-12 20:14:30 UTC (rev 3374)
@@ -11,8 +11,13 @@
 void DXF_Attdef::ConvertAttdef(int Counter, int BlockCount, int Entitieswitch, struct _ReadLineDXF  LineTable4[], struct _LType_ACAD LTypeDXF[], struct _Layer_ACAD  LayerDXF[], struct _Block_ACAD BlockList[])
 {
 
+	attrotation=0;
+	attx=0;
+	atty=0;
+	attheight=1;
+	atttext="";
+	atttag="";
 
-
 	for (x=0;x<Counter;x++)
 	{
 		if (LineTable4[x].Line1.contains(" 10", Qt::CaseSensitive) )
@@ -64,6 +69,7 @@
 	xattext=QString::number(attx+0.5,'f',0);
 	yattext=QString::number(atty+0.5,'f',0);
 	hattext=QString::number(attheight,'f',0);
+	rattext=QString::number(attrotation,'f',0);
 
 
 	Lineout="   ";

Modified: branches/dxftoelmt/src/ui/dxf_attrib.cpp
===================================================================
--- branches/dxftoelmt/src/ui/dxf_attrib.cpp	2014-10-12 10:28:36 UTC (rev 3373)
+++ branches/dxftoelmt/src/ui/dxf_attrib.cpp	2014-10-12 20:14:30 UTC (rev 3374)
@@ -7,6 +7,12 @@
 
 void DXF_Attrib::ConvertAttrib(int Counter, int BlockCount, int Entitieswitch, struct _ReadLineDXF  LineTable4[], struct _LType_ACAD LTypeDXF[], struct _Layer_ACAD  LayerDXF[], struct _Block_ACAD BlockList[])
 {
+	attx=0;
+	atty=0;
+	attheight=1;
+	attrotation=0;
+	atttext="";
+	atttag="";
 
 
 
@@ -61,6 +67,7 @@
     xattext=QString::number(attx+0.5,'f',0);
     yattext=QString::number(atty+0.5,'f',0);
 	hattext=QString::number(attheight,'f',0);
+	rattext=QString::number(attrotation,'f',0);
 
 
     Lineout="   ";

Modified: branches/dxftoelmt/src/ui/dxf_ellipse.cpp
===================================================================
--- branches/dxftoelmt/src/ui/dxf_ellipse.cpp	2014-10-12 10:28:36 UTC (rev 3373)
+++ branches/dxftoelmt/src/ui/dxf_ellipse.cpp	2014-10-12 20:14:30 UTC (rev 3374)
@@ -65,7 +65,24 @@
 	double Pstart;
 	double Pend2;
 
+	a=0;
+	b=0;
+	i=0;
+	j=0;
+	Pstart=0;
+	Pend2=0;
+	hoek2=0;
 
+	center_x=0;
+	center_y=0;
+	major_radius_x=0;
+	major_radius_y=0;
+	ratio_of_minor=0;
+	end2=0;
+	start=0;
+
+
+
 	for (x=0;x<Counter;x++)
 	{
 		if (LineTable4[x].Line1.contains(" 10", Qt::CaseSensitive) )
@@ -132,12 +149,13 @@
 
 	i=1;
 	j=0.1;
+	Pstart=0;
+	Pend2=0;
 
-	Pstart=((center_x+a)*acos(start))*i+((center_y+b)*asin(start))*j;
+	Pstart=center_x+a*acos(start)*i+center_y+b*asin(start)*j;
 
-	Pend2=((center_x+a)*acos(end2))*i+((center_y+b)*asin(end2))*j;
+	Pend2=center_x+a*acos(end2)*i+center_y+b*asin(end2)*j;
 
-
 	begin=Pstart;
 	hoek=-Pend2;
 
@@ -265,9 +283,32 @@
 	BeginHoek=QString::number ((begin ),'f',0);
 	Hoek2=QString::number ((hoek),'f',0);
 
+	if(BeginHoek=="nan")
+	{
+		BeginHoek="0";
+	}
+	if(Hoek2=="nan")
+	{
+		Hoek2="0";
+	}
+	if(x_center=="nan")
+	{
+		x_center="0";
+	}
+	if(y_center=="nan")
+	{
+		y_center="0";
+	}
+	if(hoogte=="nan")
+	{
+		hoogte="0";
+	}
+	if(breedte=="nan")
+	{
+		breedte="0";
+	}
 
 
-
 	Lineout="   ";
 	Lineout.append("   ");
 	Lineout.append("   ");

Modified: branches/dxftoelmt/src/ui/dxf_insert.cpp
===================================================================
--- branches/dxftoelmt/src/ui/dxf_insert.cpp	2014-10-12 10:28:36 UTC (rev 3373)
+++ branches/dxftoelmt/src/ui/dxf_insert.cpp	2014-10-12 20:14:30 UTC (rev 3374)
@@ -13,9 +13,11 @@
 	QString x_center;
 	QString y_center;
 	QString part_name;
+	QString rotation1;
 
 	double center_x;
 	double center_y;
+	double rotation;
 
 
 	for (x=0;x<Counter;x++)
@@ -34,13 +36,17 @@
 		{
 			part_name=LineTable4[x].Line2;
 		}
+		if (LineTable4[x].Line1.contains(" 50", Qt::CaseSensitive))
+		{
+			rotation=LineTable4[x].Line2.toDouble();
+		}
 
 
-
 	}
 
 	x_center=QString::number ((center_x ),'f',2);
 	y_center=QString::number ((center_y ),'f',2);
+	rotation1=QString::number ((rotation),'f',0);
 
 	Lineout="   ";
 	Lineout.append("   ");
@@ -62,6 +68,11 @@
 	Lineout.append(part_name);
 	Lineout.append(QChar(34));
 
+	Lineout.append(" rotation=");
+	Lineout.append(QChar(34));
+	Lineout.append(rotation1);
+	Lineout.append(QChar(34));
+
 	Lineout.append(" />");
 	Lineout.append('\n');
 

Modified: branches/dxftoelmt/src/ui/dxf_mtext.cpp
===================================================================
--- branches/dxftoelmt/src/ui/dxf_mtext.cpp	2014-10-12 10:28:36 UTC (rev 3373)
+++ branches/dxftoelmt/src/ui/dxf_mtext.cpp	2014-10-12 20:14:30 UTC (rev 3374)
@@ -3,3 +3,109 @@
 DXF_Mtext::DXF_Mtext()
 {
 }
+
+void DXF_Mtext::ConvertMtext (int Counter, int BlockCount, int Entitieswitch, struct _ReadLineDXF  LineTable4[], struct _LType_ACAD LTypeDXF[], struct _Layer_ACAD  LayerDXF[], struct _Block_ACAD BlockList[])
+{
+
+		int x;
+
+
+	for (x=0;x<Counter;x++)
+	{
+		if (LineTable4[x].Line1.contains(" 10", Qt::CaseSensitive) )
+	   {
+			tx=LineTable4[x].Line2.toDouble();
+		}
+
+		if (LineTable4[x].Line1.contains(" 20", Qt::CaseSensitive))
+		{
+			ty=-(LineTable4[x].Line2.toDouble());
+		}
+
+		if (LineTable4[x].Line1.contains(" 40", Qt::CaseSensitive))
+		{
+			theight=LineTable4[x].Line2.toDouble();
+		}
+
+
+		if (LineTable4[x].Line1.contains(" 50", Qt::CaseSensitive))
+		{
+			trotation=LineTable4[x].Line2.toDouble();
+		}
+
+
+		if (LineTable4[x].Line1.contains("  1", Qt::CaseSensitive))
+		{
+			ttext=LineTable4[x].Line2;
+		}
+
+
+	}
+
+
+	dxf_check_string_chars CheckText1;
+
+	CheckText1.TextToCheck=ttext;
+
+	ttext=CheckText1.CheckText();
+
+	/* <text x="-29" y="-8" size="9" rotation="270" text="Test"/> */
+
+
+	xtext=QString::number(tx+0.5,'f',0);
+	ytext=QString::number(ty+0.5,'f',0);
+	htext=QString::number(theight,'f',0);
+	rtext=QString::number(trotation,'f',0);
+
+	/* create qet elmt code */
+
+	Lineout=("   ");
+	Lineout.append("   ");
+	Lineout.append("   ");
+	Lineout.append("<text x=");
+	Lineout.append(QChar(34));
+	Lineout.append(xtext);
+	Lineout.append(QChar(34));
+
+	Lineout.append(" y=");
+	Lineout.append(QChar(34));
+	Lineout.append(ytext);
+	Lineout.append(QChar(34));
+
+	Lineout.append(" size=");
+	Lineout.append(QChar(34));
+	Lineout.append(htext);
+	Lineout.append(QChar(34));
+
+	Lineout.append(" rotation=");
+	Lineout.append(QChar(34));
+	Lineout.append(rtext);
+	Lineout.append(QChar(34));
+
+	//ttext = ControlText (ttext);
+
+	Lineout.append(" text=");
+	Lineout.append(QChar(34));
+	Lineout.append(ttext);
+	Lineout.append(QChar(34));
+
+	Lineout.append(" />");
+	Lineout.append('\n');
+
+
+
+
+
+	if (Entitieswitch==1)
+	{
+		BlockList[0].BlockDef.append(Lineout);
+
+	}
+	if (Entitieswitch==0)
+	{
+
+		BlockList[BlockCount].BlockDef.append(Lineout);
+	}
+
+	return ;
+}

Modified: branches/dxftoelmt/src/ui/dxf_mtext.h
===================================================================
--- branches/dxftoelmt/src/ui/dxf_mtext.h	2014-10-12 10:28:36 UTC (rev 3373)
+++ branches/dxftoelmt/src/ui/dxf_mtext.h	2014-10-12 20:14:30 UTC (rev 3374)
@@ -3,11 +3,30 @@
 
 #include <QtCore>
 #include <dxf_data.h>
+#include "dxf_check_string_chars.h"
 
 class DXF_Mtext: public DXF_Data
 {
 	public:
+
+	int LTypeCount1;
+	int LayerCount1;
+
+	QString ttext;
+	QString xtext; // x-coord
+	QString ytext; // y-coord
+	QString htext; // height
+	QString rtext; // rotation
+
+	double tx;
+	double ty;
+	double theight;
+	double trotation;
+	double tscale;
+
 	DXF_Mtext();
+
+	void ConvertMtext(int Counter, int BlockCount, int Entitieswitch, struct _ReadLineDXF LineTable4[2000], struct _LType_ACAD LTypeDXF[200], struct _Layer_ACAD LayerDXF[200],struct _Block_ACAD BlockList[2000]);
 };
 
 #endif // DXF_MTEXT_H

Modified: branches/dxftoelmt/src/ui/dxf_text.cpp
===================================================================
--- branches/dxftoelmt/src/ui/dxf_text.cpp	2014-10-12 10:28:36 UTC (rev 3373)
+++ branches/dxftoelmt/src/ui/dxf_text.cpp	2014-10-12 20:14:30 UTC (rev 3374)
@@ -55,7 +55,7 @@
 	xtext=QString::number(tx+0.5,'f',0);
 	ytext=QString::number(ty+0.5,'f',0);
 	htext=QString::number(theight,'f',0);
-	rtext=QString::number(trotation-90,'f',0);
+	rtext=QString::number(trotation,'f',0);
 
 	/* create qet elmt code */
 

Modified: branches/dxftoelmt/src/ui/dxftoelmt.cpp
===================================================================
--- branches/dxftoelmt/src/ui/dxftoelmt.cpp	2014-10-12 10:28:36 UTC (rev 3373)
+++ branches/dxftoelmt/src/ui/dxftoelmt.cpp	2014-10-12 20:14:30 UTC (rev 3374)
@@ -3018,12 +3018,12 @@
 						Line2=ReadLine;
 						dxfLineCounter=dxfLineCounter+2;
 
-						//LineTable4[LineCount4].Line1=Line1;
-						//LineTable4[LineCount4].Line2=Line2;
-						//LineCount4=LineCount4+1;
+						LineTable4[LineCount4].Line1=Line1;
+						LineTable4[LineCount4].Line2=Line2;
+						LineCount4=LineCount4+1;
 
 
-						//switch10=(Line1.contains(" 0",Qt::CaseSensitive) and 0);
+
 						Control10=Line1.toDouble();
 						if (Control10==0)
 						{
@@ -3039,10 +3039,9 @@
 							Line2=ReadLine;
 							dxfLineCounter=dxfLineCounter+2;
 
-							//LineTable4[LineCount4].Line1=Line1;
-							//LineTable4[LineCount4].Line2=Line2;
-							//LineCount4=LineCount4+1;
-							//switch10=(Line1.contains(" 0",Qt::CaseSensitive)and 0);
+							LineTable4[LineCount4].Line1=Line1;
+							LineTable4[LineCount4].Line2=Line2;
+							LineCount4=LineCount4+1;
 
 							Control10=Line1.toDouble();
 							if (Control10==0)
@@ -3057,6 +3056,18 @@
 
 						}
 
+						DXF_Mtext Load_Mtext;
+
+						Load_Mtext.LayerCount1=LayerCount;
+						Load_Mtext.LTypeCount1=LtypeCount;
+
+
+						Load_Mtext.ConvertMtext(LineCount4, BlockCount, Entitieswitch, LineTable4,LTypeDXF, LayerDXF, BlockList);
+
+						LineCount4=1;
+
+
+
 					}
 
 					Aantal_Tekens = Line2.length();

Modified: branches/dxftoelmt/src/ui/dxftoelmt.h
===================================================================
--- branches/dxftoelmt/src/ui/dxftoelmt.h	2014-10-12 10:28:36 UTC (rev 3373)
+++ branches/dxftoelmt/src/ui/dxftoelmt.h	2014-10-12 20:14:30 UTC (rev 3374)
@@ -27,6 +27,7 @@
 #include "dxf_block.h"
 #include "dxf_insert.h"
 #include "dxf_ellipse.h"
+#include "dxf_mtext.h"
 #include <cmath>
 
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/