MiguelVidal
(Miguel Vidal)
September 17, 2020, 4:45pm
1
Hi all,
I am fairly new to Rhino.Compute and have followed the examples posted on the Rhino website and most of them, use meshes as an example
Is there documentation on how to pass other geometry types, such as Breps, curves, lines etc to Three via compute? or perhaps a sample file?
Many thanks for your help
Miguel
fraguada
(Luis Fraguada)
September 17, 2020, 6:30pm
2
Check out the 3DMLoader code for three.js for examples of how we’re covering 3dm to three.js types.
import {
BufferGeometryLoader,
FileLoader,
Loader,
Object3D,
MeshStandardMaterial,
Mesh,
Color,
Points,
PointsMaterial,
Line,
LineBasicMaterial,
Matrix4,
DirectionalLight,
PointLight,
SpotLight,
RectAreaLight,
Vector3,
Sprite,
SpriteMaterial,
This file has been truncated. show original
Specifically here: https://github.com/mrdoob/three.js/blob/dev/examples/jsm/loaders/3DMLoader.js#L1036
The rview project has similar conversions.
import * as THREE from 'three'
import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer.js'
import RViewApp from './RViewApp'
// import GlslGrid from './GlslGrid.js'
import GlslLineList from './GlslLineList'
import GlslScreenQuad from './GlslScreenQuad'
function curveToPoints (curve, pointLimit) {
let rhino3dm = RViewApp.getRhino3dm()
let pointCount = pointLimit
let rc = []
let ts = []
if (curve instanceof rhino3dm.LineCurve) {
return [curve.pointAtStart, curve.pointAtEnd]
}
if (curve instanceof rhino3dm.PolylineCurve) {
pointCount = curve.pointCount
for (let i = 0; i < pointCount; i++) {
This file has been truncated. show original
Mind you both of these projects are converting from objects in a 3dm file. When receiving from compute, you should call
rhino.CommonObject.decode(data);
after parsing the returned json, and then deal with the geometry.
1 Like
MiguelVidal
(Miguel Vidal)
September 18, 2020, 9:22am
3
Hola Luis,
Great to see you again around these pastures!
Thank you for the quick response. This is exactly what I was looking for
I’ll give it a go and will be in touch
Cheers!
Miguel
1 Like