I need to find sub-parts of .obj and .stl model and then I have to show them on browser.
I can show them on browser using three.js or X3DOM but I am unable to find sub-parts of these models.
Is there any algorithm or functionality to find sub-parts of .obj or .stl model? Kindly help.
Related
I would like to convert assemblies from a .RVT model to three.JS to .USDZ for AR. I have a list of assemblies and want to process each individual file into the final format of USDZ for AR. Does anyone have any good recommendations? I’m thinking Model Derivative IFC to three.JS to .USDZ but would love know the best method for this! Thank you!
The ModelDerivative API allows you to convert your RVT file (and many others) into SVF (or SVF2) to be used by the viewer for example. Then you can use Forge Convert Utils package to extract the geometry and create a glTF of your model.
glTF is widely used for AR but if you need to use USDZ, you can easily convert your model with this kind of tool : USD_From_glTF
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.
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'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.