I am trying to make a function that click a button in javascript to go to a specific location.
I want to use "viewer.isolate (dbid) or viewer.fitToView (dbid)".
(Is it possible with Autodesk Forge?)
How do I specify "dbid" when creating a dwg file with autodesk cad?
A dbId is defined when Forge translates your design files (whether it's AutoCAD, Inventor, SolidWorks, Revit, etc.) for the viewer, so you cannot really specify dbIds in the CAD application. You can however use the viewer APIs to search for objects with specific properties, for example, with a specific AutoCAD handle or with a specific Revit ID, and obtain the dbId that way.
Once you have a dbId of an object you're interested in, you can use any of the viewer APIs to select it, hide it, navigate to it, etc.
Related
In the attached image, the minimap circled in red can be selected as floor(level).
Is it possible to pre-select it before loading Forge3D viewer?
minimap
There are several ways in which you can control what exactly gets loaded into the viewer:
The Forge Model Derivative service can generate multiple outputs (also called "viewables" or "derivatives") for a single design file. For example, in case of Revit designs, the service generates separate viewables for each 3D view and each 2D sheet. So if you have control over the input design files, you could perhaps create a custom 3D view for each floor in the original design, and then instruct the viewer to load the specific viewable with your floor.
Forge Viewer loads an entire viewable by default but you can also configure it to only load a subset of geometries from a viewable. This is done by passing a list of object IDs to the loader as explained in this blog post: https://forge.autodesk.com/blog/minimizing-viewer-workloads-loading-models-partially-selected-components-and-features-only. Of course, this means that you would have to be able to identify objects belonging to a specific floor. That is a topic for another question, though.
I couldn't find Forge Viewer API demo site and don't know what it looks like. I appreciate it if you have some experience using it and answer questions below.
Can you put markup comments on 3D models easily?
When you update comments, are they automatically saved right after you click some update button?
Can you delete 3D model data easily?
Is it mandatory to upload 3D model data to the Autodesk cloud server when you use the Forge Viewer? I don't want to put design data outside of my service but want to see 3D model on a browser.
You can upload any model and check with Viewer through viewer.autodesk.com
We have a few options for markups on documents. this blog might be helpful. You can also take advantage of sprites and textgeometry for labeling your models
Depending on the method you'll need to implement an algorithm to save, store and load your markups.
The data you see with Viewer is the SVF(2) generated by a translation from a source file. To modify the source file, you'll need to run a Design Automation job.
You need to upload your models to a bucket in order to trigger a translation, generating an SVF(2) that can be rendered with Viewer (refer here).
Formats like gltf, pdf, and dwf can be loaded without the need for translations.
I've been learning Forge API for past few months, but still relatively new to the platform. Please excuse if this is an obvious question.
I have an Autodesk Forge application where I upload a Revit file and extract its meta data into a database. In the metadata, there is a category called 'Function'. It shows if the particular element is Interior or Exterior. If the 'Function' data is missing, is there any possible way to identify an interior and exterior element using the Autodesk forge API? Or programmatically?
In Revit, I use Element.Location node (in Dynamo) and extract XYZ coordinates of walls, windows etc, and run that data through an algorithm which differentiates interior and exterior elements. What is the possible way of identifying interior and exterior walls, windows, stairs etc.
Appreciate any help/guidance.
As I know, only Revit walls have the function parameter, and it's part of element properties (in Revit, we call it parameters). In Forge Viewer, you can get it via call Viewer3D#getProperties.
https://knowledge.autodesk.com/support/revit-lt/learn-explore/caas/CloudHelp/cloudhelp/2022/ENU/RevitLT-ArchDes/files/GUID-718C1341-C4FC-40D6-9646-D2E13A861D33-htm.html
Unfortunately, there is no equality of Revit API's Element.Location in Forge Viewer, since all geometries will be translated to meshes during Forge translation. To get mesh location, you may take advantage of the center of the object bounding box: https://stackoverflow.com/a/64769854/7745569
I am use to develop one web app using Forge API. It's working well and good. At the same time am using design automation in forge. I can able to create Package and it's working fine.
I will process the dwg file using forge api preparing to viewer. I can able to view dwg in browser.
My issue is I have viewer click event the event click populate the element id. However, my package I can get only the object id. element id and object id totally different.
What is the conman id each object client and server side.
Summary: when user click the object in viewer I want to capture id and store my local database. and using package I need to process the user clicked object.
Example: when user click the drawing number in viewer. From the next time I want change the drawing number dynamically using call package from C# code.
For an RVT file, one easy way to handle this is to extract the Forge externalId from the Forge object properties. That is equal to the Revit element UniqueId property. The RvtMetaProp Revit add-in makes use of this.
Oh, now I just found a better, more complete and succinct explanation of Unique IDs for Forge Viewer Elements:
The Viewer gives access to three types of IDs when dealing with Revit files:
dbId: this is viewer specific and used to manipulate elements within the viewer, such as for the .getProperties() method.
Revit ElementID: exposed as part of the Name property in the viewer. When you select something, the Property panel title is in the form of 'Name [12345]'. You can parse this name string and extract the element id.
Revit UniqueID: exposed as the externalId property in the .getProperty() response.
In my Revit model I have groups of objects that I can select when working in Revit. Now, using this model in Forge viewer, I can only select the single elements (or their parent elements in the browser structure), but I cannot reconstruct my groups from Revit.
Is there a possibility, or some proposed workaround?
Do you see those groups in the viewer model browser? For example you get components grouped by Walls, Floors and so on. If the components are grouped by another way, then there is probably no direct way to select them in the viewer.
You would need to establish the mapping yourself, for example you can access the Revit elementId for a given component dbId using viewer.getProperties(dbid, function(res)) > res.externalId is the revit Id. If you store - eg. in a custom DB - your Revit groups along with the list of Revit Ids in each group, then you can map that to the Viewer components dbIds when you load the model. Using the selection event, when you select a component, check in which group it belongs to and select programmatically other components of that group. You could also create a custom UI to visualize that or derive the model browser to show those groups. It requires programming work obviously.
I agree with Philippe. The Forge translation process does not have the same notion of groups as Revit. Remember that Forge has to implement mechanisms that are valid for all kinds of different types of CAD seed files. You can implement Philippe's suggestion by retrieving all groups in Revit using the Revit API and a FilteredElementCollector, determine their member element and instance ids, and use that information to create the required mapping.