Using Autodesk Forge, How do I get dimension objects and their properties from a Revit Plan view? - autodesk-forge

In Revit, I have dimensions on floor plans and elevations. I need to get at those dimensions and their properties to see if the user had overridden the value. Is this possible using Forge? I've only been able to get the objects and properties for items in the 3D view, not any plans, elevations, etc.

It's a known wishlist item (CF-4851) in our internal case system.
Unfortunately, 2D elements such as dimensions, texts, notes, grids, and sections in plan views and elevation views are not supported by Forge MD currently. Consequently, there are no concrete elements, they aren't clickable and no object properties in the Forge Viewer as I know.

Related

Autodesk: How can I add units to CalibrationPanels.js of Forge Viewer?

I am working in an app that use Autodesk Forge Viewer, which has its own calibration panel to do measurements in 2D plans (like PDF or DWG files).
This panel (by default) only displays these 5 units ('ft and fractional in', 'ft and decimal in', 'meters', 'centimeters' and 'millimeters')
I attach an image of the calibration panel of Forge Viewer:
https://i.stack.imgur.com/YmSxf.png
I know that these units are declared in the CalibrationPanels.js of Autodesk libraries
Image from Forge component code:
https://i.stack.imgur.com/ZMTeS.png
But the question is... how can I change the unit list to display another units, for example, to add new units or to remove the default ones?
Customizing the list of units is not possible currently. If you need another common unit, feel free to suggest it here and we would pass it along to the viewer engineering team.

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.

crop particular room/area from the forge viewer

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

Forge viewer displays elements blurry in 2D views and the Measure extension does not work on them

For some of our Revit models, in Forge viewer, 2D views are display blurry, no element can be selected and the Measure extension does not work on elements and only works on the dimensions and the titleblock.
Like this example:
here and here
But it should be like this
I have tested it with our viewer, A360 viewer and Autodesk Forge Tools vscode extension.
This is because 2D drawings or PDFs can contain both vector graphics and raster graphics (this article explains the difference between the two). The measure extension needs vector graphics in order to work properly.
Thanks to Petr Broz and his hint, by changing the Model Display Style in Revit side to Hidden Line instead of Shaded the problem was solved.
Like this.
Update:
The Shadows in Graphic Display Options, also should be unchecked.

Exporting markup data in RVT/CAD format

I am using Autodesk Markupscore Extension to draw markups on 2D view. I want to create a separate rvt or CAD file for the drawn markup, which can further be used/opened in Revit soft. So the newly created 2D view(rvt/CAD) will contain only that part of 2D view which is inside the drawn markup, How can I achieve this?
I can't comment on the Revit specific piece (for that I would suggest that you check out the Revit discussion forums) but if we're talking about where Forge can help, I see two options:
you could have a Revit plugin running in the Forge Design Automation service, accepting a Revit document and some coordinates of 2D markups on the input, removing design elements that are outside of the 2D markups via Revit APIs, and generating a new Revit document on the output.
you could customize Forge Viewer to hide or occlude the parts of the 2D drawings you don't want to be visible, for example, by "hiding" them (making them semi-transparent), by changing their color, or by overlaying them with another content such as a blank SVG rectangle.