Error while translating file - Unrecoverable exit code from extractor: -1073741829

Viewed 42

I am trying to translate a file ifc to svf. I'm making the upload in multi parts and seems to be correct. This is the code Im using to translate

public async convertFileToSvfFormat(forgeApiAccessToken: string, urn: string): Promise<any> {
    const forgeFileConversionResponse = await firstValueFrom(
        this.forgeHttpService.post(
            `modelderivative/v2/designdata/job`,
            JSON.stringify({
                input: {
                    urn,
                },
                output: {
                    formats: [
                        {
                            type: this.DEFAULT_FORGE_FORMAT_TYPE, // 'svf'
                            views: this.DEFAULT_FORGE_FORMAT_VIEWS, // ["2d", "3d"]
                        },
                    ],
                },
            }),

            {
                headers: {
                    "Authorization": `Bearer ${forgeApiAccessToken}`,
                    "Content-Type": "application/json",
                },
            },
        ),
    )

    return forgeFileConversionResponse
}

But the manifest endpoint after a while throws this:

{
    "urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bnY5a2cyZnB5bTFsdDQ5MDkxdzdobXVsbzlha3RldXdfdHV0b3JpYWxfYnVja2V0L2MyMWE2MzcwZTMwNzJmM2IwZTA3OWE5MzRjYWM4YTZlLmlmYw",
    "derivatives": [
        {
            "hasThumbnail": "false",
            "name": "c21a6370e3072f3b0e079a934cac8a6e.ifc",
            "progress": "complete",
            "messages": [
                {
                    "type": "error",
                    "message": "Unrecoverable exit code from extractor: -1073741829",
                    "code": "TranslationWorker-InternalFailure"
                }
            ],
            "outputType": "svf",
            "status": "failed"
        }
    ],
    "hasThumbnail": "false",
    "progress": "complete",
    "type": "manifest",
    "region": "US",
    "version": "1.0",
    "status": "failed"
}

Am I missing something? How can I know which is the error?

Thanks!

-edit

Here is the method in which Im uploading the files.

