question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Camera "zoom to all" target center of pysical model upon IFC import

See original GitHub issue

Hi

I am looking for a way that would move the camera to “zoom to all” (target the volumetric center of imported elements) and use that as a Orbitcontrol center upon import of IFC. This would make life a lot easier when it comes to viewing our IFC models that have a coordinate system that starts on a particular elevation. It should be noted that our exported model units are by default in millimeters. I’ve tried to follow a couple of examples I found online, but I am definitively doing this wrong.

I tried to modify example “00” by simply adding the following snippet of code to the “pick()” method in the “scene-picker.js” file in order to find a way to move the camera to the object I am clicking on. Note that I have little experience with threejs, so I might be violating some basic rules 😃

...
pickedObject.material = pickedObjectMaterial;
console.log(pickedObject._Data);

// Code for setting camera target to picked object
var target = pickedObject.geometry.boundingSphere.center;

console.log(target);

//camera.position.set(target);
camera.position.set(target+new THREE.Vector3(10,10,10));
camera.lookAt(new THREE.Vector3(target));
//camera.updateProjectionMatrix();

When I click on a beam (floating in the middle of nowhere as shown below) I end up apparently lost in space 😃

image

All I see is the grey background and I am unable to see my beam and I’ve lost sight of the grid making it difficult to figure out where I am 😦

image

The updated camera does however seem to be corrupt or broken in some (as shown in the console logging of the "camera"displaying NA values in the x,y,z coordinates)

image

I might be way off here, so it is much appreciated if anyone have any suggestions on where I ought to be looking or guidance on how I should debug or any related tips 😃 And any tips for where I should look to implement the same functionality as a final event after IFC import would also be much appreciated.

Great project btw 😃

Best Regards Kristoffer

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

1reaction
agviegascommented, May 26, 2021

This was already solved by @Voffknur.

1reaction
Krandecommented, Mar 9, 2021

Hello! Sorry, I haven’t had time to look more into this:( If you have a plan of how to implement this I think you will have a solution up and running much faster than what I can deliver 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Camera "zoom to all" target center of pysical model upon IFC ...
Hi I am looking for a way that would move the camera to "zoom to all" (target the volumetric center of imported elements)...
Read more >
Layer Conversion for IFC Import | User Guide Page
IFC Structural Analysis Model Import/Export - Experimental Feature ... Place All Elements on a Single “Active Layer” (Simulate AutoCAD Work Methods).
Read more >
Building Designer IFC Import - Bentley - Product Documentation
Ignore Story Containment — All IFC items are imported into the active DGN file when on. All items on each individual floor are...
Read more >
Viewport Controls - Unreal Engine Documentation
When zooming the camera, holding the RMB will hold the FOV, preventing it from snapping back to its default settings. The FOV will...
Read more >
IFC import and export in BricsCAD - Bricsys Help Center
To import an IFC file into your project, type Import in the Command line. The import file dialog box displays. · Select the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found