示例#1
0
string ProjectionAlgos::getDXF(ExtractionType type, double /*scale*/, double tolerance)
{
    stringstream result;
    DXFOutput output;

    if (!H.IsNull() && (type & WithHidden)) {
        //float width = 0.15f/scale;
        BRepMesh_IncrementalMesh(H,tolerance);
        result  << output.exportEdges(H);
    }
    if (!HO.IsNull() && (type & WithHidden)) {
        //float width = 0.15f/scale;
        BRepMesh_IncrementalMesh(HO,tolerance);
        result  << output.exportEdges(HO);
    }
    if (!VO.IsNull()) {
        //float width = 0.35f/scale;
        BRepMesh_IncrementalMesh(VO,tolerance);
        result  << output.exportEdges(VO);
    }
    if (!V.IsNull()) {
        //float width = 0.35f/scale;
        BRepMesh_IncrementalMesh(V,tolerance);
        result  << output.exportEdges(V);
    }
    if (!V1.IsNull() && (type & WithSmooth)) {
        //float width = 0.35f/scale;
        BRepMesh_IncrementalMesh(V1,tolerance);
        result  << output.exportEdges(V1);
    }
    if (!H1.IsNull() && (type & WithSmooth) && (type & WithHidden)) {
        //float width = 0.15f/scale;
        BRepMesh_IncrementalMesh(H1,tolerance);
        result  << output.exportEdges(H1);
    }

    return result.str();
}
std::string ProjectionAlgos::getDXF(ExtractionType type, float scale, float tolerance)
{
    std::stringstream result;
    DXFOutput output;
    
    result << "0"          << endl
        << "SECTION"  << endl

        << "2"          << endl
        << "ENTITIES" << endl;

    if (!H.IsNull() && (type & WithHidden)) {
        //float width = 0.15f/scale;
        BRepMesh::Mesh(H,tolerance);
        result  //<< "<g" 
                //<< " id=\"" << ViewName << "\"" << endl
                /*<< "   stroke=\"rgb(0, 0, 0)\"" << endl 
                << "   stroke-width=\"" << width << "\"" << endl
                << "   stroke-linecap=\"butt\"" << endl
                << "   stroke-linejoin=\"miter\"" << endl
                << "   stroke-dasharray=\"5 3\"" << endl
                << "   fill=\"none\"" << endl
                << "  >" << endl*/
                << output.exportEdges(H);
                //<< "</g>" << endl;
    }
    if (!HO.IsNull() && (type & WithHidden)) {
        //float width = 0.15f/scale;
        BRepMesh::Mesh(HO,tolerance);
        result  //<< "<g" 
                //<< " id=\"" << ViewName << "\"" << endl
                /*<< "   stroke=\"rgb(0, 0, 0)\"" << endl 
                << "   stroke-width=\"" << width << "\"" << endl
                << "   stroke-linecap=\"butt\"" << endl
                << "   stroke-linejoin=\"miter\"" << endl
                << "   stroke-dasharray=\"5 3\"" << endl
                << "   fill=\"none\"" << endl
                << "  >" << endl*/
                << output.exportEdges(HO);
                //<< "</g>" << endl;
    }
    if (!VO.IsNull()) {
        //float width = 0.35f/scale;
        BRepMesh::Mesh(VO,tolerance);
        result  //<< "<g" 
                //<< " id=\"" << ViewName << "\"" << endl

                /*<< "   stroke=\"rgb(0, 0, 0)\"" << endl 
                << "   stroke-width=\"" << width << "\"" << endl
                << "   stroke-linecap=\"butt\"" << endl
                << "   stroke-linejoin=\"miter\"" << endl
                << "   fill=\"none\"" << endl
                << "  >" << endl*/

                << output.exportEdges(VO);
                //<< "</g>" << endl;
    }
    if (!V.IsNull()) {
        //float width = 0.35f/scale;
        BRepMesh::Mesh(V,tolerance);
        result  //<< "<g" 
                //<< " id=\"" << ViewName << "\"" << endl
                /*<< "   stroke=\"rgb(0, 0, 0)\"" << endl 
                << "   stroke-width=\"" << width << "\"" << endl
                << "   stroke-linecap=\"butt\"" << endl

                << "   stroke-linejoin=\"miter\"" << endl
                << "   fill=\"none\"" << endl
                << "  >" << endl*/
                << output.exportEdges(V);
                //<< "</g>" << endl;

    }
    if (!V1.IsNull() && (type & WithSmooth)) {
        //float width = 0.35f/scale;
        BRepMesh::Mesh(V1,tolerance);
        result  //<< "<g" 

                //<< " id=\"" << ViewName << "\"" << endl
               /* << "   stroke=\"rgb(0, 0, 0)\"" << endl 
                << "   stroke-width=\"" << width << "\"" << endl
                << "   stroke-linecap=\"butt\"" << endl
                << "   stroke-linejoin=\"miter\"" << endl
                << "   fill=\"none\"" << endl

                << "  >" << endl*/
                << output.exportEdges(V1);
                //<< "</g>" << endl;
    }
    if (!H1.IsNull() && (type & WithSmooth) && (type & WithHidden)) {
        //float width = 0.15f/scale;
        BRepMesh::Mesh(H1,tolerance);
        result  //<< "<g" 
                //<< " id=\"" << ViewName << "\"" << endl
                /*<< "   stroke=\"rgb(0, 0, 0)\"" << endl 
                << "   stroke-width=\"" << width << "\"" << endl

                << "   stroke-linecap=\"butt\"" << endl
                << "   stroke-linejoin=\"miter\"" << endl
                << "   stroke-dasharray=\"5 3\"" << endl
                << "   fill=\"none\"" << endl
                << "  >" << endl*/

                << output.exportEdges(H1);
                //<< "</g>" << endl;
    }


    result      << 0          << endl
                << "ENDSEC"   << endl
                << 0          << endl
                << "EOF";

    return result.str();
}