Some test text!

Loading...
Guides
API

WebViewer BIM APIs

WebViewer BIM Server APIs

GET /v1/convert/3d/{format}

Converts a 3d asset into the specified format

ArgumentDescription
{format}Specific format that can be vsf and vsfx to convert a 3d Asset to a streaming format for web viewing or property to extract property meta-data from a 3d Asset

Request Headers

uri: url to your 3D asset
ext: ifc
local: true
ArgumentDescription
uriThe url of the ifc doc to get the specific format from
extThe extension of the source document if it cannot be determined from the URL
localIf set to true, expects URI to be a locally uploaded doc

Response Body

A JSON document with the following structure:

{
  "jid": "The job id of the result doc"
}

Status Code

Status CodeDescription
202If job was accepted

Example

curl -X GET http://localhost:8085/v1/convert/3d/vsf -H "uri: url_to_your_3d_asset"

GET /v1/test

Tests if the server queue is functioning

Response Body

A JSON document with the following structure:

{
  "status": "sent"
}

Example

curl -X GET http://localhost:8085/v1/test

GET /v1/health

Checks server health

Response Body

A JSON document with the following structure:

{
  "status": "UP"
}

Example

curl -X GET http://localhost:8085/v1/health

POST /v1/util/upload

Uploads a file for usage with other jobs

Request Body

Expects multipart form data with Filename containing filename and data within file

Response Body

A JSON document with the following structure:

{
  "src": "source-id"
}

Example

curl -X POST localhost:8085/v1/util/upload -v --form file='@ABSOLUTE_PATH/PlayersTheatre.ifc'

GET /v1/util/upload/status

Checks if a uploaded file exists

Request Headers

src: local://d41d8cd98f00b204e9800998ecf8427e.ifc
ArgumentDescription
srcExpects src header containing the key of the local upload ie local://12345sd.vsf

Status Code

Status CodeDescription
200File was found
404File was not found

Example

curl -I -X GET localhost:8085/v1/util/upload/status -H "src: local://d41d8cd98f00b204e9800998ecf8427e.ifc"

GET /v1/results/{job-id}

Request result for job

ArgumentDescription
{job-id}the job id of the result doc

Status Code

Status CodeDescription
200Job is completed, returning result
102Processing, the job is still executing. Will eventually return one of the above status codes
404Not found, no job was found for requested result
408
  • Requested job has failed since the execution took longer than the job timeout and no result exists
  • Should keep retrying for the result if you get a 408
  • Set by request_timeout server timeout, defaults to 10s
460Requested job has failed during execution and no result exists
461Requested job has failed since the execution took longer than the job timeout and no result exists

Example

curl -X GET http://localhost:8085/v1/results/{jid} --output out.vsf

WebViewer BIM Client APIs

initializeBimViewer

Construct initialized 3D viewer.

Params

instance

WebViewer instance that is available after initializing.

serverURL

URL of WebViewer BIM server.

options

An object containing options for the initializeBimViewer call. The following are possible arguments:

license

WebViewer BIM license key.

dataSchema

Options to define schema of the properties panel.

Example

import  WebViewer  from  '@pdftron/webviewer';
import { initializeBimViewer } from '@pdftron/webviewer-bim-client'

WebViewer({
  path: '/webviewer/lib',
}, document.getElementById('viewer')).then(instance  => {

  const  license = `---- Insert commercial license key here after purchase ----`;
  const  serverURL = `---- Insert server URL after setup ----`;
  const  options = {
    license: license,
    dataSchema: {
      headerName: 'Name',
      defaultValues: {
        Description: 'Description',
        GlobalID: 'GlobalId',
        Handle: 'handle',
        EmptyRow1: 'EmptyRow1',
      },
      groups: {
        Dimensions: {
          Length: 'Length',
          Width: 'Width',
          Height: 'Height',
          EmptyRow2: 'EmptyRow2',
          GrossFootprintArea: 'GrossFootprintArea',
          GrossSideArea: 'GrossSideArea',
          GrossVolume: 'GrossVolume',
        }
        EmptyGroupTest: {
            ObjectType: 'Lions',
            EmptyRow3: 'Tigers',
            ObjectPlacement: 'Bears',
        },
      },
      groupOrder: ['EmptyGroupTest', 'Dimensions'],
      removeEmptyRows: true,
      removeEmptyGroups: true,
      createMiscGroup: true,
    }
  };  

  const WebViewerBIM = await initializeBimViewer(instance, serverURL, options);
}

Returns

a promise that resolves to an object containing the functions needed to load models in WebViewer.

load3dAsset

Load an IFC model.

Params

pathToAsset

URL or path to IFC model.

Example

const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.File.load3dAsset(
  "Add URL to your 3D asset here"
);

Returns

N/A

unmountBimViewer

Unmount the Bim Viewer

Params

instance

WebViewer instance that is available after initializing.

Example

import  Webviewer  from  '@pdftron/webviewer';
import { initializeBimViewer, unmountBimViewer } from '@pdftron/webviewer-bim-client'

Webviewer({
  path: '/webviewer/lib',
}, document.getElementById('viewer')).then(instance  => {
  const  license = `---- Insert commercial license key here after purchase ----`;
  const  serverURL = `---- Insert server URL after setup ----`;
  const  options = {
    license: license,
  }

  const WebViewerBIM = await initializeBimViewer(instance, serverURL, options);
  webviewerBIM.File.load3dAsset("Add URL to your 3D asset here");

  // Call unmountBimViewer when you're ready to unmount.
  // unmountBimViewer(instance);
}

Returns

N/A

enableSSAO

Enable screen-space ambient occlusion for the viewer.

Example

const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.Viewer.enableSSAO();

Returns

N/A

disableSSAO

Disable screen-space ambient occlusion for the viewer.

Example

const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.Viewer.disableSSAO();

Returns

N/A

setSSAOOptions

Adjust screen-space ambient occlusion for the viewer.

Example

const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.Viewer.setSSAOOptions({
 // example parameters:
 isDynamicRadius: true,
 radius: 1,
 loops: 64,
 blurRadius: 2,
 power: 1.4,
})

Returns

N/A

enableAntiAliasing

Enable anti-aliasing for the viewer.

Example

const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.Viewer.enableAntiAliasing();

Returns

N/A

disableAntiAliasing

Disable anti-aliasing for the viewer.

Example

const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.Viewer.disableAntiAliasing();

Returns

N/A

setCameraSensitivity

Sets the sensitivity for Orbit/Pan tool

Example

const cameraTools = {
  orbit: 'Orbit3D',
  pan: 'Pan3D',
  walk: 'Walk',
};
const panTool = instance.Core.DocumentViewer.getTool(cameraTools.pan);
panTool.setCameraSensitivity(10);

Returns

N/A

getCameraSensitivity

Gets the Orbit/Pan tool's sensitivity

Example

const cameraTools = {
  orbit: 'Orbit3D',
  pan: 'Pan3D',
  walk: 'Walk',
};
const orbitTool = instance.Core.DocumentViewer.getTool(cameraTools.orbit);
orbitTool.getCameraSensitivity();

Returns

Number

Get the answers you need: Support

Upcoming Webinar: PDFTron SDK Tech Review | Nov 29, 2022 at 2 pm ET

PDFTron SDK

The Platform

NEW

© 2022 PDFTron Systems Inc. All rights reserved.

Privacy

Terms of Use