How to get the coordinate information of the model in View

how to get coordinate information in Viewer?

Jul.07,2022

do you need the coordinates of the component, or some other coordinate information? If it is a component, viewer loads geometric patches, not the design software has the so-called 'location' information.

viewer provides the transformation matrix information of the component, which can be obtained through the following code. If you just want to have a reference point, consider using the center of the box, which is also demonstrated in the following code:

var dbid = 1234;
var bounds = new THREE.Box3();
var box = new THREE.Box3();
var instanceTree = NOP_VIEWER.impl.model.getData().instanceTree;
var fragList = NOP_VIEWER.impl.model.getFragmentList();

instanceTree.enumNodeFragments(dbid, function (fragId) {
   console.log('fragId:' + fragId);

   //
   fragList.getWorldBounds(fragId, box)
   //
   bounds.union(box);
             
   //
   //
   //
   var fm = new THREE.Matrix4();
   fragList.getWorldMatrix(fragId,fm);
   console.log('frag matrix:' + JSON.stringify(fm));  
 }, true)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ed4f55-3515.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ed4f55-3515.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?