Hi @Willem - thanks for your reply. No not yet because there appears to be quite a few methods that sounded similar. Here are the methods that I was going to experiment with:
First I will try RhinoDoc.GetRenderPrimitiveList() since I guess this will enumerate all the objects in the document calling RhinoObject.GetRenderPrimitiveList on each one. I donāt know if that is identical to RhinoObject.CreateMeshes() but iāll try both. Maybe these all do the same thing?
If you know the object is a brep, then you can use the Mesh.CreateFromBrep() method. Something like this:
var rhinoObjs = doc.Objects.FindByObjectType(ObjectType.Brep);
var meshedbreps = new List<Mesh>();
foreach (var item in rhinoObjs)
{
var brep = item.Geometry as Brep;
var mesh = Mesh.CreateFromBrep(brep); //optionally set meshing parameters
meshedbreps.Add(mesh);
}
...
Currently we are working only with breps but I wanted to leave the door open for future other object types.
So yes at the moment I could use Mesh.CreateFromā¦() methods in c# and send only mesh objects to my threeJs scene but I was hoping to be future proof and send entire 3dm document to the threejs scene relying on your 3DMLoader.js class to convert every type of meshable object that it can to threejs. --That way as you mature your 3DMLoader.js class (perhaps texture/material support etc) i would get the improvements too
So i think for now I would like to call RhinoDoc.GetRenderPrimitiveList() on my c# side for the entire document so that all objects have a rendermesh present ā then Iāll send the entire doc to JS and rely on your 3DMLoader class to convert to threejs.
Unless performance of 3DMLoader.js is much worse than using Mesh.CreateFromBreps() on only the breps - so Iāll test and compare.
Calling the RhinoObject.CreateMeshes() method server-side (c# Compute plugin) hasnāt worked for me.
The breps are still being reported by 3DMLoader.js as having no render meshes.
Perhaps this is because I am calling .CreateMeshes() in Compute which is headless.
Perhaps the brep.EnsurePrivateCopy() or brep.Compact() steps are removing the rendermeshes from the breps.
For now I have run out of time with this approach.
Instead I will take @fraguada suggestion and instead of sending breps to the webpage iāll create mesh objects directly with Mesh.CreateFromā¦() methods and send these meshes to the Javascript and convert them to threejs using:
const loader = new THREE.BufferGeometryLoader()
const geometry = loader.parse(mesh.toThreejsJSON())
return new THREE.Mesh(geometry, material)
I try to load Annotations via threejs and get āTHREE.3DMLoader: Conversion not implemented for ObjectType_Annotationā, type: ānot implementedā
the message is clear but i like to know if someone do have some nice workaround to get the informations of the annotations like startpoint and endpoints or length inside the 3dmLoader?
We donāt have much in openNURBS to deal with annotations and since openNURBS is the basis for rhino3dm, there isnāt much in rhino3dm. I will see what we can do to make some of that info public.
My application displays 3DM Models using R3F + Rhino3dmjs and in the models we have measurements (quotas) and the measurements are text type objects.
At the moment the text objects are not rendered.
In the browser console I get the following warning:
THREE.3DMLoader: Conversion not implemented for ObjectType_Annotation
Iām assuming this has to due with the fact that the object is Type Text. I canāt recognized them on the 3DMLoader (just looping the model children and output to console > āchild.Typeā)
For now I would recommend exploding the annotations, or creating some sort of customized data structure from within GH to help you visualize this information on the front end.
Each object type requires a conversion to a three.js type. Meshes in Rhino have a specific data structure that we need to convert to the three.js mesh data structure. Same for curves. There is no three.js Annotation object, so weād need to develop something that can represent an Annotation in three.js. This is not a trivial task, hence why weāve not done it.
In any case, I will take a look at what other Annotation data we can make accessible via rhino3dm.
For now, and to get around this issue, weāre changing the model objets to TextDots (theyāre supported by 3DMLoader) and converting them into Sprites.
But it would be useful to have some kind of direct conversion (if possible, of course).