Is There a Java Library For Interfacing With .3DM files?

Hello, I have two questions.

First, is there a way in Rhino to automatically change the lineweights of lines and NURBS based on distance from camera? I would like to do this with architectural renderings to represent closer objects with thicker lineweights, and farther objects with thinner ones. I would also like the thickness of the line to increase or reduce along individual lines.

If this is not possible, I am writing a Java application (not JavaScript) to take the geometric data of lines and NURBS to generate the lineweight renderings through said application. I would like to easily pull the geometric data into the Java application using a library. However, I see that Rhino3dm (which may have this functionality), supports JavaScript, but not Java. Is there a library for Java, to use data from the .3dm files saved by Rhino? If not, is there a library to stream in data from other file types?

No idea about the Java part of your question but Rhino 8 supports tapering line weights for individual lines/poly lines.

Furthermore, with a custom line weight component in C# or Python, you can set the preview line weight as a float number value representing thickness.

You could, in this script, get the camera position minus the position of each line in your scene and set a thickness value accordingly or create a Bounds domain (closest and furthest line distance), remap this range to 0 To 1 and then multiply this value per line against a max thickness parameter.

So example lines in the foreground could be 5 and the background lines could be .01 thickness.

Hi @Andrew_Kelly,

This is a question best asked in the Rhino category.

We don’t have a Java version of openNURBS. But (I hear) it’s possible to use C++ DLLs with Java applications. You’ll need to Google this for details.

– Dale

rhino3dm is a project that adds bindings on top of our C++ OpenNURBS project to allow for access from .NET, Python, and Javascript. We don’t have a set of Java bindings, but it is definitely possible.

Excellent, thank you for all the options.

A set of Java bindings would be fantastic, as that is the language I am most familiar with at the moment.