【问题标题】:Forge API to translate InventorParams of {URL}/workitems into supported format like svf,dwgForge API 将 {URL}/workitems 的 InventorParams 转换为支持的格式,如 svf、dwg
【发布时间】:2022-02-19 17:49:16
【问题描述】:

不知道如何将模型 InventorParams.url 转换为任何受支持的格式,例如 SVF、DWG、Obj

通过 axios 在端点 /workitems 上发送数据:{InventorParams.url}


axios({
        method: 'POST',
        url: 'https://developer.api.autodesk.com/da/us-east/v3/workitems',
        headers: {
            'Authorization': 'Bearer ******',
            'content-type': 'application/json'
        },
        data: JSON.stringify({
        activityId: 'BAsBRLiyiaHR1X9eYiAI4ATPmdcuZ5Pf.NamiliftActivity+beta',
        arguments: {
          InventorDoc: {
             url: 'https://developer.api.autodesk.com/oss/v2/signedresources/1a2ac1d9-a8af-4aa2-b9d1-8b0fde21bcf3?region=US',
             pathInZip: 'MasterAssembly.iam'
          },
          InventorParams: {
            url: 'data:application/json,{"ProjectNumber":"12345","ProjectName":"8000-2016","PreparedBy":"Nami","DrawingNumber":"Nami","CommissionNumber":"","ElevatorDesignation":"","ElevatorNumber":"","Logo":"NamiLift","LanguageOptions":"ENG","Standard":"PL400","NumberOfFloor":2,"LengthOfCar":2000,"WidthOfCar":1100,"Pits":true,"PitHeight":50,"ZoneSectionStart":239,"HeightAboveTopElevator":0,"ElectricBoxSide":"a","ElectricBoxFloorNo":"0","ElectricBoxDefault":false,"OuterRoof":false,"OuterRoofSide":"A","WindowsSectionA":"0-0","WindowsSectionB":"0-5000","WindowsSectionC":"0-0","WindowsSectionD":"0-0","DefaultDoorSize":false,"Colorelevator":"RAL 9001","Colordoor":"RAL 9001","Safelinemx2":false,"Safelinemx2gsm":false,"Schoolcontrolassa":false,"Schoolcontrol":false,"Intercom":false,"Callsend":false,"Firealarmdrive":false,"Folderseat":false,"Floorvoiceannouncement":false,"Lsfcable":false,"Telephone":false,"Keyswitch":false,"Ups":false,"Comments":"-","LiftHeightLevel0":0,"DoorSideLevel0":"A","TypeOfDoorLevel0":"A1","DoorHingeLevel0":"Right","DoorSizeLevel0":900,"DoorHeightLevel0":2000,"DoorCloserLevel0":true,"CanopyLevel0":true,"CallBoxLevel0":true,"LiftHeightLevel1":5000,"DoorSideLevel1":"A","TypeOfDoorLevel1":"A1","DoorHingeLevel1":"Right","DoorSizeLevel1":900,"DoorHeightLevel1":2000,"DoorCloserLevel1":false,"CanopyLevel1":false,"CallBoxLevel1":false}',
            'OutputPDF': {
                    'url': fileName.resultZipUrl,
                    'headers': {
                        'Authorization': 'Bearer ' + values.access_token,
                        'Content-type': 'application/octet-stream'
                    },
                    'verb': 'put'
            },
            onComplete: 'onComplete': {
                    'verb': 'post',
                    'url': config.credentials.callback_url +'/api/forge/datamanagement/signanddownload'
            }
       }
    }
})

工作项输出

{"status":"pending","stats":{"timeQueued":"2022-02-09T03:31:43.525012Z"},"id":"27fa82758b794111a91025ed69da6fec"}

这是该 InventorParams 的 workitem/:id 响应

这是我从 workitem/:id 响应的 reportUrl 获得的 txt 文件


从 report.txt 文件 oss/v2/signedresources 获取包含此内容的 ZIP(InventorDoc.pathInZip 名称)

【问题讨论】:

    标签: node.js api autodesk-forge autodesk-model-derivative autodesk-designautomation


    【解决方案1】:

    您粘贴的 activity 似乎只是为给定 Inventor 模型的绘图创建 PDF - 请参阅 OutputPDF 输出参数。

    InventorParams 只是为 工作项 提供一个 json 文件,您的 app bundle 中的代码可以读取该文件,并使用其中的值通过 Inventor API 相应地修改模型。

    为了更好地了解 输入和输出参数,包括 json 文件是如何被 app bundle 使用的,请查看在这里的教程中: https://learnforge.autodesk.io/#/tutorials/modifymodels

    【讨论】:

    • 我在尝试 /modelderivative/v2/designdata/jobs 时遇到此问题 指定的 client_id 无权访问 api 产品
    • 我在 .......@POST /bucket/:bucketKey/object/:objectKey 中为 .svf 、 .dwg 创建了 object signedUrl 位置,用于 .svf 、 .dwg 、 .zip。 .....但是我在.dwg、.svf和.zip的下载中也得到了空文件夹,其他下载也很好,比如pdf和InventorDoc.pathInZip
    • 您应该仔细检查您正在使用其客户端 ID 的 Forge 应用程序是否启用了模型衍生 API - 请参阅此处的最后一节 forge.autodesk.com/blog/401-unauthorized-403-forbidden
    猜你喜欢
    • 2017-07-02
    • 2021-02-05
    • 2017-06-30
    • 2021-12-26
    • 2020-12-15
    • 2018-11-07
    • 2021-11-06
    • 2021-01-05
    • 1970-01-01
    相关资源
    最近更新 更多