svf-utils
    Preparing search index...

    Class SVFReader

    Utility class for parsing & reading SVF content from Model Derivative service or from local file system.

    The class can only be instantiated using one of the two async static methods: Reader.FromFileSystem, or Reader.FromDerivativeService. After that, you can parse the entire SVF into memory using parse, or parse individual SVF objects using methods like readFragments or enumerateGeometries.

    const authProvider = new TwoLeggedAuthenticationProvider(APS_CLIENT_ID, APS_CLIENT_SECRET);
    const reader = await Reader.FromDerivativeService(MODEL_URN, VIEWABLE_GUID, authProvider);
    const scene = await reader.read(); // Read entire scene into an intermediate, in-memory representation
    console.log(scene);
    const reader = await Reader.FromFileSystem('path/to/output.svf');
    // Enumerate fragments (without building a list of all of them)
    for await (const fragment of reader.enumerateFragments()) {
    console.log(fragment);
    }
    Index

    Constructors

    • Parameters

      • svf: Buffer
      • resolve: (uri: string) => Promise<Buffer<ArrayBufferLike>>

      Returns SVFReader

    Properties

    resolve: (uri: string) => Promise<Buffer<ArrayBufferLike>>
    svf: ISvfRoot

    Methods

    • Retrieves, parses, and iterates over all SVF fragments.

      Returns AsyncIterable<IFragment>

      Async iterator over parsed fragments.

    • Retrieves, parses, and iterates over all SVF geometry metadata.

      Returns AsyncIterable<IGeometryMetadata>

      Async iterator over parsed geometry metadata.

    • Retrieves, parses, and iterates over all SVF materials.

      Returns AsyncIterable<null | IMaterial>

      Async iterator over parsed materials (or null values for unsupported material types).

    • Retrieves, parses, and iterates over all meshes, lines, or points in a specific SVF meshpack.

      Parameters

      • packNumber: number

      Returns AsyncIterable<null | IMesh | ILines | IPoints>

      Async iterator over parsed meshes, lines, or points (or null values for unsupported mesh types).

    • Parameters

      • query: { type?: AssetType; uri?: string }

      Returns undefined | ISvfManifestAsset

    • Retrieves raw binary data of a specific SVF asset.

      Parameters

      • uri: string

        Asset URI.

      Returns Promise<Buffer<ArrayBufferLike>>

      Asset content.

    • Retrieves parsed SVF manifest.

      Returns Promise<ISvfManifest>

      SVF manifest.

    • Gets the number of available mesh packs.

      Returns number

    • Retrieves parsed SVF metadata.

      Returns Promise<ISvfMetadata>

      SVF metadata.

    • Retrieves and parses the property database.

      Returns Promise<PropDbReader>

      Property database reader.

    • Finds URIs of all image assets referenced in the SVF. These can then be retrieved using getAsset.

      Returns string[]

      Image asset URIs.

    • Loads an image.

      Parameters

      • uri: string

        Image URI.

      Returns Promise<
          {
              imageData: undefined
              | Buffer<ArrayBufferLike>;
              normalizedUri: string;
          },
      >

    • Reads the entire scene and all its referenced assets into memory. In cases where a more granular control is needed (for example, when trying to control memory consumption), consider parsing the different SVF elements individually, using methods like readFragments, enumerateGeometries, etc.

      Parameters

      • Optionaloptions: IReaderOptions

        Additional reading options.

      Returns Promise<IScene>

      Intermediate, in-memory representation of the loaded scene.

    • Retrieves, parses, and collects all SVF fragments.

      Returns Promise<IFragment[]>

      List of parsed fragments.

    • Retrieves, parses, and collects all SVF geometry metadata.

      Returns Promise<IGeometryMetadata[]>

      List of parsed geometry metadata.

    • Retrieves, parses, and collects all SVF materials.

      Returns Promise<(null | IMaterial)[]>

      List of parsed materials (or null values for unsupported material types).

    • Retrieves, parses, and collects all meshes, lines, or points in a specific SVF meshpack.

      Parameters

      • packNumber: number

        Index of mesh pack file.

      Returns Promise<(null | IMesh | ILines | IPoints)[]>

      List of parsed meshes, lines, or points (or null values for unsupported mesh types).

    • Instantiates new reader for an SVF in APS Model Derivative service.

      Parameters

      • urn: string

        APS model URN.

      • guid: string

        APS viewable GUID. The viewable(s) can be found in the manifest with type: 'resource', role: 'graphics', and mime: 'application/autodesk-svf'.

      • authenticationProvider: IAuthenticationProvider

        Authentication provider for accessing the Model Derivative service.

      • Optionalregion: Region

        Optional region to be used by all APS calls.

      Returns Promise<SVFReader>

      Reader for the provided SVF.

    • Instantiates new reader for an SVF on local file system.

      Parameters

      • filepath: string

        Path to the *.svf file.

      Returns Promise<SVFReader>

      Reader for the provided SVF.