Arch: Fixed non-unified extrusion direction in multisolid structures

This commit is contained in:
Yorik van Havre
2018-12-05 17:27:12 -02:00
parent 36114bac0a
commit 00a241ec40
2 changed files with 7 additions and 3 deletions

View File

@@ -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()

View File

@@ -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