Export from OpenCascade, import into OpenSceneGraph - import

We have a modeling tool which uses OCC, and a 3d editor using OSG. What I want to do is, export the model from the first tool and import into the second tool. I have been searching the web for days, but I can't find a solution.
Three things can solve my problem:
An exporter for OCC to export into OSG supported formats (.ive, .osg, and many more),
An importer for OSG to import from OCC supported formats (.stp, .step, .igs, .iges, .brp, .brep ),
A converter tool for converting between two formats, one format supported by OCC and one format supported by OSG.
Has anybody done this before, or know of anything that can help?
I am trying to avoid writing a custom exporter for OCC.

I found a solution. OpenCascade has an import/export example, which can export VRML files without texture support. Some modifications on the import export code and some modifications on other parts (where the OCC model is represented by VRML classes) was enough to successfully export my model to a VRML file. Then i built the VRML plugin for OpenSceneGraph and successfully imported the model.

CADExchanger (OCC based) does a pretty good job converting between BRep and other formats (STEP, IGES, STL, VRML...)

Why don't you have a look at pythonocc.org.
I'm assuming OSG takes meshes?
Load the STEP / IGES file in (python)OCC, grab its mesh, push the verts / indices to OSG.
Would that work?

Related

Is it possible to export FBX or OBJ files from Aveva marine?

I want to export 3D models made in Aveva Marine to be used in the Unity game engine.
Is it possible to export models to .FBX or .OBJ directly from Aveva Marine or I need to do use conversion software?
I haven't found any other way that can do that without converting to another format first.
The file formats of your model exports depends on your Aveva Marine software version. I believe .FBX and .OBJ are both supported formats using the Export function in the software. If this doesn't seem to work you are going to need to export it in a not very specific type like .RVM and use a conversion tool to turn it into an .FBX

OpenScad: How to use difference() with imported STL?

I can import external STL to OpenScad, and use it as is.
Yet I fail to manipulate the imported object, mostly with the difference() command.
Mostly I need to cut pieces out of the imported STL. I know it can be done on the slicer (I was PrusaSlicer), yet I prefer to do it on the OpenScad because I can do it systematically on the source code. Also, sometimes the needs to cut are not as simple as the slicer can do.
For example: difference() { import("ext_stl.stl", convexity=20); cube([10,30,10]); }
I assume the imported STL is written in a format that OpenScad can't handle, so I wonder if there is any way to translate this input STL file into something that OpenScad could handle it?
I tried importing the STL into a module and use the reference to this module.
I also tried loading it into PrusaSlicer and exporting as a new STL - also failed.

RDKit: generate fingerprints from ZINC database for cluster analysis

I'm new to RDKit. I need to do a cluster analysis of a database of compounds.
I've downloaded 191K compounds from ZINC database in 3D mol2 format and now I need to obtain fingerprints using RDKit.
First, I don't understand if it's possible to convert mol2 format into fingerprints and what kind of fingerprints is better for this type of analysis (I need to understand what chemotypes I have in the database in order to - eventually - find some representatives).
Does anyone have suggestions?(practical suggestions are really appreciated, too).
Thanks
RdKit supports the mol2 file loading. You can use the MolFromMol2File function for that.
from rdkit import Chem
mol2_paths = ['path1', 'path2', 'path3', ......]
mols = []
for path in mol2_paths:
mols.append(Chem.MolFromMol2File(path))
The above function will load all the mol2 files and create a RdKit molecule object for all of them. Once an object is created, you can use it to calculate any of the properties (similar to how you would calculate if you had a SMILES string).
Now, for clustering, RdKit has a ClusterData module, you can use that. See the module here. See an example usage of the module here. Another example here. Check out this presentation on different methods of clustering in RdKit here. An alternative way to cluster here.
Hope this should be a sufficient information for you to go ahead.

Convert STEP file type to STL

I want to convert a STEP file into an STL file format using Python. I have looked online and it looks like the best option is to either use FreeCAD or OpenCascade (OCC). However, I am a beginner and do not know where to start from. I did some search online and found this out (a code to convert STEP to OBJ file).
Are there any python examples from FreeCAD (based on OCC) to convert STEP files to STL? Where should I start?
Here's a quick bit of code to start out:
import FreeCAD
import Part
import Mesh
shape = Part.Shape()
shape.read('my_shape.step')
doc = App.newDocument('Doc')
pf = doc.addObject("Part::Feature","MyShape")
pf.Shape = shape
Mesh.export([pf], 'my_shape.stl')
FreeCAD uses python extensively for user-facing functions. Basically, anything you do through the UI is done with python.
So it's useful to open up the UI, open up the Python console, and then do a function manually. You can often just copy the python directly from the console and edited it to serve your needs.

Suggestion to consider improving MatFile support by using code from csmatio to read and write .mat files

is anyone using MatFile classes in ilnumerics?
I just tried to open a MAT file created using csmatio and found I could not import it into ilnumerics application.
Hit throw new Exception("element data type is not supported");
as there is no support for mxSTRUCT_CLASS in the method
private ILBaseArray read_miMATRIX(BinaryReader br).
Is it a lot of work to add support for mxSTRUCT_CLASS?
ILNumerics will add support for HDF5 soon. This will also provide access to recent Matlab mat files. There are no plans to improve the old ILMatFile interface currently.