Abed Aarabi
Abed Aarabi

Reputation: 149

Publish and Generating Room Elements For a Revit Model (C4R)

I am working on Data visualization forge API to add a sprite sensor to some rooms (architecture model) / spaces (Mep model). in general, I am using Data Management API to publish but I am wondering if it is a way to include rooms element/spaces element with the same API...

because at the documentation it seems possible only to non C4R models

thank you in advance

Upvotes: 0

Views: 158

Answers (1)

Eason Kang
Eason Kang

Reputation: 7070

Revit models published to BIM360 Docs will get master views translated by default. So, you don't need to follow the instruction to request mater viewer translation. Just remember to load master viewers in Forge Viewer.

In the response of GET :urn/manifest, there is a new attribute called isMasterView to help identify if the view is an Revit master view.

{
    "isMasterView": true,
    "phaseNames": "Working Drawings",
    "role": "3d",
    "hasThumbnail": "true",
    "children": [
        {
            "guid": "c884ae1b-61e7-4f9d-0001-719e20b22d0b-0010beed",
            "type": "view",
            "role": "3d",
            "name": "Working Drawings",
            "status": "success",
            "progress": "complete",
            "camera": [
                124.7886734008789,
                -152.5997772216797,
                133.87307739257812,
                7.490562438964844,
                -35.301666259765625,
                16.574966430664062,
                -0.40824830532073975,
                0.40824830532073975,
                0.8164966106414795,
                1.285019040107727,
                0,
                1,
                1
            ]
        },
//...
        {
            "role": "graphics",
            "mime": "application/autodesk-svf2",
            "guid": "18474dc1-df69-767f-47ee-33e5eac5599d",
            "type": "resource"
        }
    ],
    "name": "Working Drawings",
    "guid": "e4baebbb-4ad6-8223-7f6a-cad4f0bb353a",
    "progress": "complete",
    "type": "geometry",
    "viewableID": "c884ae1b-61e7-4f9d-0001-719e20b22d0b-0010beed",
    "status": "success"
},

In Forge Viewer, we can do something like the below to load master views.

const root = viewerDocument.getRoot();
const viewables = root.search({'type':'geometry', 'role': '3d'});

console.log('Viewables:', viewables);

const phaseViews = viewables.filter(v => v.data.name === v.data.phaseNames && v.getViewableRootPath().includes('08f99ae5-b8be-4f8d-881b-128675723c10'));

console.log('Master Views:', phaseViews);

const defaultModel = phaseViews[0];

viewer.loadDocumentNode(viewerDocument, defaultModel);

Upvotes: 1

Related Questions