File cc_dxf-color.patch of Package cloudcompare
diff -U 3 -H -d -r -N -- a/contrib/dxflib-3.17.0/src/dl_dxf.cpp b/contrib/dxflib-3.17.0/src/dl_dxf.cpp
--- a/contrib/dxflib-3.17.0/src/dl_dxf.cpp 2019-02-17 02:02:03.000000000 +0100
+++ b/contrib/dxflib-3.17.0/src/dl_dxf.cpp 2019-02-11 19:02:24.000000000 +0100
@@ -2356,7 +2356,7 @@
// Newer version require that (otherwise a*cad crashes..)
if (version==DL_VERSION_2000) {
dw.dxfString(9, "$HANDSEED");
- dw.dxfHex(5, 0xFFFF);
+ dw.dxfHex(5, 0xFFFFFF);
}
// commented out: more variables can be added after that by caller:
diff -U 3 -H -d -r -N -- a/libs/qCC_io/DxfFilter.cpp b/libs/qCC_io/DxfFilter.cpp
--- a/libs/qCC_io/DxfFilter.cpp 2019-02-17 02:02:03.000000000 +0100
+++ b/libs/qCC_io/DxfFilter.cpp 2019-02-11 18:48:34.000000000 +0100
@@ -765,7 +765,7 @@
}
DL_Dxf dxf;
- DL_WriterA* dw = dxf.out(qPrintable(filename), DL_VERSION_R12);
+ DL_WriterA* dw = dxf.out(qPrintable(filename), DL_VERSION_2000);
if (!dw)
{
return CC_FERR_WRITING;
@@ -1001,11 +1001,17 @@
for (unsigned j = 0; j < pointCount; ++j)
{
const CCVector3* P = cloud->getPoint(j);
+ int ColN= -1;
+ if (cloud->hasColors()){
+ ccColor::Rgb ColP = cloud->getPointColor(j);
+ int tempN = (ColP.r *256)+ColP.g;
+ ColN = (tempN *256)+ ColP.b;
+ }
CCVector3d Pg = cloud->toGlobal3d(*P);
dxf.writePoint(*dw,
DL_PointData(Pg.x, Pg.y, Pg.z),
- DL_Attributes(qPrintable(pointLayerNames[i]), DL_Codes::bylayer, -1, "BYLAYER", 1.0)); //DGM: warning, toStdString doesn't preserve "local" characters
- }
+ DL_Attributes(qPrintable(pointLayerNames[i]), DL_Codes::bylayer, ColN, 0, "BYLAYER", 1.0)); //DGM: warning, toStdString doesn't preserve "local" characters
+ }
}
dw->sectionEnd();