autocad - How to Show/View or Read .dwg files on browser -
how show or read .dwg files on browser without using software means using php, jquery, javascript or other programming language. have gone through https://developer.autodesk.com , created app client id , client secret, created index.html file. after stuck in finding next movement getting required "model derivative api". please guide me same. giving precious response.
<!-- viewer css --> <link rel="stylesheet" href="https://developer.api.autodesk.com/viewingservice/v1/viewers/style.min.css" type="text/css"> <!-- developer css --> <style> body { margin: 0; } #myviewerdiv { width: 100%; height: 100%; margin: 0; background-color: #f0f8ff; } </style>
<!-- viewer instantiated here --> <div id="myviewerdiv"></div> <!-- viewer js --> <script src="https://developer.api.autodesk.com/viewingservice/v1/viewers/three.min.js"></script> <script src="https://developer.api.autodesk.com/viewingservice/v1/viewers/viewer3d.min.js"></script> <!-- developer js --> <script> var viewer; var options = { env: 'autodeskproduction', accesstoken: '<your_application_token>' }; var documentid = 'urn:<your_urn_id>'; autodesk.viewing.initializer(options, function oninitialized(){ autodesk.viewing.document.load(documentid, ondocumentloadsuccess, ondocumentloadfailure); }); /** * autodesk.viewing.document.load() success callback. * proceeds model initialization. */ function ondocumentloadsuccess(doc) { // document contains references 3d , 2d viewables. var viewables = autodesk.viewing.document.getsubitemswithproperties(doc.getrootitem(), {'type':'geometry'}, true); if (viewables.length === 0) { console.error('document contains no viewables.'); return; } // choose of avialble viewables var initialviewable = viewables[0]; var svfurl = doc.getviewablepath(initialviewable); var modeloptions = { sharedpropertydbpath: doc.getpropertydbpath() }; var viewerdiv = document.getelementbyid('myviewerdiv'); viewer = new autodesk.viewing.private.guiviewer3d(viewerdiv); viewer.start(svfurl, modeloptions, onloadmodelsuccess, onloadmodelerror); } /** * autodesk.viewing.document.load() failuire callback. */ function ondocumentloadfailure(viewererrorcode) { console.error('ondocumentloadfailure() - errorcode:' + viewererrorcode); } /** * viewer.loadmodel() success callback. * invoked after model's svf has been loaded. * may trigger before geometry has been downloaded , displayed on-screen. */ function onloadmodelsuccess(model) { console.log('onloadmodelsuccess()!'); console.log('validate model loaded: ' + (viewer.model === model)); console.log(model); } /** * viewer.loadmodel() failure callback. * invoked when there's error fetching svf file. */ function onloadmodelerror(viewererrorcode) { console.error('onloadmodelerror() - errorcode:' + viewererrorcode); } </script>
you can test online @ a360 viewer.
the code pointed out page, note how it's missing token , urn. in fact, following viewer tutorial you'll notice prepare file viewing tutorial.
in case you'll need back-end upload , post translation jobs, have samples @ our github account.
update
show models without programming: can share a360 models on website, here steps:
- go a360 , sign in (or sign up)
- use existing project or create new one.
- inside project, click on upload , select file on machine. translation process start automatically. or can use existing files on project.
- on top-right icon, click on "share" option.
- on popup, go embed tab , select size. copy html , paste on website.
Comments
Post a Comment