diff --git a/docs/Tutorials/06.Explore SVF - Export SVF Viewer.ipynb b/docs/Tutorials/06.Explore SVF - Export SVF Viewer.ipynb index 709d82c..87d5134 100644 --- a/docs/Tutorials/06.Explore SVF - Export SVF Viewer.ipynb +++ b/docs/Tutorials/06.Explore SVF - Export SVF Viewer.ipynb @@ -1,11 +1,203 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Introduction" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "SVF (Simple Vector Format) is a file format used by Autodesk Forge for displaying 2D and 3D model data. It's a proprietary format developed by Autodesk to optimize the loading and rendering of design data for web and mobile applications. \n", + "\n", + "SVF files are typically generated from source design files (like DWG, Revit, or Inventor files) using the Model Derivative API in Autodesk Forge. The SVF file contains a hierarchical structure of the model data, including geometry, materials, and metadata, which can be efficiently streamed to a client application and rendered using the Forge Viewer. \n", + "\n", + "This format is designed to be lightweight and fast-loading, making it ideal for web-based viewing of complex design data." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + }, + "vscode": { + "languageId": "polyglot-notebook" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
Installed Packages
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#r \"nuget: APSToolkit\"" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + }, + "vscode": { + "languageId": "polyglot-notebook" + } + }, + "outputs": [], + "source": [ + "using APSToolkit;" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Auth" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + }, + "vscode": { + "languageId": "polyglot-notebook" + } + }, + "outputs": [], + "source": [ + "using APSToolkit.Auth;\n", + "// please visit tutorial : 01.Setup And Authentication.ipynb for more details\n", + "var token = Authentication.Get2LeggedToken().Result;" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### URN" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + }, + "vscode": { + "languageId": "polyglot-notebook" + } + }, + "outputs": [], + "source": [ + "// please visit tutorial : 03.Explore Versions Item and Derivative Urn to get the urn\n", + "string urn = \"dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLk9kOHR4RGJLU1NlbFRvVmcxb2MxVkE_dmVyc2lvbj0z\";" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Download SVF" + ] + }, { "cell_type": "code", "execution_count": null, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + }, + "vscode": { + "languageId": "polyglot-notebook" + } + }, + "outputs": [], + "source": [ + "string outputFolder = \"./output\";\n", + "await Derivatives.SaveFileSvfAsync(outputFolder, urn, token);" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### How To Use SVF" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Please visit the tutorial at repo : https://github.com/chuongmep/svf-viewer\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "For Viewer : https://chuongmep.com/posts/2023-12-17-Let-Back-To-Forge-Part2.html" + ] + }, + { + "cell_type": "markdown", "metadata": {}, + "source": [ + "### How To Read SVF" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + }, + "vscode": { + "languageId": "polyglot-notebook" + } + }, "outputs": [], - "source": [] + "source": [ + "using APSToolkit.Schema;\n", + "string path = \"./output/0.svf\";\n", + "ISvfContent svfContent = SvfReader.ReadSvf(path);\n", + "// get geometries \n", + "var geometries = svfContent.geometries;" + ] } ], "metadata": {