[qet] [3347] dxfTOelmt added <insertpart> for inserting acad blocks

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


Revision: 3347
Author:   rdsivd
Date:     2014-10-05 15:08:24 +0200 (Sun, 05 Oct 2014)
Log Message:
-----------
dxfTOelmt added <insertpart> for inserting acad blocks

Modified Paths:
--------------
    branches/dxftoelmt/src/ui/dxf_check_string_chars.cpp
    branches/dxftoelmt/src/ui/dxf_elmt_output.cpp
    branches/dxftoelmt/src/ui/dxf_insert.cpp
    branches/dxftoelmt/src/ui/dxf_insert.h
    branches/dxftoelmt/src/ui/dxftoelmt.cpp
    branches/dxftoelmt/src/ui/dxftoelmt.h

Modified: branches/dxftoelmt/src/ui/dxf_check_string_chars.cpp
===================================================================
--- branches/dxftoelmt/src/ui/dxf_check_string_chars.cpp	2014-10-05 11:26:04 UTC (rev 3346)
+++ branches/dxftoelmt/src/ui/dxf_check_string_chars.cpp	2014-10-05 13:08:24 UTC (rev 3347)
@@ -38,10 +38,10 @@
 		TextToCheck.replace(QChar(92),"-");
 	}
 
-	if(TextToCheck.contains("*"))
+	/*if(TextToCheck.contains("*"))
 	{
 		TextToCheck.replace("*","x");
-	}
+	}*/
 
 	if(TextToCheck.contains("?"))
 	{

Modified: branches/dxftoelmt/src/ui/dxf_elmt_output.cpp
===================================================================
--- branches/dxftoelmt/src/ui/dxf_elmt_output.cpp	2014-10-05 11:26:04 UTC (rev 3346)
+++ branches/dxftoelmt/src/ui/dxf_elmt_output.cpp	2014-10-05 13:08:24 UTC (rev 3347)
@@ -124,10 +124,7 @@
 	Lineout.append("</description>");
 	Lineout.append('\n');
 
-	//Lineout.append("</definition>");
 
-	//Lineout.append('\n');
-
 	return Lineout;
 }
 
@@ -425,8 +422,8 @@
 {
 
 
-	Lineout="";
-	Lineout.append("</parts>");
+
+	Lineout="</parts>";
 	Lineout.append('\n');
 
 

Modified: branches/dxftoelmt/src/ui/dxf_insert.cpp
===================================================================
--- branches/dxftoelmt/src/ui/dxf_insert.cpp	2014-10-05 11:26:04 UTC (rev 3346)
+++ branches/dxftoelmt/src/ui/dxf_insert.cpp	2014-10-05 13:08:24 UTC (rev 3347)
@@ -3,3 +3,83 @@
 DXF_Insert::DXF_Insert()
 {
 }
+
+void DXF_Insert::ConvertInsert(int Counter, int BlockCount, int Entitieswitch, struct _ReadLineDXF  LineTable4[], struct _LType_ACAD LTypeDXF[], struct _Layer_ACAD  LayerDXF[], struct _Block_ACAD BlockList[])
+{
+	int x;
+	int y;
+
+	QString Lineout;
+	QString x_center;
+	QString y_center;
+	QString part_name;
+
+	double center_x;
+	double center_y;
+
+
+	for (x=0;x<Counter;x++)
+	{
+		if (LineTable4[x].Line1.contains(" 10", Qt::CaseSensitive) )
+	   {
+			center_x=LineTable4[x].Line2.toDouble();
+		}
+
+		if (LineTable4[x].Line1.contains(" 20", Qt::CaseSensitive))
+		{
+			center_y=-(LineTable4[x].Line2.toDouble());
+		}
+
+		if (LineTable4[x].Line1.contains("  2", Qt::CaseSensitive))
+		{
+			part_name=LineTable4[x].Line2;
+		}
+
+
+
+	}
+
+	x_center=QString::number ((center_x ),'f',2);
+	y_center=QString::number ((center_y ),'f',2);
+
+	Lineout="   ";
+	Lineout.append("   ");
+	Lineout.append("   ");
+	Lineout.append("<insertpart x=");
+
+	Lineout.append(QChar(34));
+	Lineout.append(x_center);
+	Lineout.append(QChar(34));
+
+	Lineout.append(" y=");
+	Lineout.append(QChar(34));
+	Lineout.append(y_center);
+	Lineout.append(QChar(34));
+
+
+	Lineout.append(" name=");
+	Lineout.append(QChar(34));
+	Lineout.append(part_name);
+	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_insert.h
===================================================================
--- branches/dxftoelmt/src/ui/dxf_insert.h	2014-10-05 11:26:04 UTC (rev 3346)
+++ branches/dxftoelmt/src/ui/dxf_insert.h	2014-10-05 13:08:24 UTC (rev 3347)
@@ -7,7 +7,13 @@
 class DXF_Insert: public DXF_Data
 {
 	public:
+
+	int LTypeCount1;
+	int LayerCount1;
+
 	DXF_Insert();
+
+	void ConvertInsert(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_INSERT_H

Modified: branches/dxftoelmt/src/ui/dxftoelmt.cpp
===================================================================
--- branches/dxftoelmt/src/ui/dxftoelmt.cpp	2014-10-05 11:26:04 UTC (rev 3346)
+++ branches/dxftoelmt/src/ui/dxftoelmt.cpp	2014-10-05 13:08:24 UTC (rev 3347)
@@ -2792,12 +2792,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)
 						{
@@ -2813,11 +2813,11 @@
 							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)
 							{
@@ -2830,7 +2830,16 @@
 							}
 
 						}
+						DXF_Insert Load_Insert;
 
+						Load_Insert.LayerCount1=LayerCount;
+						Load_Insert.LTypeCount1=LtypeCount;
+
+
+						Load_Insert.ConvertInsert(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-05 11:26:04 UTC (rev 3346)
+++ branches/dxftoelmt/src/ui/dxftoelmt.h	2014-10-05 13:08:24 UTC (rev 3347)
@@ -25,6 +25,7 @@
 #include "dxf_polyline.h"
 #include "dxf_solid.h"
 #include "dxf_block.h"
+#include "dxf_insert.h"
 
 
 class dxfTOelmt : public DXF_Data


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