crop particular room/area from the forge viewer - autodesk-forge

We are using forge viewer(v7) in our web application.
Our requirement is to crop particular room/area from the forge viewer. For example, if we have shown a house model in the forge viewer then if a user select a kitchen(from menu or navbar) then the viewer should show only kitchen area (including all its objects like cabinets, burner, fridge, sink etc.) and all other objects/sections should be hidden. Similarly for bedrooms, baths etc. It will be just for viewing purpose at run time and not for any automation.
Does any help that how can we achieve this?

You could use the SectionExtension - mentioned here:
Create a section plane leaning against one object
Documented here:
https://forge.autodesk.com/en/docs/viewer/v7/reference/Extensions/SectionExtension/
This also has a function called setSectionBox(box) which might be best for what you want.
If you can figure out the extents of the room then you could pass those values to it.
Here is a blog post on getting room related information extracted to SVF:
https://forge.autodesk.com/blog/new-rvt-svf-model-derivative-parameter-generates-additional-content-including-rooms-and-spaces
The other option would be to find all the objects inside the given room and hide everything else. If there is a property for each object that specifies which room they are in, then you could do it based on that using Viewer.search()

Related

Is it possible to combine Information from GeoJSON with api-endpoint dynamically?

I am currently working on a Next.js-project, but I’m just a beginner.
My Web-application should display a react-leaflet-map with clickable tiles.
I am using wordpress headless with Next.js. Inside wordpress I use woocommerce. So each of my clickable tiles represents a single product. I also use the woocommerce api to get the meta-information from my products. Is there a way to connect the GeoJSON, which displays the tiles, and the endpoint of my products? Both should basically be JSON-files (or at least they can both be represented in a JSON-file). I tried to manually add some product-infos to the GeoJSON, but this makes it static and not dynamic.
Maybe I could loop the infos of the endpoint though the tiles in GeoJSON?
My goal is to click a tile and then render all the (important) product-infos (my tiles are the products). And when I change something on wordpress e.g. a picture of a tile/product it should be automatically be updated in the GeoJSON. Does anybody have an idea how to realize something like that?
Here I have screenshots of my product-endpoint and my GeoJSON-file. They generally have a similar structure (Same amount of tiles as products)
geojson
endpoint
Thank you so much in advance!

How to change the geometry of the two selected models?

I know getSelection() is get the db id of seletion model.
but after this i don't know how to control this viewer.
There are two windows selected by the viewer.
I want to change the geometry of the two windows.
Forge Viewer is open Revit file by my bucket.
viewer.getSelection()
=>(3) [3043, 3055]//how to?
Unfortunately, the viewer isn't designed to support geometry modification. You can modify your design elements in these ways:
changing their position, orientation, or scale (blog)
hiding them, and potentially inserting your own custom three.js geometry instead (tutorial)
changing their materials, incl. using custom shaders (blog)
But if you actually need to tweak the individual vertices of the mesh geometry, that would be very difficult to do.

Forge Viewer Cut model Level Wise

I am using viewer 7.* and I wanted to cut the model so that I only get to see a level.
i.e. If I select level 1 as lower bound and level 2 as upper bound I only get level 1 element in the viewer.
I am able to retrieve level information from aec data.
Please Help me with this.
For set cut planes by levels, please check my example here: https://github.com/yiskang/learn.forge.viewmodels/blob/nodejs-level-sectioning/public/js/AdnLevelSectionPanel.js
And check this PDF which illustrates the sectioning concept: https://github.com/yiskang/forge-au-sample/blob/master/level-section/docs/Forge%20Viewer%20Sectioning.pdf
BTW, you can also load the Autodesk.AEC.LevelsExtension directly to view the model by levels.(required AecModelData for Revit 2018 and later)
Hope it helps

Section floor view - Forge Viewer

I want to be able to filter my uploaded Revit buildings to display certain floors (e.g. basement, first floor, roof). I am aware that I can section the view from the toolbar but I want to section the view by tapping buttons (in my case, tree buttons: Basement - Floor - Roof).
I have been looking at this tutorial:
https://developer.autodesk.com/en/docs/viewer/v2/tutorials/basic-application/
But here I'd need to upload pre-sectioned models of all the tree views. Is there any other way, or would I go with the option from the tutorial?
You can control the section planes from the API, so you could create buttons that invoke the API and control how section planes are being set. Take a look at setCutPlanes method in the viewer API documentation.
Here is an article that illustrates how to use this method: Viewer setCutPlanes
You can also take a look at this blog post that expose how I used ThreeCSG (Constructive solid geometry) to perform boolean operations in the viewer and isolate walls specific to each floor: Boolean Operations in the Forge Viewer.
Hope that helps.

Autodesk Forge - Initial focus on 3d view

our initial focus within our 3d views needs tweaking. Currently it is zoomed out ~x2 too far.
Can anyone get me started in the right direction for the controls for this?
I've tried changing the cropregion/ section box etc in the original revit model, but that hasn't made a difference.
A simple way to handle that would be to position the camera as you wish then save the current state and restore it upon loading the model, see my blog post about managing viewer states: Managing viewer states from the API