mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
Covetool now reads north angle from project geolocation
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import bpy
|
import bpy
|
||||||
import json
|
import json
|
||||||
|
from math import degrees, atan2
|
||||||
|
|
||||||
from .api import Api
|
from .api import Api
|
||||||
|
|
||||||
@@ -81,7 +82,7 @@ class RunAnalysis(bpy.types.Operator):
|
|||||||
data = {
|
data = {
|
||||||
'run': bpy.context.scene.CoveToolProperties.projects[bpy.context.scene.CoveToolProperties.active_project_index].run_set,
|
'run': bpy.context.scene.CoveToolProperties.projects[bpy.context.scene.CoveToolProperties.active_project_index].run_set,
|
||||||
'source': 'BlenderBIM',
|
'source': 'BlenderBIM',
|
||||||
'rotation_angle': 0,
|
'rotation_angle': self.get_rotation_angle(),
|
||||||
**self.inputs
|
**self.inputs
|
||||||
}
|
}
|
||||||
result = api.post_request('run-values', data)
|
result = api.post_request('run-values', data)
|
||||||
@@ -89,6 +90,18 @@ class RunAnalysis(bpy.types.Operator):
|
|||||||
covetool_results.write(json.dumps(result, indent=4))
|
covetool_results.write(json.dumps(result, indent=4))
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
def get_rotation_angle(self):
|
||||||
|
if not bpy.context.scene.BIMProperties.has_georeferencing \
|
||||||
|
or not bpy.context.scene.MapConversion.x_axis_abscissa \
|
||||||
|
or not bpy.context.scene.MapConversion.x_axis_ordinate:
|
||||||
|
return 0
|
||||||
|
rotation = -1 * degrees(atan2(
|
||||||
|
float(bpy.context.scene.MapConversion.x_axis_ordinate),
|
||||||
|
float(bpy.context.scene.MapConversion.x_axis_abscissa)))
|
||||||
|
if rotation < 0:
|
||||||
|
rotation = 360 - rotation
|
||||||
|
return rotation
|
||||||
|
|
||||||
def parse_objects(self):
|
def parse_objects(self):
|
||||||
for obj in bpy.context.visible_objects:
|
for obj in bpy.context.visible_objects:
|
||||||
covetool_category = self.get_covetool_category(obj)
|
covetool_category = self.get_covetool_category(obj)
|
||||||
|
|||||||
Reference in New Issue
Block a user