Forge Viewer loading multiple Revit models with shared coordinates

故事扮演 提交于 2020-04-30 14:12:40

问题


When loading Revit models which are aligned by shared coordinates, the models does not align in Forge Viewer with globallOffset settings.

The loadModel with placementTransform option seems to be viable, but the shared coordinates data is not made available until after the model is loaded, via viewer.model.getDocumentNode().getAecModelData().refPointTransformation

earliest I have the model data is inside the onLoadModelSuccess which is too late to feed into the load options, and will require to transform the geometries.

var modelOptions = {
  sharedPropertyDbPath: doc.getPropertyDbPath(),
  globalOffset: offset,
  placementTranform: ???,
  isAEC: true
};

viewer.loadModel(svfUrl, modelOptions, onLoadModelSuccess, onLoadModelError);

How would it be possible to align the models otherwise? Or maybe to load the model without rendering the geometry first to get the data then feed the transform matrix into another loadModel call?


回答1:


Use the following two options together to apply Revit shared coords:

  • globalOffset - tells LMV not to auto centre model
  • applyRefPoint - tells LMV how to apply any svf positioning meta-data for Revit files

So try the below in your load options:

var modelOptions = {
  sharedPropertyDbPath: doc.getPropertyDbPath(),
  globalOffset: offset,
  applyRefPoint: true,
  isAEC: true
};

And see this live sample here for usage reference on the placementTranform option.



来源:https://stackoverflow.com/questions/57051256/forge-viewer-loading-multiple-revit-models-with-shared-coordinates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!