You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何从Autodesk Platform Services映射data_type枚举值至字符串类型?

解决方案

1. 官方枚举值与字符串类型映射表

Autodesk Platform Services中data_type字段的枚举数字对应以下字符串类型,可直接使用该映射关系:

  • 0: undefined
  • 1: boolean
  • 2: integer
  • 3: double
  • 4: string
  • 5: date
  • 6: guid
  • 7: vector
  • 8: point
  • 9: matrix
  • 10: object
  • 11: enum
  • 12: blob

2. 实现转换逻辑

目前没有专门的API提供该枚举转换功能,需在代码中手动实现映射逻辑。以下是JavaScript示例:

const dataTypeMapping = {
  0: 'undefined',
  1: 'boolean',
  2: 'integer',
  3: 'double',
  4: 'string',
  5: 'date',
  6: 'guid',
  7: 'vector',
  8: 'point',
  9: 'matrix',
  10: 'object',
  11: 'enum',
  12: 'blob'
};

// 针对你提供的示例参数转换
const elevationParam = {
  "id": 33,
  "name": "Elevation",
  "category": "Constraints",
  "data_type": 3,
  "data_type_context": "autodesk.unit.unit:millimeters-1.0.1",
  "description": null,
  "display_name": "Elevation",
  "flags": 0,
  "display_precision": 1,
  "forge_parameter": null
};

const dataTypeStr = dataTypeMapping[elevationParam.data_type]; // 结果为 'double'

内容的提问来源于stack exchange,提问作者chuongmep

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 11:52:11