Request

Response

    Export Geometry in STEP, OBJ, and STL Formats

    In this topic, you will be able to generate derivative formats of a component (which is an autodesk Fusion model) by using componentVersion ID also known as the tipVersion ID.

    By the end of this topic, you will be able to:

    • Query the component version of the component.
    • Generate .obj, .stl, and .stp files for individual components, even for internal components.

    As a prerequisite for completing the current topic, you need to complete the following tasks:

    1. Retrieve Hubs.
    2. Retrieve Projects.
    3. Retrieve Folders.
    4. Retrieve Items.

    You will use the following query in this topic:

    TypeOperationDescription
    Query componentVersion Retrieves an object representing a version of a component.

    Step 1 - Fetch the Derivative URL

    The componentVersion query returns the Derivative object based on componentVersionId. The response includes derivative information such as id, signedUrl, and OutputFormat.

    1. In Manufacturing Data Model Explorer, enter the following query in the Query Pane:

      Query

      query GetDerivatives($componentVersionId: ID!, $derivativeInput: DerivativeInput!) {
            componentVersion(componentVersionId: $componentVersionId) {
               id
               name
               derivatives (derivativeInput: $derivativeInput) {
                     expires
                     id
                     outputFormat
                     signedUrl
                     status
               }
            }
      }
      
      Show More
    2. In the Query Variables Pane, enter the value of the componentVersionId. To know how to obtain the componentVersionId (tipRootComponentVersion), refer to Retrieve Items.
    3. In the derivativeInput argument:

      1. Set the generate field to true. This step is required because you are generating the derivative for the first time.
      2. Set the outputFormat field to STEP, OBJ, or STL in single or any multiple combination. Doing so, it will ensure that specified derivative of the component is generated. To include additional derivatives, you can specify them in the outputFormat field by separating them with commas. For example, if you want to generate “step” and “obj” as derivatives, you would add them as this: [“STEP”, “OBJ”].

      Note: Setting the generate field to true forces the system to generate a derivative only if the derivative does not exist. However, if the generate field is set to false, the system will not generate any derivative. If a new derivative is generated, the query returns a signedUrl for the new derivative. If not, it returns a signed URL for the existing derivative.

      Query Variables

      {
      "componentVersionId": "Y29tcH5WQVZNUW1sYmxrZDBtaXJwU0NYMHJ0X0wyQ35lazJXeTN5Tzg3a0ZQcll5aGlYMmdTX2FnYX44UDZOMThJU3k1aGVwZENJN01td0tO",
      "derivativeInput": {
         "generate": true,
         "outputFormat": ["STEP"]
      }
      }
      
    4. Click Play. In the response section, you can find the URL link in the signedURL of downloadable output formats mentioned in the outputFormat field. You can choose to browse these URLs to download the exported geometry.

      Response

      {
         "data": {
            "componentVersion": {
               "id": "Y29tcH5WQVZNUW1sYmxrZDBtaXJwU0NYMHJ0X0wyQ35lazJXeTN5Tzg3a0ZQcll5aGlYMmdTX2FnYX44UDZOMThJU3k1aGVwZENJN01td0tO",
               "name": "Bearing_Bracket",
               "derivatives": [
                     {
                        "expires": "1717338952652",
                        "id": "Y29tcH5WQVZNUW1sYmxrZDBtaXJwU0NYMHJ0X0wyQ35lazJXeTN5Tzg3a0ZQcll5aGlYMmdTX2FnYX44UDZOMThJU3k1aGVwZENJN01td0tO",
                        "outputFormat": "STEP",
                        "signedUrl": "https://cdn-stg.derivative.autodesk.com/dXJuOmFkc2suZm9yZ2U6bDJhZy5hc3NldDpzdGc6ZWsyV3kzeU84N2tGUHJZeWhpWDJnU19hZ2E_c25hcHNob3Q9OFA2TjE4SVN5NWhlcGRDSTdNbXdLTg/output/files/85709109-dfb5-4a10-8c3b-82b2a9b898d5/1b5776c6-ca21-4c54-bb37-cb592b948dc8.stp?Policy=eyJTdGF0ZW1lbnQiOiBbeyJSZXNvdXJjZSI6Imh0dHBzOi8vY2RuLXN0Zy5kZXJpdmF0aXZlLmF1dG9kZXNrLmNvbS9kWEp1T21Ga2Myc3VabTl5WjJVNmJESmhaeTVoYzNObGREcHpkR2M2WldzeVYza3plVTg0TjJ0R1VISlplV2hwV0RKblUxOWhaMkVfYzI1aGNITm9iM1E5T0ZBMlRqRTRTVk41TldobGNHUkRTVGROYlhkTFRnL291dHB1dC9maWxlcy84NTcwOTEwOS1kZmI1LTRhMTAtOGMzYi04MmIyYTliODk4ZDUvMWI1Nzc2YzYtY2EyMS00YzU0LWJiMzctY2I1OTJiOTQ4ZGM4LnN0cCIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTcxNzMzODk1Mn19fV19&Key-Pair-Id=APKAJVJIJZ6OEYDPJSQA&Signature=QoBuCLsNlb-3E4CFCPCJ8M8ZeWpj6Zk0pmDLrBXFMXd1VCYwSLwsdkdzum2DBwyQ4~6mCVJ-bUuj6q6YE3u3sbdAxZMFoVw~9hN~x2gsbf98MvtJTZzVZB2a9Nlm~XdKtxwoxH1kaH7OOYmCPn50s83q6m3EdwIFBEbc7FSaDCrTeRsYfD8IOSPHF2hL8XtknFJcO7U5-JGjwmsfmeWa48w3qYs-yoTWAmzKQlQgpyJnwOS5u7QvCjMmwadDZWpNLx4CydruzMaC7fjmwzzsY13uaORXakF3ChhvvSSGa9OP~F~LqocqJLe7LQdFF8fxxSVtMxXMHM5RrEPdjtd~iQ__",
                        "status": "SUCCESS"
                     }
               ]
            }
         }
      }
      
      Show More

    Note: The status mentioned in the response is the result of successful execution of the request. If the request is not successful, we recommend that you retry executing the query to get a successful response. For more information about other statuses, see DerivativeStatusEnum.