自动桌面 forge 查看器 v7 - 设置Theming Color
原标题:Autodesk Forge Viewer v7 - setThemingColor
I hope somebody can help me with a question about the setThemingColor function for the Autodesk Forge Viewer.
Basically my issue is that when I run the
viewer.setThemingColor(dbId, new Vector4( 1, 1, 1, 1 ), null, true )
from within my code nothing happens, and the element does not get a new color.
What I have tried:
1) If I try to run exactly the same line of code in the browser on the NOP_VIEWER it works, but only if it is a new dbId and not the one which had just been run from within my code.
2) I have tried to make sure to find the leaf dbId and use this. Did not have any effect.
3) I have tried to add the model to the function call:
viewer.setThemingColor(dbId, new Vector4( 1, 1, 1, 1 ), model, true )
4) I have tried to run the function on the level of the model:
model.setThemingColor(dbId, new Vector4( 1, 1, 1, 1 ));
viewer.impl.invalidate(true);
5) I have from within my code tested viewer.isolate(dbId) to make sure I have access to the viewer instance. And this works.
Is anybody else experiencing the same issue or can replicate the bug? I hope somebody can help us out.
EDIT: More infor after Petr Broz answer:
"What version of the viewer are you using?": We are using v. 7.*
"Do you see any error logs in the console after setting the theming color?": I see no error logs.
"At what point in time are you trying to set the color (for example, after the GEOMETRY_LOADED_EVENT)?": I use a onClick event on button, so it is after GEOMETRY_LOADED_EVENT
ANSWER:
I found the solution. I had to import THREE as a global.
/* global THREE */
instead of
import {Vector4d} from "three"
最佳回答
Here s a quick codepen setting the theming color on a pre-configured dbID (roof of the house), using viewer version 7.* (currently 7.10): https://codepen.io/petrbroz/pen/WNbYXWz.
It d be helpful if we had some additional info, for example:
What version of the viewer are you using?
Do you see any error logs in the console after setting the theming color?
At what point in time are you trying to set the color (for example, after the GEOMETRY_LOADED_EVENT)?
Alternatively, if you don t mind sharing a live link to your app or your Forge app config, please send us an email to forge (dot) help (at) autodesk (dot) com, and we ll investigate the issue from our end.
问题回答
I have the same problem. Could you please explain what you mean with /* global THREE */ ?
相关问题
angleToTrueNorth is null for Navisworks translated model
When translating a Navisworks model to SVF, the value for angleToTrueNorth from model.getData().metadata[ custom values ].angleToTrueNorth is not available. Where else can I find it?
What is a uploadable maximum file size?
I tries uploading 200MB Solid works format file, and it worked out.
Don t consider request timeout issue. I will extend it to 30min
How about 500MB or 1GB?
If I can upload 500MB solid works file(or ...
Invalid switch [$(args[rvtFile].path)]. Variables that expand to paths must be quoted
Hi Autodesk Forge team,
I have issue with create activity need help with Design Automation. This is body I m tried to achive with a activity to extract room data, but have some wrong with command line....
Convert Urn from item version have problem
I m try to convert from item version get derivative urn but may be have something wrong. I know we are using base64 to encoder, but when I m try convert it have some missmatch:
Example:
I have item ...
Quick way to create central file in ACC from APS API
I m finding a API can easier to move around 100 files central download from diffrence project storage in local computer to new project, and what we are doing manual here is oepn Revit and save central ...
How to use WebProxy with Autodesk.Authentication using C#?
I was using Autodesk.forge and we have web proxy setting for this, but it is deprecated and replaced by Autodesk.authentication and i am not able to find any option to use a web proxy
I was using the ...
Changing Selection Mode in Auto Desk Forge Viewer through Settings
When we change the Selection Mode from "First Object" to "Leaf Object," the model loads quickly. However, when we switch back to "First Object" and check, the model loads ...
Inventor Pdf Translator SaveCopyAs SVxApp::CareForAllExceptions()
My APS activity has been producing PDFs many years. Starting last week some designs would work fine but today no scenario is working. This same code executes on my desktop just fine with Inventor 2020,...