Skip to content

Commit

Permalink
Merge pull request #4894 from steelman/arch-frame-profile-alignment
Browse files Browse the repository at this point in the history
Arch: Align profile's Y with layout's normal vector
  • Loading branch information
yorikvanhavre committed Aug 3, 2021
2 parents 1b63b61 + a92ee7f commit bc9a601
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Mod/Arch/ArchFrame.py
Expand Up @@ -219,12 +219,20 @@ def execute(self,obj):
basepoint = profile.CenterOfMass
profile.translate(bpoint.sub(basepoint))
if obj.Align:
# Align profile's Z axis with the direction of the layout edge.
axis = profile.Placement.Rotation.multVec(FreeCAD.Vector(0,0,1))
angle = bvec.getAngle(axis)
if round(angle,Draft.precision()) != 0:
if round(angle,Draft.precision()) != round(math.pi,Draft.precision()):
rotaxis = axis.cross(bvec)
profile.rotate(DraftVecUtils.tup(bpoint), DraftVecUtils.tup(rotaxis), math.degrees(angle))
# Align profile's Y axis with layouts normal vecror.
axis = profile.Placement.Rotation.multVec(FreeCAD.Vector(0,1,0))
angle = normal.getAngle(axis)
if round(angle,Draft.precision()) != 0:
if round(angle,Draft.precision()) != round(math.pi,Draft.precision()):
rotaxis = axis.cross(normal)
profile.rotate(DraftVecUtils.tup(bpoint), DraftVecUtils.tup(rotaxis), math.degrees(angle))
if obj.Rotation:
profile.rotate(DraftVecUtils.tup(bpoint), DraftVecUtils.tup(FreeCAD.Vector(bvec).normalize()), obj.Rotation)
#profile = wire.makePipeShell([profile],True,False,2) TODO buggy
Expand Down

0 comments on commit bc9a601

Please sign in to comment.