简体   繁体   中英

Upload Revit model files to BIM360 via API and keep them linked

I have two Revit model files, A and B, where B is linked into A. I want to upload the files to BIM360 Docs via the Autodesk.Forge API and keep them linked, so I can see the combined model in the Forge Model viewer when I subsequently view model A.

I have the two files in a zip file, but from what I understand, I shouldn't upload the zip file, but rather upload A and B separately, then create a relationship between them.

I can upload the files without problems, and I've then tried to link them via this code (using the NON-encoded version ids for A and B):

public async Task SetLinkedFileRelationship(string projectId, string versionId, string linkedVersionId)
{
    BaseAttributesExtensionObject baseAttribute = new BaseAttributesExtensionObject("auxiliary:autodesk.core:Attachment", "1.0");
    CreateRefDataMeta meta = new CreateRefDataMeta(baseAttribute);
    CreateRefData createRefData = new CreateRefData(CreateRefData.TypeEnum.Versions, linkedVersionId, meta);
    CreateRef createRef = new CreateRef(new JsonApiVersionJsonapi(JsonApiVersionJsonapi.VersionEnum._0), createRefData);
    VersionsApi versionsApi = new VersionsApi { Configuration = { AccessToken = _token.AccessToken } };
    await versionsApi.PostVersionRelationshipsRefAsync(projectId, versionId, createRef);
}

...which produces this response:

status:  400
code:    FUNCTION_NOT_SUPPORTED
detail:  BIM360 currently does not support the creation of refs.

So apparently I can't create the link between A and B like this. Is there another way to accomplish what I want, or is this currently just not possible in BIM360? I know you can do it via the BIM360 Docs web page (using the Upload file -> Linked Files button), but is it possible when I upload the model files via the API? If so, what is the recipe?

Please keep in mind that my question is for uploading to BIM360 Docs - using the Autodesk.Forge API (v2). I'm aware of this post: BIM360 Docs: Setting up external references between files (Upload Linked Files) , but that is targeted at manually composing requests. I'd like to be able to use the v2 API.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM