Skip to content

Commit

Permalink
Part: Attacher: fix normal-to-path vertex usage, #3175
Browse files Browse the repository at this point in the history
Modes affected:
* NormalToEdge ("Z tangent to edge", "Normal to edge"),
* Tangent

In these attachment modes, if vertex is linked first, the origin was
supposed to be placed on the vertex, but it was placed on the edge
instead, due to a bug. This commit fixes the bug.

Projects will be broken, which use above mentioned attachment modes, and
link Vertex as first reference, and the vertex does not lie on the edge.
To repair a project, edit the corresponding attachments, and swap the
order of references.
  • Loading branch information
DeepSOIC authored and wwmayer committed Sep 10, 2017
1 parent 155c000 commit 576294d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Mod/Part/App/Attacher.cpp
Expand Up @@ -1221,6 +1221,13 @@ Base::Placement AttachEngine3D::calculateAttachedPlacement(Base::Placement origP
if (d.Magnitude()<Precision::Confusion())
throw Base::ValueError("AttachEngine3D::calculateAttachedPlacement: path curve derivative is below 1e-7, too low, can't align");

//Set origin. Note that it will be overridden later for mmConcentric and mmRevolutionSection
if (bThruVertex) {
SketchBasePoint = p_in;
} else {
SketchBasePoint = p;
}

if (mmode == mmRevolutionSection
|| mmode == mmConcentric
|| mmode == mmFrenetNB
Expand All @@ -1247,12 +1254,6 @@ Base::Placement AttachEngine3D::calculateAttachedPlacement(Base::Placement origP
B = gp_Vec(0.,0.,0.);//redundant, just for consistency
}

//Set origin. Note that it will be overridden later for mmConcentric and mmRevolutionSection
if (bThruVertex) {
SketchBasePoint = p_in;
} else {
SketchBasePoint = p;
}

switch (mmode){
case mmFrenetNB:
Expand Down Expand Up @@ -1289,7 +1290,6 @@ Base::Placement AttachEngine3D::calculateAttachedPlacement(Base::Placement origP
} else if (mmode == mmNormalToPath){//mmNormalToPath
//align sketch origin to the origin of support
SketchNormal = gp_Dir(d.Reversed());//sketch normal looks at user. It is natural to have the curve directed away from user, so reversed.
SketchBasePoint = p;
}

} break;
Expand Down

0 comments on commit 576294d

Please sign in to comment.