无法提取大文件的元数据属性
Cant extract metadata properties of large files
我有一个大约 200MB 的 RVT 文件。当我使用 forge SDK (ObjectsApi.UploadObjectAsync())
上传对象时,我多次遇到超时错误,但后来以某种方式上传了对象并提取了清单。
然而,在提取每个 sheet 的 modelViewMetadataProperties
时,它抛出了 URN is too big to extract
错误,我无法处理它。
如何使用大文件顺利上传对象和提取 modelViewMetadataProperties?
SDK 版本:Assembly Autodesk.Forge, Version=1.9.0.0
对于超时错误,这个link可能会有所帮助
关于元数据属性,文档说如果资源超过20mb
,您可以使用forceget
参数查询到true
。该选项应该在 SDK 方法中可用。
URN Metadata Get Properties
要上传大文件,我建议您使用ObjectApi#UploadChunk instead. Here is an example demonstrating how to use it: https://github.com/yiskang/ForgeResumableUploadProgressDemo/blob/master/ForgeResumableUploadProgressDemo/Program.cs#L93
关于属性问题,请按照Alex的建议添加forceget
参数并设置为true。这是它的 declaration:
/// <summary>
///
/// </summary>
/// <remarks>
/// Returns a list of properties for each object in an object tree. Properties are returned according to object ID and do not follow a hierarchical structure. The following image displays a typical list of properties for a Revit object: ![](https://developer.doc.autodesk.com/bPlouYTd/7/_images/Properties.png) To call this endpoint you need to first call the [GET {urn}/metadata](https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-metadata-GET) endpoint, which returns a list of model view (metadata) IDs for a design input model. Select a model view (metadata) ID to use when calling the Get Properties endpoint. Note that you can only get properties from a design input file that was previously translated into an SVF file.
/// </remarks>
/// <exception cref="Autodesk.Forge.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="urn">The Base64 (URL Safe) encoded design URN </param>
/// <param name="guid">Unique model view ID. Call [GET {urn}/metadata](https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-metadata-GET) to get the ID </param>
/// <param name="acceptEncoding">If specified with `gzip` or `*`, content will be compressed and returned in a GZIP format. (optional)</param>
/// <param name="objectid">Object id which you want to query properties for.</param>
/// <param name="xAdsForce">If true - force retrieve the object tree even though it failed to be retrieved or got timeout (got 404 with error message) previously.</param>
/// <param name="forceget">If true - To force get the large resource even if it exceeded the expected maximum length (20 MB).</param>
/// <returns>Metadata</returns>
/*Metadata*/
dynamic GetModelviewProperties (string urn, string guid, string acceptEncoding = null, List<int> objectIds = null, bool xAdsForce = false, bool forceget = false);
这是它的用法示例:
derivativeApi.GetModelviewProperties( urn, guid, null, null, false, true );
我有一个大约 200MB 的 RVT 文件。当我使用 forge SDK (ObjectsApi.UploadObjectAsync())
上传对象时,我多次遇到超时错误,但后来以某种方式上传了对象并提取了清单。
然而,在提取每个 sheet 的 modelViewMetadataProperties
时,它抛出了 URN is too big to extract
错误,我无法处理它。
如何使用大文件顺利上传对象和提取 modelViewMetadataProperties?
SDK 版本:Assembly Autodesk.Forge, Version=1.9.0.0
对于超时错误,这个link可能会有所帮助
关于元数据属性,文档说如果资源超过20mb
,您可以使用forceget
参数查询到true
。该选项应该在 SDK 方法中可用。
URN Metadata Get Properties
要上传大文件,我建议您使用ObjectApi#UploadChunk instead. Here is an example demonstrating how to use it: https://github.com/yiskang/ForgeResumableUploadProgressDemo/blob/master/ForgeResumableUploadProgressDemo/Program.cs#L93
关于属性问题,请按照Alex的建议添加forceget
参数并设置为true。这是它的 declaration:
/// <summary>
///
/// </summary>
/// <remarks>
/// Returns a list of properties for each object in an object tree. Properties are returned according to object ID and do not follow a hierarchical structure. The following image displays a typical list of properties for a Revit object: ![](https://developer.doc.autodesk.com/bPlouYTd/7/_images/Properties.png) To call this endpoint you need to first call the [GET {urn}/metadata](https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-metadata-GET) endpoint, which returns a list of model view (metadata) IDs for a design input model. Select a model view (metadata) ID to use when calling the Get Properties endpoint. Note that you can only get properties from a design input file that was previously translated into an SVF file.
/// </remarks>
/// <exception cref="Autodesk.Forge.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="urn">The Base64 (URL Safe) encoded design URN </param>
/// <param name="guid">Unique model view ID. Call [GET {urn}/metadata](https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-metadata-GET) to get the ID </param>
/// <param name="acceptEncoding">If specified with `gzip` or `*`, content will be compressed and returned in a GZIP format. (optional)</param>
/// <param name="objectid">Object id which you want to query properties for.</param>
/// <param name="xAdsForce">If true - force retrieve the object tree even though it failed to be retrieved or got timeout (got 404 with error message) previously.</param>
/// <param name="forceget">If true - To force get the large resource even if it exceeded the expected maximum length (20 MB).</param>
/// <returns>Metadata</returns>
/*Metadata*/
dynamic GetModelviewProperties (string urn, string guid, string acceptEncoding = null, List<int> objectIds = null, bool xAdsForce = false, bool forceget = false);
这是它的用法示例:
derivativeApi.GetModelviewProperties( urn, guid, null, null, false, true );