From ef002fdde2f2626c3fd04afea3d54e145d4ecdb0 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Wed, 5 Dec 2018 17:27:12 -0200 Subject: [PATCH] Arch: Fixed non-unified extrusion direction in multisolid structures --- src/Mod/Arch/ArchComponent.py | 7 +++++-- src/Mod/Arch/ArchStructure.py | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index 0f50c99839..74a81ce00e 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -446,11 +446,12 @@ class Component: return (rshapes,revs,rpls) return None - def rebase(self,shape): + def rebase(self,shape,hint=None): """returns a shape that is a copy of the original shape but centered on the (0,0) origin, and a placement that is needed to - reposition that shape to its original location/orientation""" + reposition that shape to its original location/orientation. + hint can be a vector that indicates the preferred normal direction""" import DraftGeomUtils,math if not isinstance(shape,list): @@ -460,6 +461,8 @@ class Component: else: v = shape[0].BoundBox.Center n = DraftGeomUtils.getNormal(shape[0]) + if hint and hint.getAngle(n) > 1.58: + n = n.negative() r = FreeCAD.Rotation(FreeCAD.Vector(0,0,1),n) if round(abs(r.Angle),8) == round(math.pi,8): r = FreeCAD.Rotation() diff --git a/src/Mod/Arch/ArchStructure.py b/src/Mod/Arch/ArchStructure.py index 4679052fad..216b86b957 100644 --- a/src/Mod/Arch/ArchStructure.py +++ b/src/Mod/Arch/ArchStructure.py @@ -630,8 +630,9 @@ class _Structure(ArchComponent.Component): # multiple extrusions b = [] p = [] + hint = obj.Base.Shape.Faces[0].normalAt(0,0) for f in obj.Base.Shape.Faces: - bf,pf = self.rebase(f) + bf,pf = self.rebase(f,hint) b.append(bf) p.append(pf) base = b