Merge pull request #4894 from steelman/arch-frame-profile-alignment
Arch: Align profile's Y with layout's normal vector
This commit is contained in:
@@ -219,12 +219,20 @@ class _Frame(ArchComponent.Component):
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user