Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groups that contain more than one geode causing issues when exporting to STL format #986

Open
awiddess-ccdc opened this issue Oct 1, 2020 · 2 comments

Comments

@awiddess-ccdc
Copy link

When there is a group of geodes and you export to STL each geode contains a solid/endsolid
When this is processed (using the attached example) you only see a sphere rather than a crystal structure.
AABHTZ.zip

Would it be possible to include a boolean to specify whether the geode requires the "solid" to be specified?
Or, is there another way of overriding the visitor to allow our own implementation?

@robertosfield
Copy link
Collaborator

I'm struggling to figure out what you referring to/have in mind.

Are you talking about needing to extend the STL plugin in some way?

I can't comment on STL plugin specifics without diving into the code - I'm not author of this plugin so am in the same position as yourself w.r.t having to figure out what the codes does, what is appropriate for the file format.

@awiddess-ccdc
Copy link
Author

Hi robertosfield, thanks for your comments.

From the specification:
`solid

facet normal ni nj nk
outer loop
vertex v1x v1y v1z
vertex v2x v2y v2z
vertex v3x v3y v3z
endloop
endfacet

endsolid `

ReaderWriterSTL.cpp will output the format (above) for each geode within a group.
It doesn't necessarily break the specification as the use of "solid" is ambiguous - however, it does beak a couple of 3D printing tools (Microsoft is one).

This is an example (significantly reduced) of what is generated from the ReaderWriterSTL when there is a group of geodes:-
solid 0 facet normal 0 -0 0 outer loop vertex -36.7201 7.9413 11.4092 vertex -35.9604 7.9413 11.3428 vertex -36.7201 7.9413 11.4092 endloop endfacet facet normal 0.0172704 0.00304538 0.197401 outer loop vertex -35.9604 7.9413 11.3428 vertex -36.0062 8.20114 11.3428 vertex -36.7201 7.9413 11.4092 endloop endfacet endsolid 0 solid 1 facet normal 0 -0 0 outer loop vertex -61.6544 -38.4334 26.0545 vertex -60.8947 -38.4334 25.988 vertex -61.6544 -38.4334 26.0545 endloop endfacet facet normal 0.0172702 0.00304533 0.197402 outer loop vertex -60.8947 -38.4334 25.988 vertex -60.9406 -38.1736 25.988 vertex -61.6544 -38.4334 26.0545 endloop endfacet facet normal 0 -0 0 outer loop vertex -61.6544 -38.4334 26.0545 vertex -60.9406 -38.1736 25.988 vertex -61.6544 -38.4334 26.0545 endloop endfacet endsolid 1

The boolean, would support wrapping up the output of "solid" and "endsolid"
`
if (node.solidRequired)
{
if (node.getName().empty())
*m_f << "solid " << counter << std::endl;
else
*m_f << "solid " << node.getName() << std::endl;
}

        *m_f << std::fixed << std::setprecision(7);
        for (unsigned int i = 0; i < node.getNumDrawables(); ++i)
        {
            osg::TriangleFunctor<PushPoints> tf;
            tf.m_stream = m_f;
            tf.m_mat = mat;
            tf.m_dontSaveNormals = m_localOptions.dontSaveNormals;
            node.getDrawable(i)->accept(tf);
        }


        if (node.solidRequired)
        {
            if (node.getName().empty())
                *m_f << "endsolid " << counter << std::endl;
            else
                *m_f << "endsolid " << node.getName() << std::endl;
        }

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants