简体   繁体   English

在 Forge 查看器中更改文本

[英]Change Text in Forge Viewer

quick question, I'm tying to see if there's an option to change text (layer) in forge viewer via script For example to change language or toggle between Metric and Imperial快速提问,我想看看是否可以选择通过脚本更改伪造查看器中的文本(图层)例如更改语言或在公制和英制之间切换

images:图片:

Forge Viewer :锻造查看器:

在此处输入图片说明

Autocad : AutoCAD :

在此处输入图片说明

my other option is to have a layer for each option, but I'm not sure that's my best option我的另一个选择是为每个选项设置一个图层,但我不确定这是我最好的选择

Thanks谢谢

Unfortunately once the model data (both geometry and properties) is extracted it stays immutable so it's not exactly possible to modify the model after it's converted by Forge.不幸的是,一旦模型数据(几何和属性)被提取出来,它就保持不变,因此在模型被 Forge 转换后不可能修改模型。

One possible workaround would be to hide the text (find its node id(dbid) and do viewer.hide(dbid) ) and programmatically text markups (using Viewer's built-in markups extension ) to display the desired text, say eg:一种可能的解决方法是隐藏文本(找到其节点 id(dbid) 并执行viewer.hide(dbid) )并以编程方式文本标记(使用查看器的内置标记扩展)以显示所需的文本,例如:

 //programmatically create text markups:
 const styleObject = Autodesk.Viewing.Extensions.Markups.Core.Utils.createStyle(['font-size'], window.ext);
 styleObject['font-size'] = 100;
 (new Autodesk.Viewing.Extensions.Markups.Core.CreateText(window.ext, 2333, {x:20,y:20}, {x:100,y:100},'233', styleObject)).execute()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM