SVF.PropDbReader 1.0.9.1

dotnet add package SVF.PropDbReader --version 1.0.9.1
                    
NuGet\Install-Package SVF.PropDbReader -Version 1.0.9.1
                    
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.9.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SVF.PropDbReader" Version="1.0.9.1" />
                    
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.9.1
                    
#r "nuget: SVF.PropDbReader, 1.0.9.1"
                    
#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.9.1
                    
#: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.9.1
                    
Install as a Cake Addin
#tool nuget:?package=SVF.PropDbReader&version=1.0.9.1
                    
Install as a Cake Tool

SVF-PropDbReader

<p align="center"> <img src="Resources/Logo.png" alt="SVF-PropDbReader Logo" width="90%"/> </p>

.NET 8.0 NuGet Version

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
  • Memory-efficient streaming and thread-safe property extraction

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, bool deleteDbOnDispose = false)

    • 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.
      • deleteDbOnDispose (bool): If true, deletes the DB file on dispose (default: false).
  • 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. Downloads the DB in a memory-efficient way.
    • 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. Warning: For large models, this method can consume a lot of memory. Use streaming or concurrent alternatives for large datasets.
    • 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.
  • IAsyncEnumerable<(long dbId, object? value)> GetAllPropertyValuesStreamAsync(string category, string displayName)

    • Description: Streams all property values for all dbIds for a specific category and display name (property name). This is memory efficient for large models.
    • Parameters:
      • category (string): The category name of the property.
      • displayName (string): The display name (property name).
    • Returns:
      • IAsyncEnumerable<(long dbId, object? value)>: Async stream of (dbId, value) tuples.
  • Task<List<(long dbId, object? value)>> GetAllPropertyValuesListAsync(string category, string displayName)

    • Description: Returns all property values for all dbIds for a specific category and display name as a list of tuples. Useful for parallel processing.
    • Parameters:
      • category (string): The category name of the property.
      • displayName (string): The display name (property name).
    • Returns:
      • Task<List<(long dbId, object? value)>>: List of (dbId, value) tuples.
  • Task<ConcurrentDictionary<long, object?>> GetAllPropertyValuesConcurrentAsync(string category, string displayName)

    • Description: Returns all property values for all dbIds for a specific category and display name as a thread-safe ConcurrentDictionary. Useful for parallel processing.
    • Parameters:
      • category (string): The category name of the property.
      • displayName (string): The display name (property name).
    • Returns:
      • Task<ConcurrentDictionary<long, object?>>: ConcurrentDictionary mapping dbId to the property value.
  • Task GetAllPropertyValuesStreamToConcurrentAsync(string category, string displayName, ConcurrentDictionary<long, object?> dict)

    • Description: Streams all property values for all dbIds for a specific category and display name and adds them to a provided ConcurrentDictionary as they are read. This is both memory efficient and thread-safe for large models.
    • Parameters:
      • category (string): The category name of the property.
      • displayName (string): The display name (property name).
      • dict (ConcurrentDictionary<long, object?>): The dictionary to populate.
    • Returns:
      • Task: Completes when all values have been streamed into the dictionary.
  • Task<Dictionary<long, Dictionary<string, object?>>> GetAllPropertiesAsync()

    • Description: Gets all properties for all dbIds in the SVF property database. Warning: For large models, this method can consume a lot of memory.
    • 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).
  • bool DeleteDbFile()

    • Description: Deletes the property database file if it exists.
    • Returns:
      • bool: True if the file was deleted, false otherwise.
  • void Dispose()

    • Description: Disposes the database connection and resources. If the DB was downloaded, deletes the file as well.

Version

This documentation is for version 1.0.9. The badge at the top of this page always reflects the latest published version.

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 177 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