Fix forcing NURBS to mesh in a step group when the flag is inherited.
Before this commit, if the source group of a step rotate/translate group is forced to triangle mesh, the UI would show that the step rotate/translate group is also forced to triangle mesh, but the group would in fact contain NURBS surfaces.pull/238/head
parent
ecb6550b5c
commit
8fd11f4886
|
@ -79,6 +79,8 @@ Bugs fixed:
|
||||||
spurious changes in the sketch.
|
spurious changes in the sketch.
|
||||||
* Points highlighted with "Analyze → Show Degrees of Freedom" are drawn
|
* Points highlighted with "Analyze → Show Degrees of Freedom" are drawn
|
||||||
on top of all other geometry.
|
on top of all other geometry.
|
||||||
|
* A step rotate/translate group using a group forced to triangle mesh
|
||||||
|
as a source group also gets forced to triangle mesh.
|
||||||
|
|
||||||
2.3
|
2.3
|
||||||
---
|
---
|
||||||
|
|
|
@ -318,6 +318,23 @@ void Group::TransformImportedBy(Vector t, Quaternion q) {
|
||||||
SK.GetParam(qz)->val = qg.vz;
|
SK.GetParam(qz)->val = qg.vz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Group::IsForcedToMeshBySource() const {
|
||||||
|
const Group *srcg = this;
|
||||||
|
if(type == Type::TRANSLATE || type == Type::ROTATE) {
|
||||||
|
// A step and repeat gets merged against the group's prevous group,
|
||||||
|
// not our own previous group.
|
||||||
|
srcg = SK.GetGroup(opA);
|
||||||
|
if(srcg->forceToMesh) return true;
|
||||||
|
}
|
||||||
|
Group *g = srcg->RunningMeshGroup();
|
||||||
|
if(g == NULL) return false;
|
||||||
|
return g->forceToMesh || g->IsForcedToMeshBySource();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Group::IsForcedToMesh() const {
|
||||||
|
return forceToMesh || IsForcedToMeshBySource();
|
||||||
|
}
|
||||||
|
|
||||||
std::string Group::DescriptionString() {
|
std::string Group::DescriptionString() {
|
||||||
if(name.empty()) {
|
if(name.empty()) {
|
||||||
return ssprintf("g%03x-%s", h.v, _("(unnamed)"));
|
return ssprintf("g%03x-%s", h.v, _("(unnamed)"));
|
||||||
|
|
|
@ -204,8 +204,14 @@ void Group::GenerateShellAndMesh() {
|
||||||
srcg = SK.GetGroup(opA);
|
srcg = SK.GetGroup(opA);
|
||||||
|
|
||||||
if(!srcg->suppress) {
|
if(!srcg->suppress) {
|
||||||
GenerateForStepAndRepeat<SShell>(&(srcg->thisShell), &thisShell, srcg->meshCombine);
|
if(!IsForcedToMesh()) {
|
||||||
GenerateForStepAndRepeat<SMesh> (&(srcg->thisMesh), &thisMesh, srcg->meshCombine);
|
GenerateForStepAndRepeat<SShell>(&(srcg->thisShell), &thisShell, srcg->meshCombine);
|
||||||
|
} else {
|
||||||
|
SMesh prevm = {};
|
||||||
|
prevm.MakeFromCopyOf(&srcg->thisMesh);
|
||||||
|
srcg->thisShell.TriangulateInto(&prevm);
|
||||||
|
GenerateForStepAndRepeat<SMesh> (&prevm, &thisMesh, srcg->meshCombine);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if(type == Type::EXTRUDE && haveSrc) {
|
} else if(type == Type::EXTRUDE && haveSrc) {
|
||||||
Group *src = SK.GetGroup(opA);
|
Group *src = SK.GetGroup(opA);
|
||||||
|
@ -317,7 +323,7 @@ void Group::GenerateShellAndMesh() {
|
||||||
|
|
||||||
Group *prevg = srcg->RunningMeshGroup();
|
Group *prevg = srcg->RunningMeshGroup();
|
||||||
|
|
||||||
if(prevg->runningMesh.IsEmpty() && thisMesh.IsEmpty() && !forceToMesh) {
|
if(!IsForcedToMesh()) {
|
||||||
SShell *prevs = &(prevg->runningShell);
|
SShell *prevs = &(prevg->runningShell);
|
||||||
GenerateForBoolean<SShell>(prevs, &thisShell, &runningShell,
|
GenerateForBoolean<SShell>(prevs, &thisShell, &runningShell,
|
||||||
srcg->meshCombine);
|
srcg->meshCombine);
|
||||||
|
@ -434,7 +440,7 @@ void Group::GenerateDisplayItems() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Group *Group::PreviousGroup() {
|
Group *Group::PreviousGroup() const {
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < SK.groupOrder.n; i++) {
|
for(i = 0; i < SK.groupOrder.n; i++) {
|
||||||
Group *g = SK.GetGroup(SK.groupOrder.elem[i]);
|
Group *g = SK.GetGroup(SK.groupOrder.elem[i]);
|
||||||
|
@ -444,7 +450,7 @@ Group *Group::PreviousGroup() {
|
||||||
return SK.GetGroup(SK.groupOrder.elem[i - 1]);
|
return SK.GetGroup(SK.groupOrder.elem[i - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Group *Group::RunningMeshGroup() {
|
Group *Group::RunningMeshGroup() const {
|
||||||
if(type == Type::TRANSLATE || type == Type::ROTATE) {
|
if(type == Type::TRANSLATE || type == Type::ROTATE) {
|
||||||
return SK.GetGroup(opA)->RunningMeshGroup();
|
return SK.GetGroup(opA)->RunningMeshGroup();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -234,6 +234,8 @@ public:
|
||||||
void Generate(EntityList *entity, ParamList *param);
|
void Generate(EntityList *entity, ParamList *param);
|
||||||
bool IsSolvedOkay();
|
bool IsSolvedOkay();
|
||||||
void TransformImportedBy(Vector t, Quaternion q);
|
void TransformImportedBy(Vector t, Quaternion q);
|
||||||
|
bool IsForcedToMeshBySource() const;
|
||||||
|
bool IsForcedToMesh() const;
|
||||||
// When a request generates entities from entities, and the source
|
// When a request generates entities from entities, and the source
|
||||||
// entities may have come from multiple requests, it's necessary to
|
// entities may have come from multiple requests, it's necessary to
|
||||||
// remap the entity ID so that it's still unique. We do this with a
|
// remap the entity ID so that it's still unique. We do this with a
|
||||||
|
@ -271,8 +273,8 @@ public:
|
||||||
void AssembleLoops(bool *allClosed, bool *allCoplanar, bool *allNonZeroLen);
|
void AssembleLoops(bool *allClosed, bool *allCoplanar, bool *allNonZeroLen);
|
||||||
void GenerateLoops();
|
void GenerateLoops();
|
||||||
// And the mesh stuff
|
// And the mesh stuff
|
||||||
Group *PreviousGroup();
|
Group *PreviousGroup() const;
|
||||||
Group *RunningMeshGroup();
|
Group *RunningMeshGroup() const;
|
||||||
bool IsMeshGroup();
|
bool IsMeshGroup();
|
||||||
|
|
||||||
void GenerateShellAndMesh();
|
void GenerateShellAndMesh();
|
||||||
|
|
|
@ -395,8 +395,7 @@ void TextWindow::ShowGroupInfo() {
|
||||||
&TextWindow::ScreenChangeGroupOption,
|
&TextWindow::ScreenChangeGroupOption,
|
||||||
g->visible ? CHECK_TRUE : CHECK_FALSE);
|
g->visible ? CHECK_TRUE : CHECK_FALSE);
|
||||||
|
|
||||||
Group *pg; pg = g->PreviousGroup();
|
if(!g->IsForcedToMeshBySource()) {
|
||||||
if(pg && pg->runningMesh.IsEmpty() && g->thisMesh.IsEmpty()) {
|
|
||||||
Printf(false, " %f%Lf%Fd%s force NURBS surfaces to triangle mesh",
|
Printf(false, " %f%Lf%Fd%s force NURBS surfaces to triangle mesh",
|
||||||
&TextWindow::ScreenChangeGroupOption,
|
&TextWindow::ScreenChangeGroupOption,
|
||||||
g->forceToMesh ? CHECK_TRUE : CHECK_FALSE);
|
g->forceToMesh ? CHECK_TRUE : CHECK_FALSE);
|
||||||
|
|
Loading…
Reference in New Issue