Search code examples
node.jsapiautodesk-forgeautodesk-model-derivativeautodesk-designautomation

Forge API to translate InventorParams of {URL}/workitems into supported format like svf,dwg


Didn't get idea to translate the model InventorParams.url to any supported formats like SVF,DWG,Obj

sending data:{InventorParams.url} on endpoint /workitems by axios


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'
            }
       }
    }
})

WorkItem Output

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

This is the workitem/:id response for that InventorParams

workitem/:id

This is the txt file which i am getting from reportUrl of workitem/:id response

report.txt


From report.txt file oss/v2/signedresources GET ZIP (InventorDoc.pathInZip name) with this content

input: verb -"GET" oss/v2/signedresources


Solution

  • The activity you pasted seems to only be about creating a PDF for the drawing of a given Inventor model - see OutputPDF output parameter.

    InventorParams simply provides a json file for the work item that the code in your app bundle can read, and use the values in it to modify the model accordingly using the Inventor API.

    To better understand how the input and output parameters, inc the json file are used exactly by the app bundle, please have a look at the tutorial here: https://learnforge.autodesk.io/#/tutorials/modifymodels