APSToolkit 1.0.2-beta
See the version list below for details.
dotnet add package APSToolkit --version 1.0.2-beta
NuGet\Install-Package APSToolkit -Version 1.0.2-beta
<PackageReference Include="APSToolkit" Version="1.0.2-beta" />
paket add APSToolkit --version 1.0.2-beta
#r "nuget: APSToolkit, 1.0.2-beta"
// Install APSToolkit as a Cake Addin #addin nuget:?package=APSToolkit&version=1.0.2-beta&prerelease // Install APSToolkit as a Cake Tool #tool nuget:?package=APSToolkit&version=1.0.2-beta&prerelease
<a href="https://twitter.com/intent/follow?screen_name=chuongmep"> <img src="https://img.shields.io/twitter/follow/chuongmep?style=social&logo=twitter" alt="follow on Twitter"></a>
APS Toolkit
APS Toolkit (Former is Forge) is powerful for you to explore Autodesk Platform Services
(APS). It's built on top of Autodesk.Forge and Newtonsoft.Json. Forge Toolkit includes some features allow you to read, download and write data from Autodesk Platform Services
and export to CSV, Excel, JSON, XML, etc.
Features
- Read/Download SVF Model
- Read/Query Properties Database SQLite
- Read/Download Properties Without Viewer
- Read Geometry Data
- Read Metadata
- Read Fragments
- Read MeshPacks
- Read Images
- Export Data to CSV
- Export Data to Excel
- Export Data to JSON
Before start you need setup your environment:
APS_CLIENT_ID = <your client id>
APS_CLIENT_SECRET = <your client secret>
APS_REFRESH_TOKEN = <your refresh token>
Tutorials
WIP
Read Properties From Local
//TODO : Test Get Properties Local files
string objects_attrs_gzip = @"<yourpath>\Resource\objects_attrs.json.gz";
string objects_vals_gzip = @"<yourpath>\Resource\objects_vals.json.gz";
string objects_ids_gzip = @"<yourpath>\Resource\objects_ids.json.gz";
string objects_avs_gzip = @"<yourpath>\Resource\objects_avs.json.gz";
string objects_offsets_gzip = @"<yourpath>\Resource\objects_offs.json.gz";
PropDbReader proReader = new PropDbReader(objects_ids_gzip, objects_offsets_gzip, objects_avs_gzip,
objects_attrs_gzip, objects_vals_gzip);
int dbIndex = 3528;
Dictionary<string,string> dictionary = proReader.GetProperties(dbIndex);
Console.WriteLine("done get");
Read Properties From Remote
string urn = "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLk9kOHR4RGJLU1NlbFRvVmcxb2MxVkE_dmVyc2lvbj0z";
Autodesk.Forge.TwoLeggedApi twoLeggedApi = new Autodesk.Forge.TwoLeggedApi();
var ClientID = Environment.GetEnvironmentVariable("FORGE_CLIENT_ID");
var ClientSecret = Environment.GetEnvironmentVariable("FORGE_CLIENT_SECRET");
Console.WriteLine("Done with Authentication");
dynamic token = twoLeggedApi.Authenticate(ClientID, ClientSecret, "client_credentials",
new Scope[]
{
Scope.DataRead, Scope.DataWrite, Scope.DataCreate, Scope.DataSearch, Scope.BucketCreate, Scope.BucketRead,
Scope.BucketUpdate, Scope.BucketDelete
});
var access_token = token.access_token;
PropDbReader probReader = await Derivatives.ReadPropertyRemoteAsync(urn, access_token);
Dictionary<string,string> properties = probReader.GetProperties(3528);
Console.WriteLine("Done with ReadPropertyRemoteAsync");
Download SVF Model
string dowloadFolder = @"D:\Temp\SVF\MyHouse";
string urn = "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLk9kOHR4RGJLU1NlbFRvVmcxb2MxVkE_dmVyc2lvbj0z";
Autodesk.Forge.TwoLeggedApi twoLeggedApi = new Autodesk.Forge.TwoLeggedApi();
var ClientID = Environment.GetEnvironmentVariable("FORGE_CLIENT_ID");
var ClientSecret = Environment.GetEnvironmentVariable("FORGE_CLIENT_SECRET");
Console.WriteLine("Done with Authentication");
dynamic token = twoLeggedApi.Authenticate(ClientID, ClientSecret, "client_credentials",
new Scope[]
{
Scope.DataRead, Scope.DataWrite, Scope.DataCreate, Scope.DataSearch, Scope.BucketCreate, Scope.BucketRead,
Scope.BucketUpdate, Scope.BucketDelete
});
var access_token = token.access_token;
Console.WriteLine("Start check data process export svf");
await Derivatives.SaveFileSVFAsync(dowloadFolder, urn, access_token);
Console.WriteLine("Done process save data svf");
Read SVF Model Local
ForgeSvfReader forgeSvfReader = new ForgeSvfReader();
string svfPath = @"<yourpath>\<name>.svf";
ISvfContent svfContent = forgeSvfReader.ReadSvf(svfPath);
## read svf properties
// get object properties
PropDbReader propDbReader = svfContent.properties;
int dbIndex = 3461;
Dictionary<string, string> properties = propDbReader.GetProperties(dbIndex);
// get object name
string name = propDbReader.GetName(3461);
Read Fragments Stream
string urn = "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLk9kOHR4RGJLU1NlbFRvVmcxb2MxVkE_dmVyc2lvbj0z";
Autodesk.Forge.TwoLeggedApi twoLeggedApi = new Autodesk.Forge.TwoLeggedApi();
var ClientID = Environment.GetEnvironmentVariable("FORGE_CLIENT_ID");
var ClientSecret = Environment.GetEnvironmentVariable("FORGE_CLIENT_SECRET");
Console.WriteLine("Done with Authentication");
dynamic token = twoLeggedApi.Authenticate(ClientID, ClientSecret, "client_credentials",
new Scope[]
{
Scope.DataRead, Scope.DataWrite, Scope.DataCreate, Scope.DataSearch, Scope.BucketCreate, Scope.BucketRead,
Scope.BucketUpdate, Scope.BucketDelete
});
var access_token = token.access_token;
Dictionary<string,ISvfFragment[]> fragments = await Derivatives.ReadFragmentsRemoteAsync(urn, access_token);
ReadFragments Local
string FragmentList =
@".\FragmentList.pack";
byte[] buffer = System.IO.File.ReadAllBytes(FragmentList);
ISvfFragment[] svfFragments = Fragments.parseFragments(buffer);
// try export to csv
using (var writer = new StreamWriter(@".output\fragments.csv"))
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
{
csv.WriteRecords(svfFragments);
}
Console.WriteLine("Done with Fragments");
Read Geometries Stream
string urn = "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLk9kOHR4RGJLU1NlbFRvVmcxb2MxVkE_dmVyc2lvbj0z";
Autodesk.Forge.TwoLeggedApi twoLeggedApi = new Autodesk.Forge.TwoLeggedApi();
var ClientID = Environment.GetEnvironmentVariable("FORGE_CLIENT_ID");
var ClientSecret = Environment.GetEnvironmentVariable("FORGE_CLIENT_SECRET");
Console.WriteLine("Done with Authentication");
dynamic token = twoLeggedApi.Authenticate(ClientID, ClientSecret, "client_credentials",
new Scope[]
{
Scope.DataRead, Scope.DataWrite, Scope.DataCreate, Scope.DataSearch, Scope.BucketCreate, Scope.BucketRead,
Scope.BucketUpdate, Scope.BucketDelete
});
var access_token = token.access_token;
var geometries = await Derivatives.ReadGeometriesRemoteAsync(urn, access_token);
Read Geometries Local
string geometryMetadata = @"<yourpath>\GeometryMetadata.pf";
byte[] buffer = System.IO.File.ReadAllBytes(me);
var geometries = Geometries.parseGeometries(buffer);
Dependencies
License
Thís project is licensed under the terms of the MIT.
Many thanks some repos:
Developer
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- Autodesk.Forge (>= 1.9.9)
- Autodesk.Forge.DesignAutomation (>= 5.1.2)
- ChoETL.Parquet (>= 1.0.1.30)
- ConsoleTables (>= 2.6.1)
- CsvHelper (>= 30.0.1)
- EPPlus (>= 7.0.4)
- Newtonsoft.Json (>= 13.0.3)
- Serilog (>= 3.1.2-dev-02097)
- Serilog.Sinks.Console (>= 5.0.1)
- Serilog.Sinks.File (>= 5.0.1-dev-00972)
- SharpZipLib (>= 1.4.2)
- System.Data.SQLite.Core (>= 1.0.118)
- System.IO (>= 4.3.0)
- System.Numerics.Vectors (>= 4.5.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on APSToolkit:
Package | Downloads |
---|---|
APSToolkitApp
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.0 | 103 | 9/25/2024 |
1.1.9 | 83 | 9/23/2024 |
1.1.8 | 92 | 9/20/2024 |
1.1.7 | 87 | 9/19/2024 |
1.1.6 | 115 | 9/18/2024 |
1.1.5 | 155 | 3/25/2024 |
1.1.4 | 120 | 3/15/2024 |
1.1.3 | 125 | 3/12/2024 |
1.1.2 | 144 | 3/9/2024 |
1.1.1 | 126 | 3/7/2024 |
1.1.0 | 139 | 3/5/2024 |
1.0.9 | 139 | 3/3/2024 |
1.0.8 | 118 | 2/28/2024 |
1.0.8-beta | 83 | 2/28/2024 |
1.0.7 | 132 | 2/28/2024 |
1.0.6 | 126 | 2/28/2024 |
1.0.5 | 142 | 2/27/2024 |
1.0.4 | 132 | 2/26/2024 |
1.0.3 | 128 | 2/26/2024 |
1.0.2 | 128 | 2/26/2024 |
1.0.2-beta | 100 | 2/26/2024 |
1.0.1 | 131 | 2/26/2024 |
1.0.1-alpha | 104 | 2/23/2024 |
1.0.0 | 127 | 2/22/2024 |