Arch: import IFC, add commen to True North calculation

This commit is contained in:
Bernd Hahnebach
2020-01-10 17:01:58 +01:00
committed by GitHub
parent 8fdb29c842
commit e44fc27505

View File

@@ -837,6 +837,11 @@ def insert(filename,docname,skip=[],only=[],root=None,preferences=None):
project = product.Decomposes[0].RelatingObject
modelRC = next((rc for rc in project.RepresentationContexts if rc.ContextType == "Model"), None)
if modelRC and modelRC.TrueNorth:
# If the y-part of TrueNorth is 0, then the x-part should be checked.
# Declination would be -90° if x >0 and +90° if x < 0
# Only if x==0 then we can not determine TrueNorth.
# But that would actually be an invalid IFC file, because the magnitude
# of the (twodimensional) direction vector for TrueNorth shall be greater than zero.
(x, y) = modelRC.TrueNorth.DirectionRatios[:2]
obj.Declination = ((math.degrees(math.atan2(y,x))-90+180)%360)-180
if (FreeCAD.GuiUp):