Export Radial Dim to Dxf
This commit is contained in:
@@ -695,5 +695,24 @@ void ImpExpDxfWrite::exportAngularDim(Base::Vector3d textLocn, Base::Vector3d li
|
||||
apex[1] = apexPoint.y;
|
||||
apex[2] = apexPoint.z;
|
||||
WriteAngularDim(text, line, apex, ext1, apex, ext2, dimText, getLayerName().c_str());
|
||||
}
|
||||
|
||||
void ImpExpDxfWrite::exportRadialDim(Base::Vector3d centerPoint, Base::Vector3d textLocn,
|
||||
Base::Vector3d arcPoint,
|
||||
char* dimText)
|
||||
{
|
||||
double center[3] = {0,0,0};
|
||||
center[0] = centerPoint.x;
|
||||
center[1] = centerPoint.y;
|
||||
center[2] = centerPoint.z;
|
||||
double text[3] = {0,0,0};
|
||||
text[0] = textLocn.x;
|
||||
text[1] = textLocn.y;
|
||||
text[2] = textLocn.z;
|
||||
double arc[3] = {0,0,0};
|
||||
arc[0] = arcPoint.x;
|
||||
arc[1] = arcPoint.y;
|
||||
arc[2] = arcPoint.z;
|
||||
WriteRadialDim(center, text, arc, dimText, getLayerName().c_str());
|
||||
|
||||
}
|
||||
|
||||
@@ -88,6 +88,9 @@ namespace Import
|
||||
Base::Vector3d extLine1Start, Base::Vector3d extLine2Start,
|
||||
Base::Vector3d apexPoint,
|
||||
char* dimText);
|
||||
void exportRadialDim(Base::Vector3d centerPoint, Base::Vector3d textLocn,
|
||||
Base::Vector3d arcPoint,
|
||||
char* dimText);
|
||||
|
||||
static bool gp_PntEqual(gp_Pnt p1, gp_Pnt p2);
|
||||
static bool gp_PntCompare(gp_Pnt p1, gp_Pnt p2);
|
||||
|
||||
@@ -396,27 +396,6 @@ void CDxfWrite::WriteLinearDim(const double* textMidPoint, const double* lineDef
|
||||
(*m_ofs) << extLine2[1] << endl;
|
||||
(*m_ofs) << 34 << endl;
|
||||
(*m_ofs) << extLine2[2] << endl;
|
||||
////angular dims
|
||||
// (*m_ofs) << 100 << endl;
|
||||
// (*m_ofs) << "AcDb3PointAngularDimension" << endl;
|
||||
// (*m_ofs) << 13 << endl;
|
||||
// (*m_ofs) << extLine1[0] << endl;
|
||||
// (*m_ofs) << 23 << endl;
|
||||
// (*m_ofs) << extLine1[1] << endl;
|
||||
// (*m_ofs) << 33 << endl;
|
||||
// (*m_ofs) << extLine1[2] << endl;
|
||||
// (*m_ofs) << 14 << endl;
|
||||
// (*m_ofs) << extLine2[0] << endl;
|
||||
// (*m_ofs) << 24 << endl;
|
||||
// (*m_ofs) << extLine2[1] << endl;
|
||||
// (*m_ofs) << 34 << endl;
|
||||
// (*m_ofs) << extLine2[2] << endl;
|
||||
// (*m_ofs) << 15 << endl;
|
||||
// (*m_ofs) << apexPoint[0] << endl;
|
||||
// (*m_ofs) << 25 << endl;
|
||||
// (*m_ofs) << apexPoint[1] << endl;
|
||||
// (*m_ofs) << 35 << endl;
|
||||
// (*m_ofs) << apexPoint[2] << endl;
|
||||
////radial dims
|
||||
// (*m_ofs) << 100 << endl;
|
||||
// (*m_ofs) << "AcDbRadialDimension" << endl;
|
||||
@@ -516,6 +495,56 @@ void CDxfWrite::WriteAngularDim(const double* textMidPoint, const double* lineDe
|
||||
(*m_ofs) << 36 << endl;
|
||||
(*m_ofs) << lineDefPoint[2] << endl;
|
||||
}
|
||||
//***************************
|
||||
//WriteRadialDim
|
||||
//added by Wandererfan 2018 (wandererfan@gmail.com) for FreeCAD project
|
||||
void CDxfWrite::WriteRadialDim(const double* centerPoint, const double* textMidPoint,
|
||||
const double* arcPoint,
|
||||
const char* dimText,
|
||||
const char* layer_name)
|
||||
{
|
||||
(*m_ofs) << 0 << endl;
|
||||
(*m_ofs) << "DIMENSION" << endl;
|
||||
(*m_ofs) << 8 << endl;
|
||||
(*m_ofs) << layer_name << endl;
|
||||
(*m_ofs) << 100 << endl;
|
||||
(*m_ofs) << "AcDbEntity" << endl;
|
||||
(*m_ofs) << 100 << endl;
|
||||
(*m_ofs) << "AcDbDimension" << endl;
|
||||
(*m_ofs) << 2 << endl;
|
||||
(*m_ofs) << "*D1" << endl; // blockName *D1 ??
|
||||
(*m_ofs) << 10 << endl; // arc center point
|
||||
(*m_ofs) << centerPoint[0] << endl;
|
||||
(*m_ofs) << 20 << endl;
|
||||
(*m_ofs) << centerPoint[1] << endl;
|
||||
(*m_ofs) << 30 << endl;
|
||||
(*m_ofs) << centerPoint[2] << endl;
|
||||
(*m_ofs) << 11 << endl; //text mid point
|
||||
(*m_ofs) << textMidPoint[0] << endl;
|
||||
(*m_ofs) << 21 << endl;
|
||||
(*m_ofs) << textMidPoint[1] << endl;
|
||||
(*m_ofs) << 31 << endl;
|
||||
(*m_ofs) << textMidPoint[2] << endl;
|
||||
(*m_ofs) << 70 << endl;
|
||||
(*m_ofs) << 4 << endl; // dimType 4 = Radius
|
||||
(*m_ofs) << 71 << endl;
|
||||
(*m_ofs) << 1 << endl; // attachPoint 5 = middle center
|
||||
(*m_ofs) << 1 << endl;
|
||||
(*m_ofs) << dimText << endl;
|
||||
(*m_ofs) << 3 << endl;
|
||||
(*m_ofs) << "STANDARD" << endl; //style
|
||||
//radial dims
|
||||
(*m_ofs) << 100 << endl;
|
||||
(*m_ofs) << "AcDbRadialDimension" << endl;
|
||||
(*m_ofs) << 15 << endl;
|
||||
(*m_ofs) << arcPoint[0] << endl;
|
||||
(*m_ofs) << 25 << endl;
|
||||
(*m_ofs) << arcPoint[1] << endl;
|
||||
(*m_ofs) << 35 << endl;
|
||||
(*m_ofs) << arcPoint[2] << endl;
|
||||
(*m_ofs) << 40 << endl; // leader length????
|
||||
(*m_ofs) << 0 << endl;
|
||||
}
|
||||
|
||||
|
||||
CDxfRead::CDxfRead(const char* filepath)
|
||||
|
||||
@@ -146,7 +146,10 @@ public:
|
||||
const double* startExt2, const double* endExt2,
|
||||
const char* dimText,
|
||||
const char* layer_name);
|
||||
// const char* blockName, const int dimType, const int attachPoint,
|
||||
void WriteRadialDim(const double* centerPoint, const double* textMidPoint,
|
||||
const double* arcPoint,
|
||||
const char* dimText,
|
||||
const char* layer_name);
|
||||
};
|
||||
|
||||
// derive a class from this and implement it's virtual functions
|
||||
|
||||
@@ -651,6 +651,16 @@ private:
|
||||
end1 = end1 + parentPos;
|
||||
end2 = end2 + parentPos;
|
||||
writer.exportAngularDim(textLocn, lineLocn, end1, end2, apex, dimText);
|
||||
}else if (dvd->Type.isValue("Radius")) {
|
||||
Base::Vector3d textLocn(dvd->X.getValue() + parentX, dvd->Y.getValue() + parentY, 0.0);
|
||||
arcPoints pts = dvd->getArcPoints();
|
||||
Base::Vector3d center = pts.center;
|
||||
center.y = -center.y;
|
||||
Base::Vector3d arcPoint = pts.midArc;
|
||||
arcPoint.y = -arcPoint.y;
|
||||
center = center + parentPos;
|
||||
arcPoint = arcPoint + parentPos;
|
||||
writer.exportRadialDim(center, textLocn, arcPoint, dimText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user