Search code examples
autodesk-forgerevitautodesk-model-derivativeautodesk-data-management

Marking The Area objects in Sheets of Revit


I have been tried to get Area objects from Sheets (3D Submission) of Revit file through Forge API. Using this link GET /modelderivative/v2/designdata/{urn}/metadata/{guid of sheet}/properties the Area Information isn't there, even though i have added the area in sheets.

My goal is marking the Area in 2D / Sheets (3D Submission). How can i do that ?

The Area, i mean like this >> marking The Area in 2D


Solution

  • The area object looks like Revit Room or Revit Zoom. If your zoom or room is clickable on the Viewer, then you can obtain its properties via the API Get Properties. Here are a few steps I used to archive what you want, you can compare if there is something you missed.

    1. Check the room/area elements are valid in your Revit sheet. A room/area should be enclosed by walls or Room Separation/Area Boundary. enter image description here

    2. Make sure the sheet which contains your room/area is included in the set of the Revit Publish Setting enter image description here

    3. Upload the well-configurated RVT to Forge for translation.

    4. After translation was completed, load the sheet view (called A102 - Plans in this case) via Forge Viewer, and make sure that room/area elements in the view are clickable. enter image description here

    5. Retrieve the objectId of selected room/area via viewer.getSelection(). The objectId of the selected room/area in this view is4089` for example.

    6. Call API GET :urn/metadata to get sheet's guid. Now it's abdacd31-f94c-e84f-9a58-4663e281d894 for instance.

    {
        "data": {
            "type": "metadata",
            "metadata": [
                {
                    "name": "{3D}",
                    "role": "3d",
                    "guid": "6bfb4886-f2ee-9ccb-8db0-c5c170220c40"
                },
                {
                    "name": "A102 - Plans",
                    "role": "2d",
                    "guid": "abdacd31-f94c-e84f-9a58-4663e281d894"
                }
            ]
        }
    }
    
    1. Call API GET :urn/metadata/:guid to obtain instance tree of that view, and check if there is a room/area with the id we want. e.g. the room named as Kitchen & Dining 101 [857279] and id is 4089 in the API response.
    {
        "objectid": 4084,
        "name": "Rooms",
        "objects": [
            {
                "objectid": 4085,
                "name": "Bath 203 [857200]"
            },
            {
                "objectid": 4086,
                "name": "Bath 205 [857203]"
            },
            {
                "objectid": 4087,
                "name": "Bedroom 202 [857206]"
            },
            {
                "objectid": 4088,
                "name": "Entry Hall 201 [857209]"
            },
            {
                "objectid": 4089,
                "name": "Kitchen & Dining 101 [857279]"
            }
         ]
    }
    
    1. Call API GET :urn/metadata/:guid/properties in this way to retrieve properties of the room/area. For example, /modelderivative/v2/{YOUR_RVT_URN}/metadata/abdacd31-f94c-e84f-9a58-4663e281d894/properties?objectid=4089 and its response is shown as below, then you will see area which you want is showing in the response.
    {
        "data": {
            "type": "properties",
            "collection": [
                {
                    "objectid": 4089,
                    "name": "Kitchen & Dining 101 [857279]",
                    "externalId": "e6ac360b-aaed-4c3b-a130-36b4c2ac9d13-000d1467",
                    "properties": {
                        "Constraints": {
                            "Base Offset": "0.000 mm",
                            "Level": "Level 1",
                            "Limit Offset": "6500.000 mm",
                            "Upper Limit": "Level 1"
                        },
                        "Dimensions": {
                            "Area": "26.971 m^2",
                            "Computation Height": "0.000 mm",
                            "Perimeter": "29060.000 mm",
                            "Unbounded Height": "6500.000 mm",
                            "Volume": "118.317 m^3"
                        },
                        "Identity Data": {
                            "Base Finish": "",
                            "Ceiling Finish": "",
                            "Comments": "",
                            "Department": "",
                            "Floor Finish": "",
                            "Image": "",
                            "Name": "Kitchen & Dining",
                            "Number": "101",
                            "Occupancy": "",
                            "Occupant": "",
                            "Wall Finish": ""
                        },
                        "Phasing": {
                            "Phase": "Working Drawings"
                        }
                    }
                }
            ]
        }
    }
    


    Hope it helps~