When i'm loading a kml file in the cesium viewer I get KmlDataSource contains the entities that are in the kml. The problem is that the hierarchy of the kml is not available.
in every entity there is property named "_children", but it exists only in the Unminified, so we can't use it. currently we are creating the hierarchy using the "parent" property but its pretty ugly.
thanks.
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 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.
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.
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 did a conversion program to change the object structure of a DWFx file, and it works fine. What I did was to open the DWFx file as a zip archive, parse the internal XML files, and reorganize them, creating new parent nodes when needed.
But what doesn't work is changing the names of these nodes. When I open the file in any Autodesk viewer (the offline Design Review program and the online Viewer are the ones I tested), the tree structure is changed as it should, but the parent node names are not. In fact, the nodes that already existed keep their old names, and the new ones are called Object XXXX. The child nodes (actual objects) have their names changed correctly.
I tried to search in every readable (text) file inside the DWFx, but none of them hold any other reference to these nodes. I didn't open binary files, like W3D files, which probably hold the geometry.
Does anyone have any experience in creating or altering DWFx files? Do I need to change anything else besides the 'label' tag in the Presentation XML file?
Instead of manipulating the contents of DWFx files manually, consider using one of the Autodesk Forge services: Design Automation. The APIs allow you to run AutoCAD "in the cloud". You could theoretically load your DWFx file there, update the structure/names, and generate an updated DWFx file. Here's an example of how the service can be used to generate PDFs out of DWG files: https://forge.autodesk.com/en/docs/design-automation/v2/tutorials/convert-dwg-to-pdf.