Does Autodesk Viewer meet those requirements? - autodesk-forge

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

Related

Viewing DWFX in Forge - Properties

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:

Make and save change into Forge Autodesk Viewer

I need to view files with the autodesk viewer and make and save the changes. I wonder if it is possible to do it directly through the Forge API I thought to apply, once the waterfall viewer is loaded, all the preloaded changes in an internal database
The changes I would like to make are of the type:
adding a room,
addition of mesh
addition of successively recoverable properties
addition of other 3D models preloaded in forge
Since all property data and the SVF itself (or any derivatives for that matter) is immutable once extracted so I am afraid you'd need to programmatically append the mesh (try SceneBuilder to make things easier) every time the model is loaded ... As for the properties it's possible to use your own data source for persistence though - see a case in point here and here
To persist any change to the original design file would require translating the model again for Viewer to consume the changes - however this process can be automated using our Design Automation service and Webhooks ... see here to get started.
One possible workaround to persist your custom geometry would be to convert your geometry to OBJ and then SVF with the Model Derivative service (for course that'd incur costs ...) and then load it to Viewer and aggregate with the original model...

How to load longitude and latitude information into cesium kmlDataSource?

I want to display the kml file in cesium globe, and as described in the cesium's workshop code, we need to load the file by passing it with the file location (or URL). The following line of code is the specific line of code that cesium loads the kml.
var geocachePromise = Cesium.KmlDataSource.load('./Source/SampleData/sampleGeocacheLocations.kml', kmlOptions);
The entire code is available here
My question is: I have the longitude, and latitude, (and height) information saved in variables and instead of always saving them into .kml file and then load them via folder, I want to pass this information to cesium kmlDataSource (the code above) directly.
It would be great if anyone has any solution to this.
Please let me know if further information or code snapshot is required. Thanks
If you already have the information you need stored in JavaScript variables, there's no need to export to KML and import it back into Cesium. You can directly add the indicators you need as Cesium Entities, which is what the KML loader is creating when it reads a KML.
Typically, a KML-like pin is represented by a Cesium Entity containing either a point or a billboard, and optionally an associated label.
Here are some relevant demos that show how this is done:
Billboard demo
Map Pin demo
Label demo
Each of these demos calls viewer.entities.add({ ... }) along with a position for the Entity and some sort of graphical indication(s) to display to the user. You may place one of each on an Entity, for example a billboard and a label are often both defined when adding a typical KML-like Entity.
If your data is stored on the server however, you will need some mechanism to stream it to the browser. CZML is Cesium's native format for doing so, but KML is also available as an alternative for certain kinds of graphics. You may also use any API of your own design, and create Entities when the data becomes available in JavaScript.

Element properties for nwd files in Autodesk Forge

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.

Finding externalId with a Forge API without loading viewer

I have been playing around with the C# DerivativesApi and I'm able to get model view meta data and properties. But I cannot find the externalId value. Is it possible to get this value without lodiang a viewer?
If the original model is from Revit this value contains the GUID of the element and it would be very useful for me to have easy access to this value.
As of now (April 2017) this information is only available on Viewer. We're currently investigating to have this exposed. A workaround is to download the Viewer JSON and extract the information.
To add a little more precisions to what Augusto mentioned, you can use take a look at what extract server is doing in downloadBubble and perform the same without viewer interaction. Once you downloaded the resources, you will find a *.db or *.sdb file which is an SQL lite database from where you can read mappings from dbIds to externalIds.
Unfortunately we don't have a sample that illustrates that workflow.
Hope that helps