def run(self):
        configuration = self.config()
        ifc_api = bimdata_api_client.IfcApi(
            bimdata_api_client.ApiClient(configuration))

        for ifc_pk in self.ifc_pks:
            ifc = ifc_api.get_ifc(self.cloud_pk, ifc_pk, self.project_pk)
            structure_response = requests.get(ifc.structure_file)
            structure_response.raise_for_status()
            structure = structure_response.json()
            self.recursive_parse_structure(structure)
            zones = ifc_api.get_zones(self.cloud_pk, ifc_pk, self.project_pk)
            self.recursive_parse_zones(zones)
        data = {
            "space_UUID": [],
            "parent_zone_UUID": [],
            "zone_UUID": [],
            "storey_UUID": [],
        }
        for space_uuid, parents in self.spaces.items():
            data['space_UUID'].append(space_uuid)
            data['parent_zone_UUID'].append(parents.get("parent_zone_uuid"))
            data['zone_UUID'].append(parents.get("zone_uuid"))
            data['storey_UUID'].append(parents.get("storey_uuid"))

        self.df = pd.DataFrame(data)
        return self.df
Exemplo n.º 2
0
    def __init__(self, access_token=None):
        self.config = bimdata_api_client.Configuration()
        self.config.host = settings.API_URL
        if access_token:
            # when we have a user access_token
            self.config.access_token = access_token
        else:
            token_payload = {
                "client_id": settings.OIDC_RP_CLIENT_ID,
                "client_secret": settings.OIDC_RP_CLIENT_SECRET,
                "grant_type": "client_credentials",
            }

            # Get the token
            response = requests.post(settings.OIDC_OP_TOKEN_ENDPOINT,
                                     data=token_payload)
            response.raise_for_status()
            self.config.access_token = response.json().get("access_token")

        self.client = bimdata_api_client.ApiClient(self.config)

        self.collaboration_api = bimdata_api_client.CollaborationApi(
            self.client)
        self.ifc_api = bimdata_api_client.IfcApi(self.client)
        self.webhook_api = bimdata_api_client.WebhookApi(self.client)
Exemplo n.º 3
0
    def run(self):
        configuration = self.config()
        ifc_api = bimdata_api_client.IfcApi(
            bimdata_api_client.ApiClient(configuration))

        for ifc_pk in self.ifc_pks:
            ifc = ifc_api.get_ifc(self.cloud_pk, ifc_pk, self.project_pk)
            structure_response = requests.get(ifc.structure_file)
            structure_response.raise_for_status()
            structure = structure_response.json()
            zones = ifc_api.get_zones(self.cloud_pk, ifc_pk, self.project_pk)
            self.recursive_parse_zones(zones)
            self.recursive_parse(structure)
        data = {
            "element_UUID": self.element_UUIDs,
            "zone_UUID": self.zone_UUIDs,
            "zone_name": self.zone_names,
            "space_UUID": self.space_UUIDs,
            "space_name": self.space_names,
            "storey_UUID": self.storey_UUIDs,
            "storey_name": self.storey_names,
            "building_UUID": self.building_UUIDs,
            "building_name": self.building_names,
            "site_UUID": self.site_UUIDs,
            "site_name": self.site_names,
        }
        self.df = pd.DataFrame(data)
        return self.df
Exemplo n.º 4
0
    def run(self):
        configuration = self.config()
        ifc_api = bimdata_api_client.IfcApi(
            bimdata_api_client.ApiClient(configuration))

        for ifc_pk in self.ifc_pks:
            api_response = ifc_api.get_raw_elements(self.cloud_pk, ifc_pk,
                                                    self.project_pk)
            self.raw_elements_to_elements(api_response)

        self.get_properties_from_elements()
        self.df = pd.DataFrame(self.formatted_elements)
        return self.df
Exemplo n.º 5
0
    def run(self):
        configuration = self.config()
        ifc_api = bimdata_api_client.IfcApi(
            bimdata_api_client.ApiClient(configuration))

        for ifc_pk in self.ifc_pks:
            zones = ifc_api.get_zones(self.cloud_pk, ifc_pk, self.project_pk)
            self.recursive_parse(zones)
        data = {
            "parent_zone_UUID": self.parent_zone_uuids,
            "zone_UUID": self.zone_uuids,
            "space_UUID": self.space_uuids,
        }
        self.df = pd.DataFrame(data)
        return self.df
Exemplo n.º 6
0
    def run(self):
        configuration = self.config()
        ifc_api = bimdata_api_client.IfcApi(bimdata_api_client.ApiClient(configuration))
        collaboration_api = bimdata_api_client.CollaborationApi(bimdata_api_client.ApiClient(configuration))

        classifications = collaboration_api.get_classifications(self.cloud_pk, self.project_pk)
        self.classifications = {classification.id: classification for classification in classifications}
        for ifc_pk in self.ifc_pks:
            classifications_relations = ifc_api.list_classification_element_relations(self.cloud_pk, ifc_pk, self.project_pk)
            self.raw_elements_to_elements(classifications_relations)
        data = {
            "element_UUID": self.element_UUIDs,
            "classification_name": self.classification_names,
            "classification_notation": self.classification_notations,
            "classification_title": self.classification_titles,
        }
        self.df = pd.DataFrame(data)
        return self.df