To send our model to Forge, we have converted(published) our DWG to DWFx file. We are doing that because DWFx files allow us to append additional properties for each element.
Is there some possibility to know the externalId property of Forge, during DWG/DWFx convertion? Maybe using the BeginEntity event of Publisher object(Autodesk.AutoCAD.Publishing Autocad.NET API)?
On this post http://thebuildingcoder.typepad.com/blog/2009/02/uniqueid-dwf-and-ifc-guid.html, Jeremy explains how translate episodeId guid + UniqueID of Revit element to DWF ID. But it was not feasible at Autocad. Do you have some clue about that?
I have done all steps that Jeremy have explained, but I did some changes in my code as change Revit UniqueId for CAD Handle, even so I could not get the externalId property.
it has been a long time without update. my apology for the delay! just fyi what might be useful about the externalId of DWFx. It can be got by the steps below:
Copy the *.dwfx file to another file with extension ".zip",
Extract the ZIP file.
View the XML file: dwf\documents\B32F5310-75D4-4AC6-98DA-F27855056814\1830A475-854B-4F12-A992-7339E636067D.content.xml
you will find such id with the object name + AutoCAD entity handle, which means when AutoCAD exports file to DWFx, it generates such id for DWFx
Related
I want to custom translate a model in the forge configurator inventor. This model will be a model that is created and cached after the update process. I want to translate the abc.iam file in the "cache / projectid / hash / model.zip" file and get the urn after this operation.
I couldn't find the document about translate object custom. Also, how can I do this with the model in the cache of this project?
This is how the content is organized - highlighted the bucket name:
You can either use the https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectName-details-GET/ endpoint to get the ObjectId of the file or construct it yourself based on the template: urn:adsk.objects:os.object:<bucket name>/<file name URL encoded>
Note: make sure the file name is URL encoded if making the REST call directly instead of using the Forge SDK
You can see what ObjectId is provided for a given file e.g. using the Autodesk Forge Tools Extension in VS Code:
You need to base64 encode the ObjectId in order to get the urn of the file and then use that to kick off the translation: https://forge.autodesk.com/en/docs/model-derivative/v2/tutorials/translate-zip-to-stl/
In case of a zip file you also have to provide the rootFilename (it's pointed out in the sample referenced above) - in case of e.g. the Wheel assembly that's the WheelAssembly.iam file
I've been using the externalId to uniquely refer to objects in the forge viewer and connect them with outside data about these objects. This has worked well for revit files, which have a kind of GUID 86715290-fa28-4ff5-aef9-8c75d7c81e77-0012917b. Now I'm working with a Navisworks file, and their externalId use looks very different with values like a, 0 or 0/0/0/. How persistent are these, I can imagine not globally unique, but do changes/removals/additions keep them unique within the file? What is the suggested strategy to globally refer to solids in Navisworks files?
The external id of the path through the model selection tree to that element started from 0, see the snapshot below:
As I know:
In Revit case, it uses a unique id of the element (saying Element.UniqueId of the Revit API) as the externalId. However, the Navisworks doesn't have a concept unique id since it will have to handle different formats and some source models don't have unique id either. Therefore, it uses the selection tree path as the externalId instead.
Thus,
To preserve the identity information of the Revit elements, I would like to advise you to add a Revit shared parameter to store the value of the Element.UniqueId, and identify the element by this parameter.
I am working on doing a post job and I am confused about where files need to be to run the job and the proper urn.
The examples all use a file that the user uploads to a bucket. I am trying to run the post job on a file that a user has created in Fusion 360 and that he has selected through a GUI I created. The urn in question is obtained by letting the user select the hub, project, folder(s), and file. I then use this file urn on the post job.
I keep getting back the response of :
Failed to download the design description for the input design.
My questions are:
Is it possible to do this from a users hub or do all items have to be in buckets?
Where are those translated files stored once created? If I want to get data like volume and mass without storing the translated file, is that possible?
I took the "urn:" off the front of the urn and got a different error, which I believe meant that it couldn't find any file.
Invalid 'design' parameter.
So, it looks like the urn I am using is finding a file but there is an issue somewhere that is preventing that file from being accessed or translated or something.
I keep getting back the response of : Failed to download the design description for the input design.
For Fusion 360 files make sure the extension name of the object is f2d/f3d. BTW Forge Viewer support these two formats directly so you don't have to translate to SVF for Viewer to visualize them.
Is it possible to do this from a users hub or do all items have to be in buckets?
For hub project items use the Data Management API to obtain the object ID - be sure to include the version parameter in your URN - see GET projects/:project_id/folders/:folder_id/contents and use the id of the item as your URN as well as tutorial here to help you understand how project folder items work.
Where are those translated files stored once created? If I want to get data like volume and mass without storing the translated file, is that possible?
The translated derivatives would be stored separately and you can access them through the derivative manifest. Use GET :urn/metadata/:guid/properties to query derivative properties but you will need to translate the model (to any format will do) in order to extract properties - see tutorial here.
i am trying to make auto-desk forge viewer.
using this link Forge & ASP.NET: from zero to hero in 30 minutes
and it works fine with single revit file.
now i want to view revit document that has linked document and i found this post How to Set References with Revit Files for View and Data API
but i think it is an old version of api.
so i don't know how to apply these steps in the viewer code.
any help
A zipped file which is contained the host RVT file and corresponding linked files can help you archive this goal. After uploading this ZIP file to the Forge DM, you have to make sure that ‘compressedUrn: true’ and ‘rootFilename: {your host RVT filename with the sub filename .rvt}’ your input field of the job configuration body while submitting your translation job. Please refer here for the details: https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/
Some more info:
If you do not want to manage the reference, while simply count on Forge detects the reference automatically, the choice is what Eason mentioned: package all files in an zip, upload, and ask Forge Post Job service to translate the zip. You only need to specify the root file.
https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/
This blog tells more:
https://forge.autodesk.com/cloud_and_mobile/2016/07/translate-referenced-files-by-derivative-api.html
If you want to manage the reference, e.g. in one time, you have uploaded all files of one version or only a few files of the package. While after some time, some files need to be updated, or are not referred anymore, but it is unnecessary to upload all related files again (as in #1, upload zip again).
In such scenario, the choice is, firstly, set reference manually by another Forge service (Set Reference):
https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-references-POST/
next, ask POST Job service to translate:
https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/
As of 1/2020 Autodesk has said that they do not support reference endpoint when exporting to SVG so zip file is the only supported method currenty.
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