public async uploadFileToForgeBucket(forgeApiAccessToken: string, file: Express.Multer.File): Promise<void> {
    // When de-hardcoding the Forge acocunt to assign accounts to each user, de-hardcode this value here
    const bucketKey = this.getBucketKey(this.hardcodedForgeClientId)

    const path = join(__dirname, "../../../../upload/") + file.filename

    const parts = Math.floor(this.calculateFileChuncks(path))

    const signedUrls = await this.getS3SignedUrl(forgeApiAccessToken, file.filename, parts)

    parts > 1 && splitFileInChunks(path, parts)

    console.log(`Number of parts: ${parts}`)

    const timerId = setTimeout(async () => {
        const fileName = parts > 1 ? `${file.filename}.sf-part${parts}` : file.filename
        const exists = existsSync(`./upload/${fileName}`)
        console.log(exists && "Last chunk exists and read...")
        if (exists) {
            console.log("Starting upload...")
            for (let i = 0; i < signedUrls.urls.length; i++) {
                const currentUrl = signedUrls.urls[i]
                let part: string
                if (parts > 9) {
                    part = (i + 1).toString().length === 1 ? `0${i + 1}` : (i + 1).toString()
                } else {
                    part = (i + 1).toString()
                }
                const fileName = parts > 1 ? path + `.sf-part${part}` : path

                const stream = readFileSync(fileName)

                await firstValueFrom(
                    this.forgeHttpService.put(
                        currentUrl,
                        { data: stream },
                        {
                            headers: {
                                "Content-Type": "application/octet-stream",
                                "Content-Length": stream.length,
                                // "Content-Range": `bytes 0-${stream.length}`,
                                "Content-Disposition": `${file.filename}.sf-part${part}`,
                            },
                        },
                    ),
                )
                const percentage = ((i + 1) / parts) * 100
                console.log(`Uploading file... ${percentage.toFixed(2)}%`)
            }
            console.log("Upload complete. Processing...")
            console.log("Re-unifying file:", `${file.filename}`)
            const result = await firstValueFrom(
                this.forgeHttpService.post(
                    `https://developer.api.autodesk.com/oss/v2/buckets/${bucketKey}/objects/${file.filename}/signeds3upload`,

                    {
                        uploadKey: signedUrls.uploadKey,
                    },
                    {
                        headers: {
                            "Authorization": `Bearer ${forgeApiAccessToken}`,
                            "Content-Type": "application/json",
                        },
                    },
                ),
            )
            clearInterval(timerId)
            console.log(result.data)
            const toBase64 = stringToBase64(result.data.objectId)
            console.log(toBase64)
            const translation = await this.convertFileToSvfFormat(forgeApiAccessToken, toBase64)
            console.log(translation)
            // console.log(translation, "trans")
        }
    }, 2000)

The result for this is:

  data: {
    result: 'success',
    urn: 'dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6eG02ZjIxbWUxMHNxbTc4NmlhY3c2cTV6bjUxeWdpZmhfdHV0b3JpYWxfYnVja2V0L3JhY19iYXNpY19zYW1wbGVfcHJvamVjdF92My5pZmM',
    acceptedJobs: { output: [Object] }
  }

After that I call the translation method. Which ends up failing with the error code I copied before.

2 Answers

What is your IFC schema version, IFC2x3 or IFC4?

For large IFC files and IFC4, I would advise you to use the v3 IFC conversion method. So here is the modification to your code. You can find the comparison table here: https://forge.autodesk.com/blog/faq-and-tips-ifc-translation-model-derivative-api

public async convertFileToSvfFormat(forgeApiAccessToken: string, urn: string): Promise<any> {
    const forgeFileConversionResponse = await firstValueFrom(
        this.forgeHttpService.post(
            `modelderivative/v2/designdata/job`,
            JSON.stringify({
                input: {
                    urn,
                },
                output: {
                    formats: [
                        {
                            type: this.DEFAULT_FORGE_FORMAT_TYPE, // 'svf'
                            views: this.DEFAULT_FORGE_FORMAT_VIEWS, // ["3d"],
                            advanced: {
                                conversionMethod: 'v3'
                            }
                        },
                    ],
                },
            }),

            {
                headers: {
                    "Authorization": `Bearer ${forgeApiAccessToken}`,
                    "Content-Type": "application/json",
                    "x-ads-force": true,
                },
            },
        ),
    )

    return forgeFileConversionResponse
}

Example manifest of using v3. The IFC Loader should be 3.

{
    "urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXlidWNrZXQvcmFjX2Jhc2ljX3NhbXBsZV9wcm9qZWN0X3YzLmlmYw",
    "derivatives": [
        {
            "hasThumbnail": "true",
            "children": [
                {
                    "guid": "d16f9899-ea0f-b40e-73fa-876f51b1352a",
                    "type": "geometry",
                    "role": "3d",
                    "name": "rac_basic_sample_project_v3.ifc",
                    "status": "success",
                    "viewableID": "rac_basic_sample_project_v3.ifc",
                    "hasThumbnail": "true",
                    "progress": "complete",
                    "useAsDefault": true,
                    "children": [
                        {
                            "guid": "72890b2b-0c4e-4e60-a168-3764b2c9922a",
                            "type": "view",
                            "role": "3d",
                            "name": "Default",
                            "status": "success",
                            "hasThumbnail": "true",
                            "camera": [
                                -11528.884765625,
                                -183404.859375,
                                5052.05517578125,
                                -11528.884765625,
                                -29944.34375,
                                5052.05517578125,
                                0,
                                -2.220446049250313e-16,
                                1,
                                1,
                                0.785398006439209,
                                1,
                                0
                            ],
                            "useAsDefault": true,
                            "children": [
                                {
                                    "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXlidWNrZXQvcmFjX2Jhc2ljX3NhbXBsZV9wcm9qZWN0X3YzLmlmYw/output/0/0_100.png",
                                    "role": "thumbnail",
                                    "mime": "image/png",
                                    "guid": "92474384-5af9-478e-b98a-be02e5005eab",
                                    "type": "resource",
                                    "resolution": [
                                        100,
                                        100
                                    ]
                                },
                                {
                                    "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXlidWNrZXQvcmFjX2Jhc2ljX3NhbXBsZV9wcm9qZWN0X3YzLmlmYw/output/0/0_200.png",
                                    "role": "thumbnail",
                                    "mime": "image/png",
                                    "guid": "5567e9a6-2de2-46a3-a818-06cf1a8b916c",
                                    "type": "resource",
                                    "resolution": [
                                        200,
                                        200
                                    ]
                                },
                                {
                                    "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXlidWNrZXQvcmFjX2Jhc2ljX3NhbXBsZV9wcm9qZWN0X3YzLmlmYw/output/0/0_400.png",
                                    "role": "thumbnail",
                                    "mime": "image/png",
                                    "guid": "02792503-61de-4880-b5bd-ffe17f06c9f8",
                                    "type": "resource",
                                    "resolution": [
                                        400,
                                        400
                                    ]
                                }
                            ]
                        },
                        {
                            "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXlidWNrZXQvcmFjX2Jhc2ljX3NhbXBsZV9wcm9qZWN0X3YzLmlmYw/output/0/0.svf",
                            "role": "graphics",
                            "mime": "application/autodesk-svf",
                            "guid": "a65292fb-4676-47a2-a632-69b3bd01af30",
                            "type": "resource"
                        }
                    ]
                },
                {
                    "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXlidWNrZXQvcmFjX2Jhc2ljX3NhbXBsZV9wcm9qZWN0X3YzLmlmYw/output/0/AECModelData.json",
                    "role": "Autodesk.AEC.ModelData",
                    "mime": "application/json",
                    "guid": "b13160e3-df69-4e43-a0e9-fd7c0b2e8d3a",
                    "type": "resource",
                    "status": "success"
                },
                {
                    "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXlidWNrZXQvcmFjX2Jhc2ljX3NhbXBsZV9wcm9qZWN0X3YzLmlmYw/output/0/properties.db",
                    "role": "Autodesk.CloudPlatform.PropertyDatabase",
                    "mime": "application/autodesk-db",
                    "guid": "06aac8bb-14c7-4775-9d3d-059a26b620ed",
                    "type": "resource",
                    "status": "success"
                }
            ],
            "name": "rac_basic_sample_project_v3.ifc",
            "progress": "complete",
            "outputType": "svf",
            "properties": {
                "Document Information": {
                    "Navisworks File Creator": "LcNwcLoaderPlugin:lcldifc",
                    "IFC Application Name": "Autodesk Revit 2022 (ENU)",
                    "IFC Application Version": "2022",
                    "IFC Organization": "Autodesk",
                    "IFC Schema": "IFC2X3",
                    "IFC Loader": "3"
                }
            },
            "status": "success"
        }
    ],
    "hasThumbnail": "true",
    "progress": "complete",
    "type": "manifest",
    "region": "US",
    "version": "1.0",
    "status": "success"
}

After some days trying I found the problem. I leave it here in case someone else has the same error and after trying all the things above couldn't solve it. Im my case was simple as creating a new bucket. After doing so worked. Maybe the one with which I was trying was expired or something I don't know.

Related