简体   繁体   中英

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 :

在此处输入图片说明

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.

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:

 //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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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