mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Fix errors appending assets when projects are using georeferencing #5110
This commit is contained in:
@@ -17,11 +17,14 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.geometry
|
||||
import ifcopenshell.api.type
|
||||
import ifcopenshell.api.project
|
||||
import ifcopenshell.api.context
|
||||
import ifcopenshell.api.owner.settings
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.geolocation
|
||||
import ifcopenshell.util.placement
|
||||
from typing import Optional, Any, Union
|
||||
|
||||
|
||||
@@ -206,6 +209,13 @@ class Usecase:
|
||||
element = self.add_element(self.settings["element"])
|
||||
self.reuse_existing_contexts()
|
||||
|
||||
placement = element.ObjectPlacement
|
||||
if placement is not None:
|
||||
matrix = ifcopenshell.util.placement.get_local_placement(placement)
|
||||
matrix = ifcopenshell.util.geolocation.auto_local2global(self.settings["library"], matrix)
|
||||
matrix = ifcopenshell.util.geolocation.auto_global2local(self.file, matrix)
|
||||
ifcopenshell.api.geometry.edit_object_placement(self.file, element, matrix, is_si=False)
|
||||
|
||||
element_type = ifcopenshell.util.element.get_type(self.settings["element"])
|
||||
if element_type:
|
||||
ifcopenshell.api.owner.settings.factory_reset()
|
||||
|
||||
Reference in New Issue
Block a user