Correct which group is forced to mesh when linking an STL file

By making IsForcedToMesh() always return true for STL link groups,
rather than trying to set forceToMesh=true during the import phase.

STL link groups are now always shown as "model already forced to
triangle mesh" in the details screen, but also (unlike when the model
is forced to mesh by a parent group) show the '∆' icon in the group
list.
This commit is contained in:
Tom Sutcliffe 2021-08-24 20:44:51 +01:00 committed by phkahler
parent f71c527e23
commit 7e823df94a
4 changed files with 8 additions and 4 deletions

View File

@ -404,7 +404,11 @@ bool Group::IsForcedToMeshBySource() const {
}
bool Group::IsForcedToMesh() const {
return forceToMesh || IsForcedToMeshBySource();
return forceToMesh || IsTriangleMeshAssembly() || IsForcedToMeshBySource();
}
bool Group::IsTriangleMeshAssembly() const {
return type == Type::LINKED && linkFile.Extension() == "stl";
}
std::string Group::DescriptionString() {

View File

@ -171,7 +171,6 @@ bool LinkStl(const Platform::Path &filename, EntityList *el, SMesh *m, SShell *s
addUnique(verts, tr.b, normal);
addUnique(verts, tr.c, normal);
}
SK.GetGroup(SS.GW.activeGroup)->forceToMesh = true;
dbp("%d verticies", verts.size());
BBox box = {};

View File

@ -269,6 +269,7 @@ public:
void Generate(EntityList *entity, ParamList *param);
bool IsSolvedOkay();
void TransformImportedBy(Vector t, Quaternion q);
bool IsTriangleMeshAssembly() const;
bool IsForcedToMeshBySource() const;
bool IsForcedToMesh() const;
// When a request generates entities from entities, and the source

View File

@ -124,7 +124,7 @@ void TextWindow::ShowListOfGroups() {
}
}
std::string suffix;
if(g->forceToMesh) {
if(g->forceToMesh || g->IsTriangleMeshAssembly()) {
suffix = " (∆)";
}
@ -495,7 +495,7 @@ void TextWindow::ShowGroupInfo() {
&TextWindow::ScreenChangeGroupOption,
g->visible ? CHECK_TRUE : CHECK_FALSE);
if(!g->IsForcedToMeshBySource()) {
if(!g->IsForcedToMeshBySource() && !g->IsTriangleMeshAssembly()) {
Printf(false, " %f%Lf%Fd%s force NURBS surfaces to triangle mesh",
&TextWindow::ScreenChangeGroupOption,
g->forceToMesh ? CHECK_TRUE : CHECK_FALSE);