Skip to main content
Solved

Learn Cognite 3D Model


Forum|alt.badge.img+3

Learn Cognite 3d model, focus object, fit camera, search assets highlight object etc..

Best answer by Lars Moastuen

pramod.s wrote:

To focus at a clicked object in Reveal, you can do

  1. Get “Point intersection with the object” using Cognite3DViewer.getIntersectionFromPixel(offsetX, offsetY).
  2. Create a bounding box around intersection point like

    const boundingBox = new THREE.Box3();
    boundingBox.setFromCenterAndSize(intersection.point, new THREE.Vector3(1, 1, 1));
  3.  Use this bounding box in Cognite3DViewer.fitCameraToBoundingBox()
    viewer.fitCameraToBoundingBox(boundingBox, 250);

     

Note that rather than using bounding box directly from the CDF API, it’s recommended to use https://cognitedata.github.io/reveal-docs/docs/api/classes/cognite_reveal.CogniteCadModel#getboundingboxbynodeid to get bounding box for a given node as this accounts for any transformation active on the model.

View original
Did this topic help you find an answer to your question?

27 replies

Forum|alt.badge.img+3
  1. How to search object through assets ?
  2. How to focus object?

 


Forum|alt.badge.img+3

How to use fitCameraToBoundingBox method? please share some info.

https://cognitedata.github.io/reveal-docs/docs/api/classes/cognite_reveal.DefaultCameraManager


  • Practitioner
  • 15 replies
  • February 8, 2023

To focus at a clicked object in Reveal, you can do

  1. Get “Point intersection with the object” using Cognite3DViewer.getIntersectionFromPixel(offsetX, offsetY).
  2. Create a bounding box around intersection point like

    const boundingBox = new THREE.Box3();
    boundingBox.setFromCenterAndSize(intersection.point, new THREE.Vector3(1, 1, 1));
  3.  Use this bounding box in Cognite3DViewer.fitCameraToBoundingBox()
    viewer.fitCameraToBoundingBox(boundingBox, 250);

     


Lars Moastuen
Seasoned Practitioner
  • Seasoned Practitioner
  • 67 replies
  • Answer
  • February 8, 2023
pramod.s wrote:

To focus at a clicked object in Reveal, you can do

  1. Get “Point intersection with the object” using Cognite3DViewer.getIntersectionFromPixel(offsetX, offsetY).
  2. Create a bounding box around intersection point like

    const boundingBox = new THREE.Box3();
    boundingBox.setFromCenterAndSize(intersection.point, new THREE.Vector3(1, 1, 1));
  3.  Use this bounding box in Cognite3DViewer.fitCameraToBoundingBox()
    viewer.fitCameraToBoundingBox(boundingBox, 250);

     

Note that rather than using bounding box directly from the CDF API, it’s recommended to use https://cognitedata.github.io/reveal-docs/docs/api/classes/cognite_reveal.CogniteCadModel#getboundingboxbynodeid to get bounding box for a given node as this accounts for any transformation active on the model.


Forum|alt.badge.img+3

thank you so mush, its working


Forum|alt.badge.img+3

  • Practitioner
  • 15 replies
  • February 9, 2023
Karthik Kaliyaperumal wrote:

https://cognitedata.github.io/reveal-docs/docs/examples/click-reactions-cad

 

How to enable and disable mouse click event?

 

The documentation page you referred https://cognitedata.github.io/reveal-docs/docs/examples/click-reactions-cad/ shows how to enable mouse click event “viewer.on(‘click’, callbackFn)”, to disable, unsubscribe the event using “viewer.off(‘click’, callbackFn)”


Forum|alt.badge.img+3

Karthik Kaliyaperumal wrote:

Hey, seems to be a small bug in our documentation. You need to await the viewer.add360ImageSet(...) method as it returns a promise.


Forum|alt.badge.img+3

I add await but again error comming.


  • Practitioner
  • 15 replies
  • February 10, 2023
Karthik Kaliyaperumal wrote:

I add await but again error comming.

Can you confirm if 360 images are loaded?


Forum|alt.badge.img+3

It return empty object.

I have 3d Model

I try to achieve add circle then click rotate camera.

 


Karthik Kaliyaperumal wrote:

I add await but again error comming.



Which version of Reveal are you using? Image360Collection.on(...) was recently introduced in Reveal 4.1.0.


Forum|alt.badge.img+3

My version is  "@cognite/reveal": "^4.0.0",


Karthik Kaliyaperumal wrote:

My version is  "@cognite/reveal": "^4.0.0",

Ok, please update the dependency (as yarn.lock / npm.lock may still have 4.0.0 set).


Forum|alt.badge.img+3

please share sample code.


Karthik Kaliyaperumal wrote:

please share sample code.

Documentation covering 360 images can be found here: https://cognitedata.github.io/reveal-docs/docs/examples/image360


Forum|alt.badge.img+3

1.what is site_id ?

2.how to find site_id?


  • Practitioner
  • 15 replies
  • February 13, 2023
Karthik Kaliyaperumal wrote:

1.what is site_id ?

2.how to find site_id?

Documentation about 360 images data is available at https://docs.cognite.com/cdf/3d/guides/360images_upload/, you will find required details related to site_id & more about 360 image data


Forum|alt.badge.img+3

Hi. Please share image uploaded site_id.


Lars Moastuen
Seasoned Practitioner
  • Seasoned Practitioner
  • 67 replies
  • February 14, 2023

Unfortunately there are no 360 images available in the demo project currently.


Forum|alt.badge.img+3

ok, thanks


Forum|alt.badge.img+3
  1. I would like to know how an Asset id is connected to its respective 3D model 

  • Practitioner
  • 15 replies
  • February 16, 2023
Karthik Kaliyaperumal wrote:
  1. I would like to know how an Asset id is connected to its respective 3D model 

Details of CDF assets with 3D models is available in documentation at https://cognitedata.github.io/reveal-docs/docs/api/classes/cognite_reveal.AssetNodeCollection/


Forum|alt.badge.img+3

Assets API

https://docs.cognite.com/api/v1/#tag/Assets

3d Model API

https://docs.cognite.com/api/v1/#tag/3D-Models/operation/get3DModels

I have assets id, The Assets id connected to its respective 3d model

Please share Which API I call.


Reply


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings