{ "cells": [ { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "# Commit an IFC file into a newly created project\n", "\n", "import base64\n", "import bimserver\n", "\n", "server_address = 'localhost:8082'\n", "username = 'fabiano.correa@usp.br'\n", "password = 'admin'\n", "\n", "client = bimserver.api(server_address, username, password)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'AdminInterface',\n", " 'AuthInterface',\n", " 'LowLevelInterface',\n", " 'MetaInterface',\n", " 'NewServicesInterface',\n", " 'NotificationInterface',\n", " 'NotificationRegistryInterface',\n", " 'OAuthInterface',\n", " 'PluginInterface',\n", " 'RemoteServiceInterface',\n", " 'ServiceInterface',\n", " 'SettingsInterface'}" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "client.interfaces" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['__class__',\n", " '__delattr__',\n", " '__dict__',\n", " '__dir__',\n", " '__doc__',\n", " '__eq__',\n", " '__format__',\n", " '__ge__',\n", " '__getattr__',\n", " '__getattribute__',\n", " '__gt__',\n", " '__hash__',\n", " '__init__',\n", " '__init_subclass__',\n", " '__le__',\n", " '__lt__',\n", " '__module__',\n", " '__ne__',\n", " '__new__',\n", " '__reduce__',\n", " '__reduce_ex__',\n", " '__repr__',\n", " '__setattr__',\n", " '__sizeof__',\n", " '__str__',\n", " '__subclasshook__',\n", " '__weakref__',\n", " 'api',\n", " 'make_request',\n", " 'name']" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dir(client.ServiceInterface)" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "deserializer_id = client.ServiceInterface.getDeserializerByName(deserializerName='Ifc2x3tc1 (Streaming)').get('oid')\n", "project_id = client.ServiceInterface.addProject(projectName='PCC5968', schema='ifc2x3tc1').get('oid')\n", "\n", "with open('Duplex_A_20110907_optimized.ifc','rb') as f:\n", " ifc_data = f.read()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'__type': 'SLongCheckinActionState',\n", " 'deserializeErrorCode': 0,\n", " 'end': 1587563842137,\n", " 'errors': [],\n", " 'infos': [],\n", " 'oid': -1,\n", " 'progress': 100,\n", " 'rid': 0,\n", " 'roid': 11468803,\n", " 'stage': 9,\n", " 'start': 1587563547191,\n", " 'state': 'FINISHED',\n", " 'title': 'Checkin of Duplex_A_20110907_optimized.ifc',\n", " 'topicId': 1,\n", " 'uuid': None,\n", " 'warnings': []}" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "client.ServiceInterface.checkinSync(\n", " poid= project_id,\n", " comment= \"my first commit\",\n", " deserializerOid= deserializer_id,\n", " fileSize= len(ifc_data),\n", " data= base64.b64encode(ifc_data).decode('utf-8'),\n", " sync= 'false',\n", " merge= 'false',\n", " fileName= 'Duplex_A_20110907_optimized.ifc'\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.6" } }, "nbformat": 4, "nbformat_minor": 4 }