Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
708 B
Python
Raw Permalink Normal View History

2025-12-19 18:53:04 +05:00
import boto3
2023-06-10 22:49:54 +02:00
import ifcopenshell
import ifcopenshell.util.element
2023-06-11 10:18:10 +02:00
s3 = boto3.client('s3')
2023-06-10 22:49:54 +02:00
2023-06-11 10:18:10 +02:00
def extract_wall_psets_handler(event, context):
2023-06-10 22:49:54 +02:00
print("Hello from lambda")
print("Event: {}".format(event))
print("Context: {}".format(context))
filename = event['body']['filename']
2023-06-11 10:18:10 +02:00
s3.download_file('my_ifc_files_bucket', filename, f'/tmp/{filename}')
2023-06-10 22:49:54 +02:00
ifc_file = ifcopenshell.open(f'/tmp/{filename}')
walls = ifc_file.by_type('IfcWall')
psets = []
for wall in walls:
wall_data = ifcopenshell.util.element.get_psets(wall)
wall_data['id'] = wall.GlobalId
psets.append(wall_data)
return {
'statusCode': 200,
'body': psets
}