I have an Autocad dwg file that i want to convert into gltf. I have used autodesk forge as well as autodesk forge tools in VS Code to get gltf. Both the tools are able to convert into gltf but the problem is there is no color in the gltf, it is just black and white.
Is there some way to get color in the gltf file or obj file?
The mapping of colors from Forge models to glTF in forge-convert-utils is pretty basic at the moment but it should be able to get at least some basic diffuse color. Try this:
open the gltf file, find the list of materials, and see what colors you see in baseColorFactor properties; if the values are [0,0,0,0], the problem is in the conversion
if you see non-zero values there, perhaps there's a problem with lighting up the model in your viewing application; for example, when loading a glTF model into a three.js app, you must add at least an ambient light otherwise the model will remain black
If you're still having issues, please consider sharing your DWG (confidentially) with us via forge (dot) help (at) autodesk (dot) com, and we'll debug it locally.
EDIT: As discussed in https://github.com/petrbroz/vscode-forge-tools/issues/16, the issue was a lack of support for meshes with vertex colors in the converter library. As of forge-convert-utils version 3.4.0, and vscode-forge-tools version 1.5.1, vertex colors in Forge models are now properly translated into glTF vertex colors.
Related
I try to load a three.js file (Json from rvt) into the offline version of the forge viewer. How I can do this?
Thank you!
Forge viewer is based on three.js. It is similar to adding mesh to the scene in native three.js context. The below are one demo extension.
https://github.com/Autodesk-Forge/library-javascript-viewer-extensions/tree/0c0db2d6426f4ff4aea1042813ed10da17c63554/src/Autodesk.ADN.Viewing.Extension.MeshImporter
In this demo, the json file (Arbor Press.json) is from Inventor. It contains the definition of the geometry and material. The code of the extension will parse the json, and create mesh in the scene of Forge Viewer.
You might also need to take a look at the other extension for examples of changing material colors:
https://github.com/Autodesk-Forge/library-javascript-viewer-extensions/blob/0c0db2d6426f4ff4aea1042813ed10da17c63554/src/Autodesk.ADN.Viewing.Extension.Material/Autodesk.ADN.Viewing.Extension.Material.js
However please be aware your meshes will not be detected by the viewer selection logic, some extra work would be needed if you want that.
I'm trying to translate Revit file that contains both 3D and 2D geometries. I've verified that the file contains proper 3D geometry, by opening it in revit 2019 and visualizing it through 3D viewing mode.
However, when I pass this file into model derivative process, it only creates 2D derivative.
Before translation process, I've tried to set default view of the revit file as '3D' instead of 2D drawing file, which didn't work.
I've also tried making a translation POST request with formats as 'svf', and views as both ('3D', '2D'), and ('3D' only), which both failed.
However, all these attempts didn't work, and when I inspected the manifest from the file translation, it seems like that 3D geometry is completely missing. I think that there is a unhandled exception in Model Derivative process that fails to extract 3D geometry in our particular forge model file.
If you need URN of the file / actual file, please let me know.
Thanks in advance.
- EDIT
UPDATE:
I've confirmed that the default 3D view is named as {3D}, default name set by Revit.
What is the name of your default 3D view?
The default name is "{3D}", I believe.
Maybe the translation process does not pick it up if it is named differently.
Afaik, the one and only way to specify the views for the translator to process is by using the Collaboration for Revit or C4R BIM 360 Team tool to select the views to publish to the cloud.
I'm working on a javascript application that uses the MarkupsCore extension to create markups on a floor plan in the Autodesk Forge Viewer. I want to export a .dwg file from the viewer, but I also want the file to contain those markups. I basically know how to export the .dwg file, but I don't know how to combine the svg markups with the file before exporting. Is this even possible? If so, how?
The markups as stored/saved as SVG files, which is a XML-based format to describe geometry. And I believe you know that :-) I did a quick search and found a few articles about SVG to DXF conversion, where DXF can be imported and converted into DWG via AutoCAD engine (or Design Automation API).
So a route would be: show DWG model, add markups, save as SVG, convert to DXF, convert again to DWG, merge into original DWG. I don't have such a sample nor can guarantee it will work and be accurate, sorry.
I've seen some examples of high quality and detailed models that works for the Autodesk Model Derivative. Some example are Dotty, Dasher and Fusion Race Car. Dotty is actually amazing.. even has some reflection added in there.
So, to achieve this I would need to upload the textures and the materials with my model. I've tried to reproduce the guide telling me to create a ZIP containing of the OBJ, MTL and PNG. First of all, to be sure I am on the correct path when I am testing out different workflows: is OBJ the only format that can be uploaded with custom materials/textures? I know that I can add standard materials to rvt, fbx, 3ds etc, but I do not have a clear idea on how to upload custom materials/textures.
Could you kindly give me a step-by-step how to get the best possible visualization of the uploaded models? Thanks a lot
Models from Fusion 360 uses the built-in material library, in the case of Fusion Race Car you mentioned. The Dasher sample uses a Revit model of a "well-designed" model in Revit, but no custom materials. Don't have much info on the Dotty format, but would consider the direction of obj or rcp (Reality Capture or point cloud) files, both can have texture.
For a custom material, OBJ is the best route as of now, allowing you to include your textures. As far as Forge, the translation is exactly the same: upload the zip with all files and post a job with rootFilename pointing to the .obj file.
I have a collada (.dae) 3D file with nodal colour for contouring. But these information are lost while uploading to autodesk viewer api. I have attached the file for reference.
https://1drv.ms/u/s!ApS9nIpyJIuQbJulgP5rcm1b-ic
Is there any other way to show contour in viewer api ? Please help.
Yes, unfortunately, the DAE, Obj, FBX pipelines only translation geometry. Material & Textures won't get through. We are working on a process to handle this as well as supporting glTF. The is no solution to workaround this limitation at this time.