Alisa Bondarchuk
Alisa Bondarchuk

Reputation: 67

How to paint the differences in red?

I create a website using Forge-Viewer, it implements loading several models in one window, as shown in this article https://forge.autodesk.com/blog/aggregate-multi-models-sequence-forge-viewer. I need to select two, almost identical files, which differ from each other only by the properties of one element, and paint over these differences in red. How can I paint the differences between two identical uploaded files red?

This is for a new site. I have already tried all the methods and recommendations available on the Internet,but none of them helped me solve my problem.

My code is fully consistent with the code from this source https://github.com/Autodesk-Forge/learn.forge.viewmodels/tree/nodejs https://forge.autodesk.com/blog/aggregate-multi-models-sequence-forge-viewer

I expect that I can finally paint the differences in red, but so far I have failed.

Upvotes: 0

Views: 118

Answers (1)

Bryan Huang
Bryan Huang

Reputation: 5342

One possible approach would be to compare the properties by querying the viewer.model.getBulkProperties (dev doc here) or viewer.search (dev doc here) interface (whichever works better depending on your specific use cases) and to make external IDs:

let model = viewer.impl.modelQueue().findModel(modelId) || viewer.impl.modelQueue().getModels()[modelSequence] //Set the model to query against

model.getBulkProperties(dbid,['propname1','propnam2'],rst=>{...},err=>{...}) //Retrieve the properties with filtering conditions and compare them

model.search('keywords',dbids=>{...}, err=>{...}) //Query dbids with properties matching keywords

Then take the dbids with discrepancies and highlight them with a theming color (dev doc here):

viewer.setThemingColor(dbid, THREE.Vector4, model)

Upvotes: 1

Related Questions