Convert .OBJ to JSON format with libgdx - json

I'm working on a project where we need to convert .OBJ models into .G3DJ (JSON) format on the fly. I've tried with this code I've founded in google code.
https://code.google.com/p/libgdx-users/wiki/ImportingModelsFromBlender
ObjLoader loader = new ObjLoader();
StillModel model = loader.loadObj(Gdx.files.internal("data/model.obj"), true);
G3dExporter.export(models, Gdx.files.absolute("data/model.g3d"));
But StillModel and G3DExporter cannot be found in libgdx.
Any ideas?

The libgdx-users wiki is not up to date. Converting an OBJ file to G3DJ (or G3DB) can be done using fbx-conv, which is a command line utility (you can call it from code if you like).
Also make sure to update to the nightly build. StillModel is no longer supported (and does not support the G3DJ (JSON) file format).
It is recommended not to use OBJ (although it is still supported). Instead use FBX (converted to G3Dx), which supports more functionality than OBJ.

Related

How to convert binary protobuf file to json file in Scala?

In my project I have proto file, the respective class files also. I have probuf binary data as blob file format. How can I convert this file to json file? I am very new to Scala.
I came across https://scalapb.github.io/docs/ site. It is not very clear to me. I do not want to install this whole but rather just make use of Json4s to convert protobuf data to json data.
Any pointers? Which library can I use and how can I use it?
The .proto files are your source of truth. There should be no "respective class files"
ScalaPB should be used as an SBT plugin. It will generate "managed" code when you compile your project. That managed code will consist of case classes that mirror the definitions in the proto files and companion objects that can serialize the protobufs.
Managed code is code you do not edit as a user. You won't even see it unless you look for it in the target directory. If your proto files change, the compiler will re-create the proper code to reflect those changes. That is why you should not hand-create these case class files.
Then apply their Json4s helper-lib which cuts down on a few steps

How can we read a json file only once for entire feature file in karate

I am calling multiple json and js files in my feature file in background, which is required for every scenarion in my feature file.
def test= read('classpath:testData/responseFiles/test.json')
problem is that, it is running/reading for each scenario. Is there something i can do, so that it read only once for feature file and can use for all scenarios. I am using 9.0.0 karate version
callonce is only working to call feature filen not json file
Read the JSON file in a called feature and then use callonce.

Can we convert 3dm file to stl or obj file using opennurbs c++ sdk

I am looking for how can we use opennurbs c++ sdk to convert 3dm file format to stl or obj file format. I have already tried looking its documentation but got nothing much helpful.
documentation link [http://developer.rhino3d.com/guides/#opennurbs][1]
another link: [http://wiki.mcneel.com/developer/opennurbs/home][1]
Is it possible to convert 3dm file format to stl or obj file format using some API of opennurbs sdk or any other sdk. If yes then which API or sdk can be used ?
openNURBS by itself only supports Rhino's 3DM file format. The 3DM file format can support both mesh and NURBS geometry, but STL only supports meshes. OBJ can support both.
You can use Rhino to open the 3DM file and save as OBJ or STL. Rhino also includes a robust mesher that can convert the NURBS geometry into a mesh for STL output.
You might also consider Okino's PolyTrans software for doing file conversions automatically.

How can I import three.js's JSON into Maya?

I would like to import JSON(made by three.js) data into Maya.
I found exporter of Maya, but couldn't find importer of Maya.
Is there good way to do it?
There are currently no Three.js JSON importer.
The Three.js JSON is meant to be a runtime format, used by Three.js for rendering in WebGL. Usually, you would export to the JSON format when you want to use it for the web. It is not meant to be a storage format.
There are other more common "interchange" formats like FBX, Collada, or OBJ, that are meant to be for storage and for passing around between different people and software packages.

Can i use xml3d with stl models?

I'd really like to use STL models with XML3d. Is there a way to convert back and forth between these formats?
You can convert STL files to XML3D using the Blender exporter for instance:
https://github.com/ksons/xml3d-blender-exporter
Another option is to write a plug-in for STL files that allow to reference STL files from <mesh> and <data> elements:
<mesh src="foo/bar.stl"/>
This would be very similar to the existing plug-ins for MeshLab/JSON and OpenCTM files:
http://xml3d.github.io/xml3d-examples/examples/meshlab/meshlab.html
http://xml3d.github.io/xml3d-examples/examples/openctm/openctm.html
We've just released a new converter that uses the Open Asset Import Library to convert many 3D formats (including STL) to XML3D's asset format:
https://github.com/csvurt/assimp2xml3d
It can't convert from XML3D back to other formats, but this might be something we add in the future.
There is a plug-in for STL file now:
https://github.com/xml3d/xml3d-stl-plugin
It allows using STL files as simple as:
<mesh src="../path/to/model.stl"></mesh>