简体   繁体   中英

combine model on Autodesk Forge

I have couple of questions about combine model on forge viewer (load list urn to 1 viewer):

  1. when i combine model. i only can get data from 1 main model in that combine. for instance, var instanceTree = GlobalViewer.model.getData().instanceTree; var allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex); var list = allDbIdsStr.map(function (id) { return parseInt(id) }); list will return all dbid of main model, how can i access all data of all model when i combine?
  2. what is the unique id for object in combine model. i do some function with dbid and i realize it can appear in others model too.
  3. When i combine 3d model(revit) with 2d model(autocad). it has 2 case: if 3d model load first i can rotate like normal, if 2d model load first i cant rotate the model any more. how can i force it always can rotate?
  4. Autocad unit seems different with model in viewer. it always scale down compare with the model. how can i fix that?

Appreciate any comments,

Regarding #1: viewer.model obviously only references one of the models (I believe it's the last one you loaded), but you can use viewer.getVisibleModels() or viewer.getHiddenModels() to get other loaded models as well.

Regarding #2: dbIDs are only unique within a single model; many of the viewer methods accept an additional parameter specifying the model on which to operate, for example, you could say viewer.select([123, 456], oneOfMyModels) .

Regarding #3: that's a good question; loading a 2D model first puts the viewer into 2D viewing mode (where only zoom and pan is allowed); if you know you will be working with 3D models, I'd recommend always loading those first

Regarding #4: yes, each loaded model can have different units; when loading a model using the loadDocumentNode method you can specify additional options (for example, a placement transform for the loaded geometries), and one of them is an object called applyScaling , for example, like so:

viewer.loadDocumentNode(doc, viewable, {
    applyScaling: { to: 'mm' }
});

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