0

I would like to aggregate multiple 2D sheets within same scene of Forge viewer. Testing with the legendary "Office" model so it's easy for you to reproduce. When loading sheet1 everything is ok, when loading a second sheet the sheet itself completely overlap the sheet1 so none of the entities on sheet1 are visible any more. Any workaround for that?

Yes, I am using the keepCurrentModels: true:

const loadOptions = {
  keepCurrentModels: true,
  preserveView: true
}

viewer.loadDocumentNode(doc, viewable, loadOptions)

enter image description here

enter image description here

halfer
  • 19,824
  • 17
  • 99
  • 186
Felipe
  • 4,325
  • 1
  • 14
  • 19

4 Answers4

1

(ie. from tip#4 above)

To overlay 2 different sheets on top of each other, using the two sheets example above, see the image below and this code snippet:

Use the model browser to hide/show each layer (in the image, there are two models):

            view.viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, target => {

              if (target.model.id > 1)
                target.model.getFragmentList().vizflags[0] = 0;
            })

2 sheets overlay

Notes:

To make everything 'selectable', do the following:

  1. add white 'empty' 2D sheet, as backdrop
  2. add all other sheets on top
  3. set each sheet's vizFlags[0]=0, except for the 'empty' sheet

Blog post coming! ;-)

michael beale
  • 1,014
  • 1
  • 6
  • 5
0

Unfortunately as things were before it is not yet possible to aggregate 2D sheets with Viewer so as a workaround you’d need to made do with multiple Viewer instances in parallel on one page and try achieve overlapping with CSS settings (which is a bit hacky obviously this approach has its limitations as the geometry and events wouldn’t get aggregated)

Viewer might support this going forward so stay tuned to our official blog for updates.

P.S.: Michael Beale is putting together a blog on the aggregatedView tool to support fast switching between sheets so stay tuned.

Bryan Huang
  • 5,247
  • 2
  • 15
  • 20
  • Thanks for the heads up. Some 2d drawings come with a background sheet (for example dwg's extracted from revit project) and some don't for example this acad sample: https://furrerfrey.cloud/viewer?id=5b7adf6f599cca1f51ea3a75&db=ff. So is there a way to control that or get rid of the background sheet (hide visibility) directly in the viewer? – Felipe Apr 01 '20 at 07:57
  • Actually, there are two ways to combine 2D sheets in the viewer... 1. use split view (and create 2 camera states for each viewport) 2. use AggregateView class (see my answer above) – michael beale Apr 01 '20 at 20:31
0

I have three tips for multi-model. I'm writing a blog post on it.

The first tip: To get side-by-side-2d-sheets, I changed the placementTransform in the options3D.

side-by-side-2d-sheets

placement transform notes: https://forge.autodesk.com/blog/loading-multiple-models-forge-viewer-v7

For the gif above, I switched over to using AggregateView Class. It's seems like it could be a cleaner API for handling multi-models in the future.

Additional multi-model Tips

(coming in a new blog post, soon):

Tip 2. Hypermodeling - combining 3D models and 2D sheets inside the 3D scene

hypermodeling

Tip 3. Fast view-switching (between 2D sheets)

Tip 4. Hiding the white background of a 2D sheet (used mostly when compositing inside a 3D scene).

Notes: To blend background image, would you be looking for tip#4 ?

michael beale
  • 1,014
  • 1
  • 6
  • 5
  • It's really about overlaying 2d entities coming from 2 different drawings, eg. the floor plan with walls and pipes coming from a different documents. So none of the options work I believe. – Felipe Apr 01 '20 at 21:42
  • added additional answer (tip #4) – michael beale Apr 01 '20 at 22:04
  • @michaelbeale could you please share the blog post created for #2. I already am achieving this but by adding some transform. Want to see if there is a cleaner solution for it though. – shivaramanaiyer May 26 '21 at 14:07
0

Did you try modelSpace:true in the options ?

let options = { placementTransform: new window.THREE.Matrix4(), modelSpace: true, globalOffset: { x: 0, y: 0, z: 0 }, applyRefPoint: true, isAEC: true, // to align the models, }

More details here:

Autodesk forge viewer api v7.* align multiple 2d dwg models

michael beale
  • 1,014
  • 1
  • 6
  • 5