Skip to content

Commit

Permalink
Update 06.Explore SVF - Export SVF Viewer.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
chuongmep committed Feb 27, 2024
1 parent 347c459 commit 5ca2902
Showing 1 changed file with 193 additions and 1 deletion.
194 changes: 193 additions & 1 deletion docs/Tutorials/06.Explore SVF - Export SVF Viewer.ipynb
Original file line number Diff line number Diff line change
@@ -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": [
"<div><div></div><div></div><div><strong>Installed Packages</strong><ul><li><span>APSToolkit, 1.0.5</span></li></ul></div></div>"
]
},
"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": {
Expand Down

0 comments on commit 5ca2902

Please sign in to comment.