Exemplo n.º 1
0
int PropertyMeshKernelItem::countFaces() const
{
    int ctF = 0;
    const std::vector<App::Property*>& props = getPropertyData();
    for (std::vector<App::Property*>::const_iterator pt = props.begin(); pt != props.end(); ++pt) {
        Mesh::PropertyMeshKernel* pPropMesh = (Mesh::PropertyMeshKernel*)(*pt);
        const MeshKernel& rMesh = pPropMesh->getValue().getKernel();
        ctF += (int)rMesh.CountFacets();
    }

    return ctF;
}
App::DocumentObjectExecReturn *HarmonizeNormals::execute(void)
{
    App::DocumentObject* link = Source.getValue();
    if (!link) return new App::DocumentObjectExecReturn("No mesh linked");
    App::Property* prop = link->getPropertyByName("Mesh");
    if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
        Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
        std::auto_ptr<MeshObject> mesh(new MeshObject);
        *mesh = kernel->getValue();
        mesh->harmonizeNormals();
        this->Mesh.setValuePtr(mesh.release());
    }

    return App::DocumentObject::StdReturn;
}
Exemplo n.º 3
0
App::DocumentObjectExecReturn *FixDegenerations::execute(void)
{
    App::DocumentObject* link = Source.getValue();
    if (!link) return new App::DocumentObjectExecReturn("No mesh linked");
    App::Property* prop = link->getPropertyByName("Mesh");
    if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
        Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
        std::unique_ptr<MeshObject> mesh(new MeshObject);
        *mesh = kernel->getValue();
        mesh->validateDegenerations(static_cast<float>(Epsilon.getValue()));
        this->Mesh.setValuePtr(mesh.release());
    }

    return App::DocumentObject::StdReturn;
}
App::DocumentObjectExecReturn *FillHoles::execute(void)
{
    App::DocumentObject* link = Source.getValue();
    if (!link) return new App::DocumentObjectExecReturn("No mesh linked");
    App::Property* prop = link->getPropertyByName("Mesh");
    if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
        Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
        std::auto_ptr<MeshObject> mesh(new MeshObject);
        *mesh = kernel->getValue();
        MeshCore::ConstraintDelaunayTriangulator cTria(MaxArea.getValue());
        //MeshCore::Triangulator cTria(mesh->getKernel());
        mesh->fillupHoles(FillupHolesOfLength.getValue(), 1, cTria);
        this->Mesh.setValuePtr(mesh.release());
    }

    return App::DocumentObject::StdReturn;
}
Exemplo n.º 5
0
QVariant PropertyMeshKernelItem::value(const App::Property*) const
{
    int ctP = 0;
    int ctE = 0;
    int ctF = 0;

    const std::vector<App::Property*>& props = getPropertyData();
    for (std::vector<App::Property*>::const_iterator pt = props.begin(); pt != props.end(); ++pt) {
        Mesh::PropertyMeshKernel* pPropMesh = (Mesh::PropertyMeshKernel*)(*pt);
        const MeshKernel& rMesh = pPropMesh->getValue().getKernel();
        ctP += (int)rMesh.CountPoints();
        ctE += (int)rMesh.CountEdges();
        ctF += (int)rMesh.CountFacets();
    }

    QString  str = QObject::tr("[Points: %1, Edges: %2 Faces: %3]").arg(ctP).arg(ctE).arg(ctF);
    return QVariant(str);
}