We are trying to convert Revit(.rvt) file to SVF so that we can view this file in viewer, for this we are using forge API and PHP. But when we execute cURL command to get SVF, getting NULL result.
We are using following steps -
Authentication
Created a app
Using 3-Legged Token
Data Management API
We are using 'Download a File' tutorial to get URN of a file form A360 drive. Link - https://developer.autodesk.com/en/docs/data/v2/tutorials/download-file/ At fifth step we are getting file URN with version - $revitFileURN = 'urn:adsk.wipprod:fs.file:vf.2tIxruH7Qpuhai7__Z982g?version=1'; Now we are using this URN to prepare this file to Viewer, for this we need SVF file. Link - https://developer.autodesk.com/en/docs/model-derivative/v2/tutorials/prepare-file-for-viewer/
Prepare a File for the Viewer
Converted the source URN into a Base64-Encoded URN :
$revitFileURNEncoded = base64_encode ( $revitFileURN );
Creation Data array
$dataValue = array("input" => array ("urn" =>$revitFileURNEncoded ), "output"=>array("formats"=>array(array("type"=>"svf","views"=>array("2d","3D"))))); $data_string = http_build_query($dataValue);
Header array creation
$strHeader=array(); $strHeader[]='Authorization: Bearer '.$AccessToken; $strHeader[]='Content-Type: application/json';
cURL execution -
curl_setopt_array($curlTranslateFileToSVF, array( CURLOPT_URL => $url, CURLOPT_POSTFIELDS =>$data_string, CURLOPT_POST => 1, CURLOPT_HTTPHEADER=>$strHeader, CURLOPT_RETURNTRANSFER=>true )); $curlTranslateFileToSVFResponse = curl_exec($curlTranslateFileToSVF ); curl_close($curlTranslateFileToSVF);
We are getting NULL in $curlTranslateFileToSVFResponse
Please guide -
- How to get SVF file
- How to view this SVF file in browser