Scene for compas_rhino.geometry.curves.nurbs.RhinoNurbsCurve


I am testing out the Scene properties to visualize my compas geometry objects in Rhino.
with the example code you have online. Mesh, point and several geometry classes work great!

I tried to draw a compas_rhino.geometry.curves.nurbs.RhinoNurbsCurve type object, like below

from compas.datastructures import Mesh
from compas.geometry import Point, Vector, Line, Sphere, NurbsCurve
from compas.scene import Scene

arch = NurbsCurve.from_points([[5, 0, 0], [5, 5, 5], [5, 10, 0]])


scene = Scene()

but I get the error below:

<class 'compas_rhino.geometry.curves.nurbs.RhinoNurbsCurve'>
Traceback (most recent call last):
  File "file:///C:/Users/Uday/OneDrive%20-%20sbp%20SE/Dokumente/coding/", line 10, in <module>
  File "C:\Users\Uday\.rhinocode\py39-rh8\site-envs\default-KA6C24DI\compas\scene\", line 304, in draw
    drawn_objects += sceneobject.draw()
  File "C:\Users\Uday\.rhinocode\py39-rh8\site-envs\default-KA6C24DI\compas_rhino\scene\", line 39, in draw
AttributeError: 'NoneType' object has no attribute 'Transform'

another related question, in the older versions of compas i used to be able to set the layer and sublayer for baking. Quickly glanding at the docs I do not see this attribute in Scene. Is this still possible ?

thanks in advance!

this is a bug related to the degree of the curve. the default degree of from_points is 3. if only three control points are given, this should automatically be reduced to 2, but it is not. i will add a fix for this. however, in the meantime, you could do

arch = NurbsCurve.from_points([[5, 0, 0], [5, 5, 5], [5, 10, 0]], degree=2)

and the problem should go away…

regarding the layers. you can use the layer parameter of scene.add

scene = Scene()
scene.add(arch, layer="TestLayer::TestSubLayer")
1 Like