Export Linear Dim to Dxf

This commit is contained in:
wandererfan
2018-05-20 11:58:43 -04:00
parent ce9ad27eb0
commit 06e8572d98
5 changed files with 162 additions and 6 deletions

View File

@@ -342,6 +342,105 @@ void CDxfWrite::WriteText(const char* text, const double* location1, const doubl
(*m_ofs) << location2[2] << endl;
}
//***************************
//WriteDim
//added by Wandererfan 2018 (wandererfan@gmail.com) for FreeCAD project
void CDxfWrite::WriteDim(const double* textMidPoint, const double* lineDefPoint,
const double* extLine1, const double* extLine2,
const char* dimText,
const char* layer_name)
//const char* blockName, const int dimType, const int attachPoint,
{
(*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; //dimension line definition point
(*m_ofs) << lineDefPoint[0] << endl;
(*m_ofs) << 20 << endl;
(*m_ofs) << lineDefPoint[1] << endl;
(*m_ofs) << 30 << endl;
(*m_ofs) << lineDefPoint[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) << 1 << endl; // dimType1 = Aligned
(*m_ofs) << 71 << endl;
(*m_ofs) << 1 << endl; // attachPoint ??1 = topleft
(*m_ofs) << 1 << endl;
(*m_ofs) << dimText << endl;
(*m_ofs) << 3 << endl;
(*m_ofs) << "STANDARD" << endl; //style
//linear dims
(*m_ofs) << 100 << endl;
(*m_ofs) << "AcDbAlignedDimension" << 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;
////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;
// (*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;
// (*m_ofs) << lenLeader << endl;
////diametric 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;
// (*m_ofs) << lenLeader << endl;
}
CDxfRead::CDxfRead(const char* filepath)
{