Thanks @Moult ! There seem to be multiple ´IfcGeometricRepresentationContext´s, should I try to change all of them? I tried to move them like this, and it looks like the points are written to the IFC-file when I look at it in a text editor However in Solibri the old and new model stay in the same place.
import ifcopenshell
new_coordinate = (128930.387, 1532255.932, 3.32)
file = ifcopenshell.open("D:\MTRE-NessetH.ifc")
points = file.by_type('IfcCartesianPoint')
print("random point:")
print(points[8])
print("Location of IfcGeometricRepresentationContext:")
contexts = file.by_type('IfcGeometricRepresentationContext')
for context in contexts:
context.WorldCoordinateSystem.Location.Coordinates = new_coordinate
print("Location of IfcGeometricRepresentationSubContext:")
subcontexts = file.by_type('IfcGeometricRepresentationSubContext')
for subcontext in subcontexts:
subcontext.WorldCoordinateSystem.Location.Coordinates = new_coordinate
print(file.by_type('IfcGeometricRepresentationContext')[0].WorldCoordinateSystem.Location.Coordinates)
file.write("D:\output.ifc")
This is how I see this in my head: If I move the base point close to the geometry, the coordintes will be much closer to each other. Is this totally wrong?
