一种可能的解决方法是使用Autodesk Forge的Design Automation API,将链接文件打开并将房间几何信息导出为IFC或其他支持文件格式,然后在B360中导入该文件并将其用作房间几何的来源。
以下是一个示例,使用Design Automation API将链接文件中的房间几何导出为IFC文件:
import requests
import zipfile
# Your Forge App credentials
client_id = 'YOUR_CLIENT_ID'
client_secret = 'YOUR_CLIENT_SECRET'
# Your Autodesk account credentials
username = 'YOUR_USERNAME'
password = 'YOUR_PASSWORD'
# The URI of the linked file to extract geometry from
linked_file_uri = 'https://developer.api.autodesk.com/modelderivative/v2/designdata/:urn/manifest'
# Authenticate with Forge
auth_url = 'https://developer.api.autodesk.com/authentication/v1/authenticate'
payload = {
'client_id': client_id,
'client_secret': client_secret,
'grant_type': 'password',
'username': username,
'password': password,
'scope': 'data:read data:write bucket:create'
}
response = requests.post(auth_url, data=payload)
access_token = response.json()['access_token']
# Use Design Automation API to extract geometry from linked file
da_url = 'https://developer.api.autodesk.com/da/us-east/v3/workitems'
da_payload = {
'activityId': 'ExportIFC',
'arguments': {
'linkedFileUri': linked_file_uri,
'outputFormat': 'IFC'
}
}
da_headers = {
'Authorization': 'Bearer ' + access_token,
'Content-Type': 'application/json'
}
da_response = requests.post(da_url, json=da_payload, headers=da_headers)
workitem_id = da_response.json()['id']
# Wait for Design Automation to finish and retrieve the IFC file
while True:
workitem_url = da_url + '/' + workitem_id
workitem_response = requests.get(workitem_url, headers=da_headers)
workitem_status = workitem_response.json()['status']
if workitem_status == '