mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: When writing a triSurface to ascii stl or obj, exclude empty patches
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -52,8 +52,12 @@ void triSurface::writeOBJ(const bool writeSorted, Ostream& os) const
|
|||||||
// Print patch names as comment
|
// Print patch names as comment
|
||||||
forAll(myPatches, patchI)
|
forAll(myPatches, patchI)
|
||||||
{
|
{
|
||||||
os << "# " << patchI << " "
|
const surfacePatch& patch = myPatches[patchI];
|
||||||
<< myPatches[patchI].name() << nl;
|
|
||||||
|
if (patch.size() > 0)
|
||||||
|
{
|
||||||
|
os << "# " << patchI << " " << patch.name() << nl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
os << "#" << nl;
|
os << "#" << nl;
|
||||||
|
|
||||||
@ -77,14 +81,17 @@ void triSurface::writeOBJ(const bool writeSorted, Ostream& os) const
|
|||||||
|
|
||||||
forAll(myPatches, patchI)
|
forAll(myPatches, patchI)
|
||||||
{
|
{
|
||||||
// Print all faces belonging to this patch
|
const surfacePatch& patch = myPatches[patchI];
|
||||||
|
|
||||||
os << "g " << myPatches[patchI].name() << nl;
|
// Print all faces belonging to this patch
|
||||||
|
if (patch.size() > 0)
|
||||||
|
{
|
||||||
|
os << "g " << patch.name() << nl;
|
||||||
|
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
label patchFaceI = 0;
|
label patchFaceI = 0;
|
||||||
patchFaceI < myPatches[patchI].size();
|
patchFaceI < patch.size();
|
||||||
patchFaceI++
|
patchFaceI++
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -99,6 +106,7 @@ void triSurface::writeOBJ(const bool writeSorted, Ostream& os) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Get patch (=compact region) per face
|
// Get patch (=compact region) per face
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -43,6 +43,8 @@ void Foam::triSurface::writeSTLASCII(Ostream& os) const
|
|||||||
// Print all faces belonging to this region
|
// Print all faces belonging to this region
|
||||||
const surfacePatch& patch = myPatches[patchI];
|
const surfacePatch& patch = myPatches[patchI];
|
||||||
|
|
||||||
|
if (patch.size() > 0)
|
||||||
|
{
|
||||||
os << "solid " << patch.name() << endl;
|
os << "solid " << patch.name() << endl;
|
||||||
|
|
||||||
for
|
for
|
||||||
@ -78,6 +80,7 @@ void Foam::triSurface::writeSTLASCII(Ostream& os) const
|
|||||||
os << "endsolid " << patch.name() << endl;
|
os << "endsolid " << patch.name() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::triSurface::writeSTLBINARY(std::ostream& os) const
|
void Foam::triSurface::writeSTLBINARY(std::ostream& os) const
|
||||||
|
|||||||
Reference in New Issue
Block a user