Code Monkey home page Code Monkey logo

aps-toolkit's Introduction

Platform License: GNU v3

ReSharper Rider Visual Studio 2022 .NET Framework

Publish Nuget Version NuGet Downloads

PyPI PyPI - Downloads

follow on Twitter

๐Ÿ”ฉ APS Toolkit

APS Toolkit (Former is Forge) is powerful tool for developer,software enginner, AI engineer 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.

APSToolkit

โšก 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 Parquet

โš™ Installation

.NET

Please follow latest update at APSToolkit Nuget

<PackageReference Include="APSToolkit" Version="1.*" />

Python

Please follow latest update at APSToolkit Python

pip install aps-toolkit --upgrade

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>

โญ Getting Started

I want export Revit Data To Excel ๐Ÿ‘‡

.NET

using APSToolkit;
using Autodesk.Forge;
using APSToolkit.Database;
using APSToolkit.Auth;
var token = Authentication.Get2LeggedToken().Result;
string urn = "<Derivative URN>";
var RevitPropDbReader = new PropDbReaderRevit(urn, token);
RevitPropDbReader.ExportAllDataToExcel("result.xlsx");

Python

from aps_toolkit import Auth
from aps_toolkit import PropDbReaderRevit
auth = Auth()
token = auth.auth2leg()
urn = "<Derivative URN>"
prop_reader = PropDbReaderRevit(urn, token)
df = prop_reader.get_data_by_category("Ducts")
df.save_to_excel("result.xlsx")

๐Ÿ“š Tutorials

.NET

All Tutorials are available under Jupyter Notebook at .NET Tutorials

Python

All Tutorials are available under Jupyter Notebook at Python Tutorials

License

Many source codes here are collected from open-source authors under the MIT License. Without their sharing and contributions, I wouldn't be able to do this. I am deeply grateful to them, and therefore, I hope that if you are using this tool, please thank them before thanking me and follow their licenses.

This project is licensed under the terms of the gnu-gpl-v3.0. Some part of the project base on the licese follow the original project :

Dependencies

  • Autodesk.Forge - The .NET SDK for Autodesk Forge.
  • Newtonsoft.Json - Json.NET is a popular high-performance JSON framework for .NET.
  • CsvHelper - Library to help reading and writing CSV files.
  • EPPlus - EPPlus is a .NET library that reads and writes Excel files using the Office Open XML format (xlsx).
  • ChoETL - Cinchoo ETL is a code-based ETL framework for extracting data from multiple sources, transforming, and loading into your very own data warehouse in .NET environment. You can have data in your data warehouse in no time.
  • SharpZipLib - SharpZipLib (#ziplib, formerly NZipLib) is a compression library for Zip, GZip, BZip2.
  • Pandas - Pandas is a fast, powerful, flexible and easy to use open source data analysis and data manipulation library built on top of the Python programming language.
  • Nuke - Nuke is a cross-platform build automation system with C# DSL for tasks such as compiling code, copying files and folders, running unit tests, compressing files and building NuGet packages.

๐Ÿ‘จโ€๐Ÿซ Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

๐ŸŽ Sponsors

Thanks JetBrains for providing a free All product IDE for this project.


Disclaimer

This is not an official Autodesk product to support for Autodesk Platform Services. Use it at your own risk.

I'm not responsible for any data loss or any other issues caused by using this library, some features need require cost for using. Please read carefully the Autodesk Forge and Autodesk Platform Services terms of use. I'm just doing, testing , maintaining in free time, so feel free to contribute and make it better.

Update : There is a new, official Node.js/TypeScript SDK that's currently in beta but will be stabilized soon. That SDK will offer various benefits over forge-server-utils, for example, it will be easier to maintain and extend in the future as it's being auto-generated from OpenAPI specs. As soon as it's ready to use (which should be really soon), I would archive this project and point to the official SDK instead.

aps-toolkit's People

Contributors

chuongmep avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aps-toolkit's Issues

Python JSONDecodeError on creating a PropDbReaderRevit

Hello, upon running below code

from aps_toolkit import Auth
from aps_toolkit import PropDbReaderRevit
import os
client_id = "XXX"
client_secret = "XXX"
auth = Auth(client_id, client_secret)
token = auth.auth2leg()
access_token = token.access_token

urn = "dXJuOmFkc2sud2lwZW1lYTpmcy5maWxlOnZmLkJBSUhTc09zVFdtY2tCYWdNMTNBWHc_dmVyc2lvbj0z"

prop_reader = PropDbReaderRevit(urn, token)

I get a JSONDecodeError.
With the same token and URN I am able to make the C# example work, so this would not be the issue.

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py:971, in Response.json(self, **kwargs)
    970 try:
--> 971     return complexjson.loads(self.text, **kwargs)
    972 except JSONDecodeError as e:
    973     # Catch JSON-related errors and raise as requests.JSONDecodeError
    974     # This aliases json.JSONDecodeError and simplejson.JSONDecodeError

File ~\AppData\Local\Programs\Python\Python311\Lib\json\__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    343 if (cls is None and object_hook is None and
    344         parse_int is None and parse_float is None and
    345         parse_constant is None and object_pairs_hook is None and not kw):
--> 346     return _default_decoder.decode(s)
    347 if cls is None:

File ~\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py:337, in JSONDecoder.decode(self, s, _w)
    333 """Return the Python representation of ``s`` (a ``str`` instance
    334 containing a JSON document).
    335 
    336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    338 end = _w(s, end).end()

File ~\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py:355, in JSONDecoder.raw_decode(self, s, idx)
    354 except StopIteration as err:
--> 355     raise JSONDecodeError("Expecting value", s, err.value) from None
    356 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

JSONDecodeError                           Traceback (most recent call last)
Cell In[23], line 2
      1 from aps_toolkit import PropDbReaderRevit
----> 2 prop_reader = PropDbReaderRevit(urn, token)
      4 # categories = prop_reader.get_all_categories()
      5 # # to dataframe with columns "dbid,category" from dict categories
      6 # df = pd.DataFrame.from_dict(categories, orient='index', columns=["category"])
      7 # df = df.reset_index()
      8 # df = df.rename(columns={"index":"dbid"})
      9 # df.head(20)

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\aps_toolkit\PropReader.py:48, in PropReader.__init__(self, urn, token)
     46 # request
     47 response = requests.get(URL, headers=headers)
---> 48 json_response = response.json()
     49 children = json_response['derivatives'][0]["children"]
     50 path = ""

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py:975, in Response.json(self, **kwargs)
    971     return complexjson.loads(self.text, **kwargs)
    972 except JSONDecodeError as e:
    973     # Catch JSON-related errors and raise as requests.JSONDecodeError
    974     # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 975     raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.