SVF.PropDbReader 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package SVF.PropDbReader --version 1.0.4
                    
NuGet\Install-Package SVF.PropDbReader -Version 1.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SVF.PropDbReader" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SVF.PropDbReader" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="SVF.PropDbReader" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SVF.PropDbReader --version 1.0.4
                    
#r "nuget: SVF.PropDbReader, 1.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SVF.PropDbReader@1.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SVF.PropDbReader&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=SVF.PropDbReader&version=1.0.4
                    
Install as a Cake Tool

SVF-PropDbReader

Overview

SVF-PropDbReader is a .NET library for reading and extracting property database (PropDb) information from SVF (Simple Vector Format) files. SVF is the proprietary 3D model format used by Autodesk in the Autodesk Platform Services (APS) Viewer (formerly Forge Viewer). This library enables developers to programmatically access and analyze property data embedded in SVF models, which is essential for BIM, CAD, and digital twin applications.

SVF files are typically generated by Autodesk tools and are used to stream 3D models efficiently in web applications. The PropDb is a key component of SVF, storing metadata and properties for all model elements.

Features

  • Read and parse PropDb from SVF packages
  • Extract properties for model elements (e.g., name, category, custom attributes)
  • Support for manifest and property database structure
  • Download and manage SVF/PropDb resources
  • Designed for integration with APS/Forge workflows

Installation

Add the NuGet package to your project:

# Using .NET CLI
 dotnet add package SVF.PropDbReader

# Or using Package Manager
 Install-Package SVF.PropDbReader

Usage

1. Reading Properties from a Local Property Database (.sdb)

using SVF.PropDbReader;

string dbPath = @"C:\path\to\your\properties.sdb";

using var reader = new PropDbReader(dbPath);

// Get properties for a specific dbId (e.g., 1)
var props = await reader.GetPropertiesForDbIdAsync(1);

foreach (var prop in props)
{
    Console.WriteLine($"{prop.Key}: {prop.Value}");
}

2. Downloading and Reading Properties from Autodesk APS (by URN)

using SVF.PropDbReader;

string accessToken = "<YOUR_ACCESS_TOKEN>";
string urn = "<YOUR_MODEL_URN>";

using var reader = new PropDbReader(accessToken, urn);

// Get properties for a specific dbId (e.g., 1)
var props = await reader.GetPropertiesForDbIdAsync(1);

foreach (var prop in props)
{
    Console.WriteLine($"{prop.Key}: {prop.Value}");
}

API Reference

PropDbReader

Constructors
  • PropDbReader(string dbPath)

    • Description: Initializes a new instance for reading properties from a local SVF property database file (.sdb).
    • Parameters:
      • dbPath (string): The full path to the local SVF property database file.
  • PropDbReader(string accessToken, string urn)

    • Description: Initializes a new instance for reading properties directly from an SVF property database in Autodesk APS (Forge) using an access token and model URN.
    • Parameters:
      • accessToken (string): A valid APS access token with permission to access the SVF model.
      • urn (string): The URN of the SVF model in Autodesk APS.
Methods
  • Task<Dictionary<string, object>> GetPropertiesForDbIdAsync(long dbId)

    • Description: Asynchronously retrieves all direct properties for a given database ID (dbId) from the SVF property database.
    • Parameters:
      • dbId (long): The database ID of the SVF model element whose properties you want to retrieve.
    • Returns:
      • Task<Dictionary<string, object>>: Dictionary of property names and values for the specified dbId.
  • Task<Dictionary<string, object>> GetMergedPropertiesAsync(long dbId)

    • Description: Gets the properties for a given dbId, merging parent properties recursively from the SVF property database.
    • Parameters:
      • dbId (long): The database ID of the SVF model element.
    • Returns:
      • Task<Dictionary<string, object>>: Dictionary of merged property names and values for the dbId.
  • Task<Dictionary<long, object>> GetAllPropertyValuesAsync(string category, string displayName)

    • Description: Returns all property values for all dbIds for a specific category and display name (property name) from the SVF property database.
    • Parameters:
      • category (string): The category name of the property.
      • displayName (string): The display name (property name).
    • Returns:
      • Task<Dictionary<long, object>>: Dictionary mapping dbId to the property value.
  • Task<Dictionary<long, Dictionary<string, object>>> GetAllPropertiesAsync()

    • Description: Gets all properties for all dbIds in the SVF property database.
    • Returns:
      • Task<Dictionary<long, Dictionary<string, object>>>: Dictionary mapping dbId to a dictionary of property key-value pairs.
  • Task<long?> GetParentDbIdAsync(long dbId)

    • Description: Gets the parent dbId for a given dbId, or null if none exists, from the SVF property database.
    • Parameters:
      • dbId (long): The database ID to query.
    • Returns:
      • Task<long?>: The parent dbId or null.
  • Task<object> GetPropertyValueAsync(long dbId, string category, string displayName)

    • Description: Gets the value for a specific property (by category and display name) for a given dbId from the SVF property database.
    • Parameters:
      • dbId (long): The database ID to query.
      • category (string): The property category.
      • displayName (string): The property display name.
    • Returns:
      • Task<object>: The property value or null.
  • Task<List<long>> FindDbIdsByPropertyAsync(string category, string displayName, object value)

    • Description: Finds all dbIds where the given category, property name (display name), and value match in the SVF property database.
    • Parameters:
      • category (string): The property category.
      • displayName (string): The property display name.
      • value (object): The value to match.
    • Returns:
      • Task<List<long>>: List of dbIds matching the criteria.
  • Task<List<Dictionary<string, object>>> QueryAsync(string sql)

    • Description: Executes a custom SQL query on the SVF property database and returns the results as a list of dictionaries (column name to value).
    • Parameters:
      • sql (string): The SQL query string to execute.
    • Returns:
      • Task<List<Dictionary<string, object>>>: List of dictionaries, each representing a row (column name to value).
  • void Dispose()

    • Description: Disposes the database connection and resources.

DbDownloader

  • static void DownloadAndExtract(string svfUrl, string outputPath)
    • Description: Downloads an SVF package from the specified URL and extracts the SVF property database (PropDb) to the given output path.
    • Parameters:
      • svfUrl (string): The URL to the SVF package (typically from Autodesk APS or Forge).
      • outputPath (string): The directory where the extracted SVF property database and related files will be saved.
    • Usage: Use this method to programmatically download and extract the SVF property database from an SVF model package.
    • Exceptions: Throws if the download fails or the SVF package is invalid.

ManifestHelper

  • Description: Provides utility methods for reading and parsing SVF manifest files, which describe the structure and contents of SVF packages, including the property database.
  • Usage: Use these utilities to inspect or process manifest files when working with SVF models and their property database resources.

Contributing

Contributions are welcome! Please open issues or submit pull requests for bug fixes, new features, or documentation improvements.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

References

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.9.1 180 5/20/2025
1.0.9 155 5/20/2025
1.0.8 149 5/19/2025
1.0.6 155 5/19/2025
1.0.5 149 5/19/2025
1.0.4 200 5/16/2025