Getting Started
use the 2d viewer api to embed the 2d viewer in your web applications using jquery ? more information on using jquery with the 2d viewer docid\ gnvs1snsdtrwklxdnp9qh installation 1\ add the 2d viewer to your project include the 2d viewer in your html file using a script tag, this will add the global bimsync object to the window object 2\ provide a container for the 2d viewer create a div element for attaching a 2d viewer instance to 3\ initialize the 2d viewer api set a callback function and then invoke the loadviewer2d method, the 2d viewer is ready once callback invoked bimsync setonviewer2dloadcallback(onviewer2dload); bimsync loadviewer2d(); 4\ create a 2d viewer instance provide the div element and an options object to the constructor method const viewer2delement = document getelementbyid("viewer 2d"); const viewer2doptions = { hoverspaces true, showviewpoint false, selectcolor "#ff0000", }; const viewer2d = new bimsync viewer2d viewer2d(viewer2delement, viewer2doptions); 5\ interact with the 2d viewer call methods on the 2d viewer instance to interact with the 2d viewer viewer2d loadurl(tokenurl) then(() => { const storeys = viewer2d getstoreys(); if (storeys length > 0) { viewer2d showstorey(storeys\[0] id); } }); usage options adjust the default behavior of the 2d viewer by providing an options object when creating a 2d viewer instance properties name type default description hoverspaces boolean false whether mouse hover highlights space below the cursor showviewpoint boolean true sets viewpoint visibility selectcolor string #a7f555 sets the css color of selected objects