Please let us know if you know.
I am having trouble getting the floor level and height when converting the NWD file to SVF.
If the RVT file is converted to SVF, the value can be obtained from the AEC data (the method below). Is there an alternative method?
"getDocumentNode().getAecModelData().levels"
I think you are right the feature of getAecModelData applies with Revit file only. If it is a Navisworks file, the level or room of Revit file has been extracted, and the related information is attached as properties of the objects. So you could use Search method of Forge Viewer to get out all objects in one level, and get their merged bounding box, which can be the value for the range of a level.
If the browser nodes name have contained some keyword with 'level', you could simply get out those objects in one level by their names. Similarly, get their merged bounding box, which can be the value for the range of a level. One sample is produced by our team, which is based on such model.
https://forge-rcdb.autodesk.io/configurator?id=5a7185a92a0a7aeb152725d5
The source code is available at Level Extension of RCDB Sample. It can also be a reference for you on how to get merged boundingbox, and how to view the level by sectioning feature.
Related
I have tried couple of methods loading a DWF model in Forge viewer (v7):
using Autodesk.DWF
translating using Derivative APIs
With both methods, the whole properties are combined together into one single Tab, although the initial model has separate tabs for item properties.
When I open the DWF file in Navisworks I can see those tabs.
I have also noticed when I downloaded the parts (after translating) the properties.db is 0kb but there is a section_properties.db file which has the data. the 'category' field (_objects_Attr table) for item properties is empty (except for internal Forge fields that start and with __)
Is there any way to preserve the tabs (categories) when translating the model?
Thanks,
Afshin
EDIT 1:
This is the image from Forge viewer, there is no category:
This is from original dwf file, same item selected, with properties id different tabs:
I have developed an application that gets the JSON object tree of a BIM 360 revit model's view, using the Forge Model Derivative endpoint, then downloads the SQLite PropertyDatabase to query properties of several object tree entities. That was working fine until now. Recently, I am having trouble with some models where the object tree derivative object ids don't match the PropertyDatabase object ids.
I have seen this post Temporary workaround for mapping between SVF1 and SVF2 IDs but this method is not valid in my case because my app works on the server side and not uses viewer API at all.
My question is: if there is a workaround using APIs from the server side, and if there are plans to solve this inconsistency between APIs shortly.
Unfortunately, this behaviour is expected with your approach. SVF and SVF2 do not share the same IDs, SVF2 IDs are optimised to process data faster and to try keeping them identical across versions. The article you make reference to is only working in the context of the Viewer, for server side processing you need to get the dbid.idx file to map IDs. This utility has a command to help you downloading the file. Try:
./forge.js version-svf2-idmap project_id version_id output_dbid.idx
This file is a gzip compressed file of a uint32 array.
What happened is that you did download the SVF SQLlite db using SVF ids. But when using the MD endpoints, you actually using the SVF2 ids because the target format is SVF2. If you did request a SVF target format, the MD endpoint would work with SVF ids. Unfortunately, you do not control BIM360 target format which could either be SVF or SVF2 depending of the source file format. For example, IFC, RVT, NWD, DWG are SVF2, but others are not. You can determine which format is used by reading the outputType and overrideOutputType. If overrideOutputType says 'svf2', then you should do the mapping.
The relevant code for the version-svf2-idmap is here
On the other hand, if you got the SQLite database, why do you need to call the MD endpoints, you got everything you need, and can extract the information much faster from there. See my example here. It has functions for properties extraction, and/or building the hierarchy tree.
I am trying to convert a SVF using linked Revit files. I uploaded a zip to model derivative API which contains all the Revit files.
After conversion, the revit files are combined into one single SVF, but I discovered that at least some of the objects might be duplicated in a weird way.
For example, I have an object which have an unique attribute defined. When I select that object, I can see its position inside the model browser, as well as its properties. (Screenshot 1)
When I try to search in the whole model using that unique attribute, I discovered that another object has the same attribute and properties. When I try to select it using its dbId, I found that the object is invisible in the model, and it does not show where does it belong inside the model browser. (Screenshot 2)
Any idea why is there a duplicated object inside the SVF? Thanks.
I've been asked to insert an .IFC viewer into a web page already built, to:
explode building visualization into floors
rotate the building
colour spaces based on their temperature
add labels to objects
load .ifc files stored on private servers
Does autodesk viewer meet those requirements? All of them?
Additionaly, is it feasible to change the viewer language through a config file or specific functions?
explode building visualization into floors
The built-in explosion is by model components and not floors and there's option right out of box to specify a granularity level.
Nonetheless you can use viewer.cutplanes (see doc here) to isolate the levels and go from there - see sample here.
rotate the building
This can be done by either THREE.js transformation or Viewer's model load options:
THREE.js: Perform transformation recursively by traversing all children components under the model's root dbid. See this great article here for enlightenment.
Load option - see live sample here:
var options = {
placementTransform:THREE.matrix4,
globalOffset:{x:0,y:0,z:0}
};
viewer.start(svfURL, options)
colour spaces based on their temperature
Use viewer.setThemingColor (see doc here) to apply temperature colors - find the parent dbid of the room or and use the recursive flag to apply color to all its children components. See code sample here.
add labels to objects
See here for details and a few helpful links at the start of the article.
load .ifc files stored on private servers
You can download the translated derivatives (SVF and its resources - obtain a manifest of them from GET :urn/manifest) to your own storage locations and load them by their URL directly. See my live code sample above for details and find the source code for our online extractor tool (http://extract.autodesk.io) here for ideas to download the derivatives.
is it feasible to change the viewer language through a config file or specific functions?
Viewer implements the i18n standards so you can do:
Autodesk.Viewing.i18n.setLng('fr');
Autodesk.Viewing.i18n.localize()
When I query element properties in Autodesk forge for a model that is based on NWD file, I only get small set of the element properties than what I see in NavisWorks Manage. On the other hand, when I query the properties for models based on Revit rvt files, I can see all the properties. Is there anyway to get the full properties for nwd files?
Just to clarify, I am asking about properties that are already in the NWD file and I can see it in Navisworks.
Thanks in advance
You can set viewer selection mode by
viewer.setSelectionMode(Autodesk.Viewing.SelectionMode.FIRST_OBJECT)
and then you can get the properties you want.
There are 3 different type: FIRST_OBJECT, LAST_OBJECT, LEAF_OBJECT. the default is LEAF_OBJECT .
The Model Derivative API will only extract information available on the original file, there are no settings on this process (e.g. which properties to extract), except selecting 2D or 3D views.
If you need information as presented in Revit, then consider using the .RVT file.